Wednesday·04·April·2012
Tools for CLI Road Warriors: Hidden Terminals //at 00:57 //by abe
Some networks have no connection to the outside except that they allow surfing through an HTTP(S) proxy. Sometimes you are happy and the HTTPS port (443) is unrestricted. The following server-side tools allow you to exploit these weaknesses and get you a shell on your server.
sslh
sslh is an SSH/SSL multiplexor. If a client connects to sslh, it checks if the clients speaks the SSH or the SSL protocol and then passes the connection to the according real port of SSL or some SSL enabled service, e.g. an HTTPS, OpenVPN, Tinc or XMPP server. That way it’s possible to connect to one of these services and SSH on the same port.
The usual scenario where this daemon is useful are firewalls which block SSH, force HTTP to go through a proxy, but allow HTTPS connections without restriction. In that case you let sslh listen on the HTTPS port (443) and to move the real HTTPS server (e.g. Apache) to listen on either a different port number (e.g. 442, 444 or 8443) or on another IP address, e.g. on localhost, port 443.
On an Debian or Ubuntu based Apache HTTPS server, you just have to do the following to run Apache on port 442 and sslh on port 443 instead:
apt-get install sslh
as root.- Edit
/etc/default/sslh
, changeRUN=no
toRUN=yes
and--ssl 127.0.0.1:443
to--ssl 127.0.0.1:442
. - Edit
/etc/apache2/ports.conf
and all files in/etc/apache2/sites-available/
which contain a reference to port 443 (which is only/etc/apache2/sites-available/default-ssl.conf
in the default configuration) and change all occurrences of443
to442
. service apache2 restart
service sslh start
Now you should be able to ssh to your server on port 443 (ssh -p 443 your.server.example.org
) while
still being able to surf to
https://your.server.example.org/
.
sslh works as threaded or as preforking daemon, or via inetd. It also
honors tcpwrapper configurations for sshd in /etc/hosts.allow
and /etc/hosts.deny
.
sslh is available as port or package at least in Gentoo, in FreeBSD, in Debian and in Ubuntu.
AjaxTerm
A completely different approach takes AjaxTerm. It provides a terminal inside a web browser with login and ssh being its server-side backend.
Properly safe-guarded by HTTPS plus maybe HTTP based authentication this can be an interesting emergency alternative to the more common — but also more often blocked — remote login mechanisms.
AjaxTerm is available as package at least in Debian and in Ubuntu.
Happily I never were forced to use either of them myself. :-)
Tagged as: AJAX, AjaxTerm, Apache, Debian, HTTPS, libwrap, OpenVPN, SSH, SSL, sslh, tcpd, tcpwrapper, Ubuntu, XMPP
// show without comments // write a comment
Related stories
Tuesday·10·January·2012
Illegal attempt to re-initialise SSL for server (theoretically shouldn’t happen!) //at 02:52 //by abe
After dist-upgrading my main Hetzner server from Lenny to Squeeze, Apache failed to come up, barfing the following error message in the alphabetically last defined and enabled virtual host’s error log:
[error] Illegal attempt to re-initialise SSL for server (theoretically shouldn't happen!)
Well this is not theory but the real world and it did happen — and it took me a while to find out what was wrong with the configuration despite it worked with Lenny’s Apache version.
To avoid that others have to search as long as I had to, here’s the solution:
Look at all enabled sites, pick out those which have a VirtualHost on port 443 defined and verify that all these VirtualHost containers do have their own “SSLEngine On” statement. If at least one is missing, you’ll run into the above mentioned error message.
And it won’t necessarily show up in the error log of those VirtualHosts which are missing the statement but only in the last VirtualHost (or the last VirtualHost on port 443).
To find the relevant site files, I used the following one-liner:
grep -lE 'VirtualHost.*443' sites-enabled/*[^~] | \ xargs grep -ci "SSLEngine On" | \ grep :0
Should work for all sites which have defined just one VirtualHost on port 443 per file.
I suspect that the raise of SNI made Apache’s SSL implementation more picky with regards to VirtualHosts.
Oh, and kudos to this comment to an article on Debian-Administration.org because
it finally pointed me in the right direction. :-)
Tagged as: Apache, CLI, commandline, Debian, error, experience, grep, HTTPS, KMMR, Lenny, Squeeze, SSL, xargs
// show without comments // write a comment
Related stories
Thursday·22·September·2011
Emacs Macros: Repeat on Steroids //at 16:06 //by abe
vi users have their .
(dot) redo command for repeating
the last command. The article Repeating Commands in Emacs in Mickey Petersen’s blog Mastering Emacs explained
Emacs’ equivalent for that, namely the command repeat
, by
default bound to C-x z
.
I though seldomly use it as I mostly have to repeat a chain of commands. What I use are so called Keyboard Macros.
For example for the CVE-2011-3192 vulnerability in Apache I added a line like
Include /etc/apache2/sites-common/CVE-2011-3192.conf
to
all VirtualHosts.
So I started Emacs with all the relevant files: grep
CVE-2011-3192 -l /etc/apache2/sites-available/*[^~] | xargs emacs
&
To remove those “Include” lines again M-x flush-lines
is
probably the easiest way in Emacs. So for every file I had to call
flush-lines with always the same parameter, save the buffer and then
close the file or — in Emacsish — “kill” the buffer.
So while working on the first file I recorded my doing as a keyboard macro:
C-x (
- Start recording
M-x flush-lines<Enter>CVE-2011-3192<Enter>
- flush all lines which contain the string “CVE-2011-3192”
C-x C-s
- save the current buffer
C-x C-k<Enter>
- kill the current buffer, i.e. close the file
C-x )
- Stop recording
Then I just had to call the saved macro with C-x e
. It
flushed all lines, saved the changes and switched to the next
remaining file by closing the current file with three key-strokes. And
to make it even easier, from the second occasion on I only had to
press e
to call the macro directly again. So I just
pressed e
for a bunch of time and had all files edited.
(In this case I used git diff
afterwards to check that I
didn’t wreck anything by half-automating my editing. :-)
Of course there are other ways to do this, too, e.g. use
sed
or so, but I still think it’s a neat example for
showing the power of keyboard macros in Emacs. More things you can do
with Emacs Keyboard Macros are described in the EmacsWiki entry Keyboard Macros.
And if you still miss vi’s .
command in Emacs, you can
use the dot-mode, an Emacs mode currently maintained by Robert Wyrick
which more or less automatically defines keyboard macros and lets you
call them with C-.
.
Tagged as: Apache, CLI, CVE, CVE-2011-3192, dot-mode, Emacs, EmacsWiki, git, macro, Other Blogs, redo, repeat, vi, xargs
// show without comments // write a comment
Related stories
Wednesday·25·April·2007
Das Web 2.0 Stöckchen //at 01:57 //by abe
Kaum bloggt man mal wieder, kommt einem auch gleich wieder ein Stöckchen entgegen geflogen, dazu auch noch zu einem solch brisanten Thema wie Web 2.0.
Also fangen wir an: Ich nutze Apache 2.0, Blosxom 2.0, Emberl 2.0, WML 2.0, CSS 2.0, Firefox 2.0, HTML 2.0, Debian 2.0, äh, moment, nee, so altbacken bin ich nun auch wieder nicht. Ach, das war gar nicht die Frage? Achso. Na dann wollen wir mal die eigentlichen Fragen beantworten…
- Nutzt Du Social Bookmarking/Networking Seiten wie Digg, Yigg, Mister Wong oder Del.Icio.Us? Wenn ja, welche?
- Kaum. Einen Yigg-Account habe ich, wenn auch schon lange nicht mehr benutzt, Digg ist mir aufgrund ihres Abmahnwahns unsympathisch, Mister Wong sagt mir sowas von gar nix und Del.Icio.Us finde ich durchaus interessant, denke aber nicht, daß es mir wirklich etwas bringt, da ich meine Bookmarks — sofern Zeit ist *hüstel* — selbst von Hand zu Fuß als HTML tippe und damit genauso browserunabhängig bin. Flock nutze ich dementsprechend auch nicht.
- Nebenbei: Digg und Yigg sind für mich keine Bookmarking-Seiten sondern Newsportale. Und unter einer Social Networking-Seite verstehe ich Orkut (Ja, habe ich einen Account, aber vernachlässigt), OpenBC (das neuerdings heißt wie ein Filmchenabspieler für Windows, nein habe ich keinen Account und will auch keinen. Ich mache kein “Business”.) oder LinkedIn (wirkt auf mich noch viel mehr auf Business abgestimmt als OpenBC). Und gute Jobs habe ich bisher auch immer ohne solche Seiten bekommen. Das einzig nette daran, ist festzustellen, wie klein die Welt doch ist.
- Schaust Du Dir Videos bei Videoportalen wie YouTube, Sevenload oder DailyMotion an? Wenn ja, was für Videos guckst Du Dir meistens an?
- Manchmal. Meist dann, wenn sie sowieso grade im Büro umgehen und alle Kollegen gemeinsam vor einem Monitor rumlachen. Sprich, meist sind’s irgendwelche witzigen Sachen. Manchmal auch Filmtrailer. Wobei ich eigentlich außer Google Videos und YouTube kein anderes solches Portal wirklich kenne. Zumindest sagen mir die anderen genannten sowas von gar nix.
- Kennst bzw. nutzt Du Flickr?
- Kennen kommt man wohl kaum drumherum. Nutzen? Ja, manchmal, zum Bilder anschauen, die mir irgendjemand zeigen will oder über die ich sonstwo gestolpert bin. Account habe ich jedenfalls keinen. Ich war mit allen Webgalerie-Lösungen bisher unzufrieden und hab mir meine eigene geschnitzt. Web 2.0 brauche ich an der Stelle bisher nicht. Aber wer weiß, vielleicht bekommt das Ding auch mal RSS-Feed-Support.
- Was hälst Du von Diensten wie Twitter oder Frazr?
- Ich kenne sie nicht einmal. *draufklick* Nix.
- Wie viele RSS-Feeds hast Du abonniert?
- Ich meine mich zu erinnern, dass neuere Versionen von Lilina nur bis ca. 50 Feeds skalieren. Ich hab ein paar mehr, vermutlich so ca. 60-70 Blogs und ähnliches. Dazu noch unzählige Newsfeeds (wohl so um die 40-50, Tendenz steigend, vor allem Symlink wegen), die ich aber von den Blogfeeds getrennt halte und auch nicht mit einem Feedreader sondern so einer Art Cheesy Portal lese. Wobei es so aussieht, als ob sich bei Lilina wieder was tut, jedenfalls hat die Seite ein neues Design und eine neue URL. Müßte ich mir mal wieder mal ansehen.
- Liest Du die alle täglich?
- Nicht mal mehr monatlich oder sonstwie regelmäßig. Seit das letzte Upgrade meines Lilinas eine katastrophale Performance an den Tag legte eigentlich gar nicht mehr. Und zum Flicken hatte ich bisher keine Lust. Genausowenig wie ich bisher Muße dazu hatte, mein “Cheesy Portal” wieder in Sachen Feeds auf den aktuellen Stand zu bringen. Deswegen auch keine Links. Liegt wohl daran, daß mir die Arbeit seit dem Stellenwechsel vor einem Jahr wieder richtig Spaß macht und deswegen keine Zeit mehr für solche weniger wichtigen Dinge ist. ;-)
- In wie vielen Weblogs bloggst Du? (Eigene oder Mitautor)
- Da ich Symlink nach wie vor nicht als Blog ansehe (und auch nicht unbedingt den ISG Newsticker oder den LUG-Camp 2007 Newsticker) nur in zweien: In diesem meinem eigenen Blog wenn mir gerade danach ist (also nicht mit dem Zwang täglich was zu posten, wie manch andere Leute) als auch in der inoffiziellen Blosxom User Group, dort im Normalfall dann, wenn’s was neues (aber nicht notwendigerweise wichtiges) in der Blosxom Community gibt.
- Kommentierst Du in anderen Blogs? Wenn ja was?
- Hin und wieder mal. Meist bei Freunden, manchmal auch bei Leuten, die ich nicht kenne. Was es dann ist, ist recht unterschiedlichen. Von hilfreichen Informationen bis hin zu blöden Kommentaren ist sicher schon alles dabei gewesen. ;-)
- Wer ist Dein persönlicher Blog-König von
Deutschlandder Schweiz? - Was ist ein “persönlicher Blog-König”? Jemand, der Blogs schreibt so wie das Klischee sie erwartet, eben täglich, mit viel persönlichem oder unwichtigem Zeugs? Hmm, in der Schweiz die RUBIs sind recht fleissig und viel persönliches ist da auch dabei, dazu ist’s noch witzig, weil praktisch die ganze Familie bloggt. Und informativ ist es ab und an außerdem noch. In Deutschland kenne ich zu wenige Blogs, aber da fand ich immer das Daily Ivy Blog ganz gut, auch wenn es als Blog keinerlei wirklichen Ersatz für Ivys Bar sein kann. *seufz*
- Gehört Weblogs Deiner Meinung nach die Zukunft oder sind sie nur ein vorübergehender Hype?
- Weder noch. Sie sind eine Nuance eines Mediums mehr, die das letzte Jahrzehnt hervorgebracht hat. Mit eigenem Charakter und nicht eigentlich kaum mehr wegzudenken, aber sicher auch nicht die Krone der Web-2.0-Schöpfung.
- Wird es Dein Blog / Deine Blogs dann auch noch geben?
- Es ist glaube ich gemeinhin bekannt, daß ich selten was wegschmeiße oder gar Webseiten lösche, nur weil ich sie grade nicht brauche, nutze oder pflege.
Und bevor’s zu Ende ist, füge ich hier grade noch zwei Fragen ein, weil ich doch das eine oder andere zum Thema Web 2.0 in diesem Stöckchen vermisse.
- Welchen Feedreader nutzt Du?
- Webbasiert: den bereits erwähnten Lilina für Blogs und einen auf einer PHP-Feedreader-Bibliothek basierender Eigenbau, der nach dem Vorbild von Slashdots Cheesy Portal gebaut ist — nur mehrspaltig, für News. Sonst Opera, allerdings nur mit wenigen Feeds. Ich habe zwar auch schon raggle und snownews ausprobiert und so schlecht sind die beiden sicher auch nicht (snownews ist einen Tick intuitiver zu bedienen), aber wirklich begonnen sie zu nutzen habe ich nicht. Gregarius fürs Web und Newsbeuter für die Textkonsole wollte ich mal noch ausprobieren.
- Was gehört für Dich sonst noch zum Web 2.0?
- Google Maps, maps.search.ch und Konsorten inklusive API. Könnte man auch unter dem Überbegriff AJAX laufen lassen. Dann natürlich Wikis. Und nicht zu vergessen Microformats wie z.B. XFN. Wundert mich eigentlich, das das vorher kaum vorkam in dem Stöckchen.
- Wo gehts weiter mit dem Web 2.0 Stöckchen?
- Also sicher mal bei Venty sei’s in seinem leider schon wieder aufgegebenen Gopher-Blog oder in seinem PodCast, dem ich nicht wirklich folge, weil ich keine PodCasts höre.
- Dann vielleicht noch bei Dieter Schlabonski, weil der es sicher schafft, auch daraus einen stilechten Rant zu machen.
- Und Myon bastelt ja bei Debian gerne mit Web-2.0-Methoden rum, dem werfen wir das grade auch mal zu.
- Sonst fallen mir nur noch Leute ein, die kein Blog haben und daher auch kaum Stöckchen fangen können oder das Stöckchen schon bekommen haben. :-)
Now playing: El-Vez — Mexican Radio
Tagged as: 0x1b, AJAX, Apache, Blogging, Blosxom, Comic, Debian, del.icio.us, Embperl, Flickr, Google, Google Maps, Gopher, HTML, Ivy, Lilina, maol, map.search.ch, Meme, Microformats, Myon, newsbeuter, OpenBC, Opera, Orkut, Other Blogs, Quiz, raggle, Schlabonski, Slashdot, snownews, Social Networking, Stöckchen, Symlink, Ventilator, Web, Web 2.0, WML, XFN, Yigg, YouTube
// show without comments // write a comment
Related stories
Monday·18·September·2006
Fixing server bugs on client side //at 15:35 //by abe
On my new job at ETH Zurich I stumbled over a lot of HTTP requests in
the web server log file, obviously trying to fetch the automatic proxy
configuration file (usually called proxy.pac
) but requesting it with the last
character missing and therefore requesting the nonexistent file proxy.pa
:
195.176.XX.AB - - [16/May/2006:11:12:56 +0200] "GET /proxy.pa HTTP/1.1" 404 5261 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Win32)" 195.176.YY.CD - - [16/May/2006:11:16:32 +0200] "GET /proxy.pa HTTP/1.0" 404 5235 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Win32)" 195.176.ZZ.EF - - [16/May/2006:11:18:38 +0200] "GET /proxy.pa HTTP/1.0" 404 5235 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Win32)" 195.176.YY.CD - - [16/May/2006:11:24:16 +0200] "GET /proxy.pa HTTP/1.0" 404 5235 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Win32)" 195.176.ZZ.GHI - - [16/May/2006:11:31:44 +0200] "GET /proxy.pa HTTP/1.0" 404 5235 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Win32)" 195.176.XX.J - - [16/May/2006:11:33:35 +0200] "GET /proxy.pa HTTP/1.1" 404 5261 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Win32)" 195.176.ZZ.LMN - - [16/May/2006:11:35:18 +0200] "GET /proxy.pa HTTP/1.1" 404 5261 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Win32)"
WTF happend here? When I found a bunch of those request from a single host last night, I expected a local cut and waste typo on a single box. But during the day I got the same sort of defective requests from over 30 hosts in our network. So we looked at our dhcpd.conf, but all appearances of “proxy.pac” had its “c” at the right place.
WTF is happening here? After googling for a moment I found this mail on the squid users mailing list, stating the following:
WPAD worked reasonably well for WindowsNT and Windows2000; however, there was a problem with the file name in Windows2000 and the initial release of WindowsXP. The Microsoft DHCP Service returned the wrong byte count for the string returned for option 252. The DHCP Client compensated for this by decrementing the string length. This resulted in the file name being truncated when the ISC DHCP daemon was used. The solution was to define a symlink proxy.pa –> proxy.pac.
So in other words: Microsoft worked around a off-by-one bug in their own DHCP server by patching their DHCP client to parse faulty configurations — and obviously only faulty configurations by expecting some length statement to be always off-by-one. *hrrrrng*
Our solution was BTW to insert an appropriate Alias directive into our
Apache web server hosting the file.
Tagged as: Admin, Apache, Bugs, DHCP, ETH Zürich, HTTP, ISC, Microsoft, MSIE, Proxy, proxy.pac, Rant, WTF
// show without comments // write a comment
Related stories
Friday·07·April·2006
Last day at work //at 19:00 //by abe
As some of my friends already know, I’ve quit my current job and will start working at the Department of Physics of the ETH Zurich in May.
Today is my last day at work here and I feel a little bit sentimental. Most co-workers became friends during the last four and a half years and I’ll move away from a bunch of friends at Darmstadt and from some friends in Mainz and Frankfurt/M. And I’ll leave the Rhine-Main area just shortly before LinuxTag moves in. Fsck.
But it had to be. Although I like creating dynamic web pages with Embperl and Apache, I became sick of working with SuSE Linux, sick of developing with OpenLDAP, sick of developing web applications which must (also) run with Apache under Windows or with MS Access. Since I understand that for the success of my current employer the use of these products can’t be changed that easily, the only solution for me was to quit the job.
My new job at the ETH Zurich will be administrating mostly Unix systems at the Department of Physics as well as some Unix user training. I won’t get rid of Windows and OpenLDAP there though, but I won’t have to develop software with them. What I’ll get rid of is SuSE: I will have my beloved Debian around me (which I can use here only for building Debian packages for customers) and some FreeBSD (no change here ;-), too. So I really look forward to my new job.
Therefore I’ll move to Zurich soon. And since I have down there a lot of friends, too — not only through Symlink and the Linux User Group Switzerland but also people from the 2CV scene — it’s not so hard to the leave the current environment and jump into a new one. Another advantage of moving more southwards is that I’ll be closer again to the rest of the Beckert family, at least the part I’m related to. (The biggest number of Beckerts seem to live near Chemnitz according to Geogen, so perhaps I should pay attention to this when visiting the Chemnitzer Linux-Tage the next time.)
But I’ll come back and visit the Rhine-Main area probably quite often, not only for LinuxTag.
P.S.: It maybe that further blog postings about my move to Zurich only
appear in the German written
part of my blog and therefore not on Planet Debian (but Planet
Symlink).
Tagged as: 2CV, Apache, Auswandern, CLT, Darmstadt, Debian, Embperl, ETH Zürich, Frankfurt, Fsck, Good Bye, LinuxTag, LUGS, Mainz, MS Access, OpenLDAP, Planet Debian, Planet Symlink, Schweiz, SuSE, Symlink, Umzug, Windows, Work, Zürich
// show without comments // write a comment
Related stories
Friday·10·March·2006
Tagging with Technorati style in pure Blosxom //at 03:22 //by abe
Short summary: I can’t stay away from coding Blosxom plugins. Perl rules. PHP sucks. ;-)
- New version 0.04 of the tagging plugin, supporting Technorati style tag links to many resources.
- New add-on plugin pathbasedtagging to the plugin tagging, implementing Technorati style tag links in pure Blosxom without any help from Apache’s mod_rewrite.
- New plugin dept offering Slashdot like “dept.” lines for Blosxom postings.
Supporting Technorati style tag URLs
After releasing the last version of my Blosxom plugin tagging, I
noticed that Technorati only seems to like URLs ending in
“/tagname
” but not ending in “=tagname
” (as
they do if you use classic query strings instead of the path info),
even if the a
tag has a rel="tag"
attribute. And not only I noticed this but also some other users of
the plugin. (Although I do wonder how Furl made it to a Technorati
partner with URLs like http://www.furl.net/furled.jsp?topic=tags…)
So I somehow had to change the syntax style for my tags. This wasn’t very hard for the links, but I wanted them to still link to my blog and not to Technorati, Flickr, Wikipedia or any other external resource.
Implementing Technorati style tag URLs
The obviously easiest solution for someone who’s using and administrating Apache web servers for nearly ten years now was to use some mod_voodoo—eh—mod_rewrite:
RewriteEngine On RewriteRule ^/cgi-bin/blosxom.cgi/tags/(.*)$ /cgi-bin/blosxom.cgi?-tags=$1 [PT]
That way I could use Technorati style tags and had a well performing solution. But somehow this solution wasn’t that satisfying since it wasn’t pure Blosxom and therefore had some dependency including access to some Apache config file. (Even if the config file was called .htaccess. ;-)
A pure Blosxom solution
A few days ago I somehow noticed that in general a special behaviour
on some URLs could also be implemented using Blosxom’s API. Using the
entries
function to modify the Blosxom internal path
itself before Blosxom or e.g. the entries_index runs but not returning
any hashes, allows to have some path like URLs not being treated as a
path by Blosxom.
Unfortunately this couldn’t be incorporated into the tagging plugin
itself, since plugins doing such path interpreting voodoo needs to be
ran before any plugin supplying an entries
function
runs. But the tagging plugin must run after such a plugin. So I
created the small add-on plugin
pathbasedtagging which is solely thought for use together with the
tagging plugin (but may have other, yet unknown purposes).
And since I got asked if they could use the tagging plugin to link to external tag URLs instead of the own blog, I included a ready to use list of more or less popular external tag URLs including Technorati, Flickr, del.icio.us, de.lirio.us and Wikipedia.
from the slashdot dept.
Since I’ve always liked the often sarcastic or even evil comments inside Slashdot’s subtitle alike dept. lines and since I’m also used to use them at Symlink, I wanted them in my blog, too. Time for a new plugin.
The basic work of parsing out the data from the text files the posts reside in was already written for the tagging plugin. So I just had to use that code, simplify it and add some little more code to get the dept plugin whose results you can see in my blog directly beneath the title of a posting since a few days now.
Update 02:52h
Hey, see my Technorati
profile: It worked! Technorati recognised the tags! Yeah!
Tagged as: Apache, Blogging, Blosxom, Blosxom Plugin, Dept, GPL, Hacks, HTML, mod_voodoo, Open Source, pathbasedtagging, Perl, Slashdot, Symlink, Tagging, Technorati, Wikipedia
// show without comments // write a comment