#!/bin/blog

February 2, 2010

Dealing with lengthy SSL certificate chains

Filed under: Security — Tags: , , , , — martin @ 4:16 pm

Comodo delivers the cheapest widely-recognized certificates (available e.g. via psw.net), second only to the famed StartSSL Free CA, which I haven’t had the guts to try out so far. What I got from Comodo, is my server cert, along with no less than three intermediate certificates:

AddTrustExternalCARoot.crt
issuer= /C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
subject= /C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root

UTNAddTrustServerCA.crt
issuer= /C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
subject= /C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware

PositiveSSLCA.crt
issuer= /C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
subject= /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA

Server.crt
issuer= /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA

You can obtain this information by running, e.g.:

for c in $(ls *crt); do echo -e "\n$c"; openssl x509 -issuer -subject -noout -in $c; done

Note how I have ordered them from the root certificate on top to the server certificate on the bottom, each being the issuer of the succeeding one. Did I say root certificate? Good news then: AddTrust is the root certificate, hence it does not need to be deployed, which leaves me with a chain of two.

I will need to deploy the certificates into Postfix and Dovecot, which use an all-in-one file that contains the complete chain, including the server certificate. Other servers, such as the Apache webserver, use a server certificate file and a separate file containing the intermediate certificates. Which is the method I prefer. But you just can’t always get what you want. ;-)

I learned the hard way that certificate order does matter. RFC 5246 states:

The sender’s certificate must come first in the list. Each following
certificate must directly certify the one preceding it. Because
certificate validation requires that root keys be distributed
independently, the self-signed certificate that specifies the root
certificate authority may optionally be omitted from the chain,
under the assumption that the remote end must already possess it
in order to validate it in any case.

Thus, the all-in-one file needs to start with the server certificate, followed by the certificate that issued the server certificate, all the way down to the one that is farthest away from the server certificate: 1) Server, 2) PositiveSSLCA, 3) UTNAddTrustServerCA

For servers that use a separate intermediate file, the order is the same, with the difference that the server certificate resides in its own file.

I recommend to maintain the subject and issuer information of all components of the all-in-one file so it won’t have to be dissected at a later point in order to understand what it contains. My starting point is the server cert, to which I will append the intermediate certs:

1) Locate the issuing certificate of the server cert (-> output above) and append the respective certificate to the server cert.
2) Locate the issuing certificate of the previously appended certificate and append it to the server cert.
3) Repeat until the root CA certificate has been reached.

In my case:
openssl x509 -in server.crt -subject -issuer > server-allinone.crt
openssl x509 -in PositiveSSLCA.crt -subject -issuer >> server-allinone.crt
openssl x509 -in UTNAddTrustServerCA.crt -subject -issuer >> server-allinone.crt

Now I have a handy file ready for deployment:

subject= /OU=Domain Control Validated/OU=PositiveSSL/CN=server
issuer= /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
subject= /C=GB/ST=Greater Manchester/L=Salford/O=Comodo CA Limited/CN=PositiveSSL CA
issuer= /C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----
subject= /C=US/ST=UT/L=Salt Lake City/O=The USERTRUST Network/OU=http://www.usertrust.com/CN=UTN-USERFirst-Hardware
issuer= /C=SE/O=AddTrust AB/OU=AddTrust External TTP Network/CN=AddTrust External CA Root
-----BEGIN CERTIFICATE-----
...
-----END CERTIFICATE-----

The main point is that you must understand how the certificates relate to each other. The issuer and subject fields are the key all the way through the procedure.

January 28, 2010

“Why is SVN so slow?”

Filed under: UNIX & Linux — Tags: , , — martin @ 11:25 am

I recently migrated a client from CVS to Subversion for his doc repository. I considered mailing this out after hearing a few complaints about speed (the repo is >1GB in size), but then decided to not send it.

All,

If you suffer from slow updates on Windoze, the following TortoiseSVN FAQ articles may offer a few insights:

http://tortoisesvn.net/node/41 “Why is SVN so much slower than CVS”
http://tortoisesvn.net/node/14 “Why is SVN slow on huge directories”

The key argument is that SVN due to its support for atomic transactions needs to do many more file operations than CVS in order to ensure integrity. This makes it slower than CVS, especially if there is an on-access virus scanner involved.

I’m keeping this on file here, just in case. ;-)

P.S.: “Why not git?” – Because GIT has a 3-step commit process (add, commit, push) that is not justifiable for this application. The cool people (like me) use git-svn anyway.

January 8, 2010

Harmonisierte Umlaute auf US-Tastatur

Filed under: Misc — Tags: , , , , — martin @ 11:22 am

Im Jahr 2010 will ich für mich persönlich so eine Art Coding-Offensive starten. Back to the roots, gewissermaßen. Weil ich unter anderem ein Macbook habe, auf dessen absurder deutscher Tastenbelegung das Codieren so ungefähr der größte Krampf aller Zeiten ist, wollte ich dafür wieder auf US-Tastaturbelegung umsteigen. Und das auf allen von mir benutzten Betriebssystemen: Linux, MacOS, Windows. Da ich nicht auf einer Insel lebe, auf der ich auf Umlaute verzichten könnte, ist es dabei natürlich von Vorteil, wenn die Umlaute auf den jeweiligen Systemen nicht nur irgendwie erreichbar sind, sondern einheitlich erreichbar sind.

Linux

Der Startpunkt bei so etwas muß Linux sein, denn das Umdefinieren von Tasten kann unter Linux mit xkb etwas sperrig werden. Gnome bietet netterweise direkt auf Anhieb eine Tastaturbelegung an namens: USA International (AltGr-Akzenttasten)

Damit bekommt man in etwa die hier auf Wikipedia gezeigte Tastaturbelegung mit den etwas kryptischen Zuordnungen (Groß-/Kleinschreibung bitte situativ dazudenken):

  • AltGr+P = Ö
  • AltGr+Q = Ä
  • AltGr+Y = Ü
  • AltGr+S = ß
  • AltGr+5 = €

Kryptisch, ja, aber nichts, womit ich nicht leben könnte.

Windows

Windows bietet ebenfalls eine Tastaturbelegung Englisch (USA, International) an, bei der die o.g. Tastenkombinationen ebenfalls gelten. Leider macht Windows dabei die Taste mit Apostroph und Gänsefüßchen zu einem Dead Key.

Da mich der tote Apostroph wirklich kolossal stört und es mir ausschließlich auf die Umlaute ankommt, habe ich die Tastatur auf Windows auf einfaches “Englisch (USA)” umgestellt und mir mittels des phänomenalen und von mir grob unterforderten AutoHotKey die gewünschten Tastenkombinationen generiert. Dazu habe ich in ein AHK-Script die folgenden Einträge aufgenommen:

!q::Send ä
+!Q::Send Ä
!p::Send ö
+!P::Send Ö
!y::Send ü
+!Y::Send Ü
!s::Send ß
!5::Send €

Achtung: Unter Windows ist AltGr so nicht verfügbar, darum zieht die Kombination hier mit beiden Alt-Tasten. Für mich ist das voraussichtlich kein Problem. Wer damit absolut nicht klarkommt, kann mit AutoHotKey z.B. die rechte Alt-Taste zu AltGr umdefinieren, oder die o.g. Kombinationen nur für die rechte Alt-Taste gelten lassen. Dann müssen alle o.g. Zeilen natürlich gemäß AutoHotKey-Doku auf die neue Taste abgeändert werden.

Und noch einmal Achtung: Diese Windows-Variante funktioniert nicht im Xming X11-Displayserver. Wer in dieser Beziehung größere Pläne hat, muß notgedrungen bei den Umlauten auf Copy&Paste ausweichen, oder eine andere Lösung finden.

MacOS

Unter MacOS ist die normale US-Belegung bereits um das ß auf Alt+S erweitert, sowie um “komponierte” Umlaute, bei denen man zuerst Alt+U für die Pünktchen drückt (also ¨ – echte Fans sprechen da insbesondere unter Linux auch von der Dead Diaeresis) und dann den entsprechenden Vokal hinterher, um den Umlaut zu bauen. So habe ich das von 2006 bis 2008 auch tatsächlich mal eine Weile benutzt, zusammen mit einer notdürftig hingefrickelten xkb-Anpassung für Linux.

Des weiteren kann man hier eine Hackervariante US International herunterladen, die im Internet über eine recht große Fangemeinde zu verfügen scheint, aber deren Sinn sich mir nicht so recht erschließen wollte.

Letzen Endes habe ich meine Sonderzeichen als Trigger in Quicksilver untergebracht. Die Definition des ß konnte dabei entfallen, da es sowieso schon auf Alt+S liegt.

(Die jeweiligen Zeichen können in der Quicksilver-Konfiguration so eingegeben werden: Erstes Feld: Punkt und Zeichen, das eingesetzt werden soll, dann zweites Feld: “Einsetzen”. Ist etwas repetitiv, aber in 5 Minuten durchgeklickt und runtergetippt.)

Auch auf dem Mac gilt die Einschränkung, daß keine AltGr-Taste vorhanden ist. Hier ist mir derzeit auch leider kein Workaround bekannt, eine ins Leben zu rufen. Insbesondere ist es nicht möglich, in Quicksilver nur Kombinationen mit nur einer von zwei Tasten zu konfigurieren. Mit KeyRemap4MacBook kann man aber zumindest die rechte Apfeltaste oder die Numpad-Entertaste zu einer zusätzlichen Alt-Taste umkonfigurieren.

Wie bei meiner Lösung mit AutoHotKey unter Windows gilt auch hier, daß die Umlaute nicht unter X11 funktionieren. Schade, aber wahrscheinlich zu verschmerzen.

Die Tastaturen meiner Laptops habe ich übrigens mit Stickern von 4keyboard.com auf US-Englisch umgelabelt. Hier ein Foto des Linuxsystems:

Für getestete Verbesserungen bin ich natürlich offen. Immer her damit!

January 4, 2010

iPhone IMAP push

Filed under: Internet, Warez — Tags: , , , , — martin @ 10:01 am

Jan-Piet writes about GhettoPush, so I don’t have to. :-)

GhettoPush is a UNIX daemon (written in Perl) that will monitor any IMAP server for new message events and generate a push message. Most of the time, I hear the push message come in on the iPhone before I notice the new message on my workstation. Please give it a try and let me know how you like it.

January 2, 2010

C3 for absolute beginners

Filed under: Egoblogging — Tags: , , , — martin @ 8:49 pm

After months-long constant prodding by my dear friend and colleague G., I attended 2009’s 26th Chaos Communication Congress (26C3) last week. A first-time C3 visit for me.

Because of family reasons, I was only able to arrive on the second day around noon. This caused unexpected problems regarding the acquisition of a ticket for me, but thanks to the tireless effort of another valued colleague (B.), I got my ticket on day 2 and everything was fine.

Day 2

Day 2 (which was the first for G. and me) was dominated by our attempts to find our way around BCC, the Berlin Conference Center. Pressured by B., the first talk we attended was “A part time scientists’ perspective of getting to the moon“. I was the first one from our little group to walk out of this after about 15 minutes, due to the bad english and the constant presentation issues.

After lunch (around 15:00), we went to see the big Fefe show event “Vier Fäuste für ein Halleluja“, which was fairly funny. It must have been that afternoon that I registered my GSM phone on the congress network, which worked without any problems whatsoever. Somewhat later, we discovered the “Lounge” in the basement next to the Hackcenter, where we spent all of the early evening. Lots of cool music. G. had a few smokes and I achieved a new high score at FlightControl on the iPhone. ;-)

Exciting Tales of Journalists Getting Spied on, Arrested and Deported” at 23:00 was entertaining, but my impression was that it didn’t quite live up to the expectations of the audience. After the second round of “Hacker Jeopardy“, we left the venue and went back to the Hotel. After some hanging around in the lobby, everyone was in bed at three in the morning.

Day 3

Got up early after far too few hours of sleep, but due to fuzzy coordination with the others and spending too much time for breakfast, missed the 11:30 CCC retrospective for 2009. Went to see “Vom Kreationismus zum Kollektivismus“, a great talk about creationism, which was unfortunately timed rather badly. As far as I’m concerned, time was up before the speaker was able to reach a palpable conclusion.

Next in the same room was “Kunstfreiheit statt Hackerparagraph“. A great subject, entirely wasted. About one-third of the audience left the room during the talk, which was quite embarassing.

After lunch, we attended the “Lost Cosmonauts” talk, which was somewhat puzzling. Being about “Critical Thinking”, I started to expect the speaker to sell us his version of the truth, to later reveal how he had fooled us. Unfortunately, this was not the case and the conclusion was that one point of the “lost cosmonauts” story was mostly caused by a faulty translation. Honestly: Where’s the beef, sir?

The next talk, ““Yes We Can’t!” – on kleptography and cryptovirology“, is a highly interesting topic. In plain english, it was about how computer criminals utilize cryptographic techniques. Unfortunately, it was presented in a very boring, academic way, with crypto-theoretic formula talk that didn’t do the subject any justice at all. Also, the slides were in desperate need of an overhaul as they contained an excessive amount of references to floppy-disk vintage computing. Give this subject to the “Tales of Journalists” guy from Day 2 and everyone in the room will have a great time. I left about 20 minutes before the end of the talk.

After dinner, we absolutely had to get into Room 1 for the big Fefe and Kaminsky shows that were to follow later that evening. We were late for Bre Pettis’ talk about “Peanut Butter and Plastic: Industrial Revolution“, but happened to be in a small group that the brilliant Nick Farr allowed into the room to stand on the side until the end of Bre’s Talk.

We stood through the “Fnord Retrospective 2009” as well, and were able to grab two great seats for Dan Kaminsky’s “Black ops of PKI” talk. Dan’s talk was stellar, as it detailed a number of serious flaws in the practical application of SSL that I had already encountered in my work for a client. This was downright marvellous, as I had never heard someone speak out these issues outside my work environment. I really had a hard time believing that this was actually happening and sat through a few passages of the talk with a dropped jaw.

We skipped the game show event that day and everyone went to bed early.

Day 4

Day 4 was departure day. We only attended one talk before we left, and that that was “Wikipedia – Wegen Irrelevanz gelöscht” about the German Wikipedia’s deletion policy, which was somewhat nightmarish. I was surprised to see Usenet-style flame warfare adopted in a real life setting. Quite a few facepalms there, with more than one person from the auditorium asking unrelated feisty questions.

Conclusion

As you’ve seen, there have been a number of talks I was dissatisfied with. However, this has been more than made up by Dan Kaminsky, who confirmed my SSL troubles and gave me an impression of how deeply SSL and X.509 are really flawed.

The wireless LAN was working okay for me most of the time. I had registered a spare mobile phone with the local GSM network, which worked surprisingly well, including DECT interoperation, call-out, call-in and SMS. Other than the few hundred people in the Hackcenter, I opted not to use the 26C3 as a cheap opportunity for re-stocking my pr0n collection. I regret that we missed to pay a visit to C-Base. Also, it’s a shame that I failed to meet a few of my Twitter followers despite them being in the same building as me.

(On the other hand, I had an interesting encounter at the chinese fast food place over at the train station. I asked Melle about this t-shirt, but he wasn’t able to explain it quickly to me. Seconds later, an unknown lady from the other side of the table discretely handed me her iPhone with this XKCD cartoon loaded. Nice. Yes, the chinese restaurant was that crowded with CCC people.)

See you next December at 27C3, folks. :-)

November 12, 2009

IMAP on the iPhone with SSL client certificates

Filed under: iphone — Tags: , , , — martin @ 11:02 pm

The IMAP server in my office is configured to not simply accept username/password authenticated connections from the internet. As an additional security measure, it requires the client to present a valid SSL client certificate, issued by the internal CA, resulting in mutual SSL authentication.

The Mail client on the iPhone, on the other hand, does not support SSL client certificates. While it is possible to deploy a client certificate using the iPhone configuration utility, this cert will only be presented to web servers, but not to mail servers.

My workaround is to use stunnel, the universal SSL wrapper, on the iPhone. This, of course, requires the iPhone to be jailbroken. I’ll leave the jailbreak and installation of stunnel as an excercise to you. :-)

I’m running stunnel as the “mobile” user, thus all the required files reside in /var/mobile. The files are:

- The stunnel configuration: /var/mobile/stunnel.conf
- The SSL certificate: /var/mobile/cert.pem
- The key matching the SSL certificate: /var/mobile/key.pem

Stunnel is configured as an SSL client. The commented-out lines may be useful for troubleshooting. I have added 10000 to the regular IMAP and SMTP ports so they are beyond the privileged port range that may only be used by root.

cert=/var/mobile/cert.pem
key=/var/mobile/key.pem
pid = /var/mobile/stunnel.pid
sslVersion = TLSv1
# Resolve server hostname at every reconnect,
# not only on startup (for dyndns!):
delay = yes
#foreground = yes
#debug = 7

[imap]
accept=127.0.0.1:10143
connect=example.dyndns.org:993
client=yes

[smtp]
accept=127.0.0.1:10025
connect=example.dyndns.org:465
client=yes

My key is password protected, thus I start stunnel from Mobile Terminal after bootup:

stunnel stunnel.conf

Having a method for starting stunnel automatically with passphrase-less keys would be nice, but has no priority for me. Using a LaunchDaemons entry for this shouldn’t be a problem anyway.

The mail settings on the iPhone are configured to access IMAP and SMTP on localhost, port 10143 and 10025, respectively. SSL encryption is turned off for both.

This setup is surprisingly robust. The current running stunnel daemon has been started 4 days ago and has already survived a few changes of the dynamic IP address of the mail server. I have not had a single hiccup since I figured out that I need the “delay=yes” option in the configuration file to keep up with DynDNS changes. If your mail server isn’t on a dynamic IP address, all the better.

November 8, 2009

IRC mobil, gibts ja garnicht

Filed under: Internet, iphone — Tags: — martin @ 10:51 am

Wenn ich die eine Anwendung nennen müßte, die mich auf dem iPhone am meisten überrascht hat, wäre das ja Mobile Colloquy, ein IRC-Client mit Push-Unterstützung.

Nichts erschien mir abwegiger, als IRC per iPhone zu machen, denn das IRC-Konzept mit den Channels verträgt sich ja gefühlsmäßig eher schlecht mit dem ständigen on- und offlinegehen, das durch das fehlende Multitasking des iPhone bedingt wird. Mobile Colloquy hat dieses Problem aber sehr schön gelöst, denn die bevorzugte Betriebsart ist, sich über einen sogenannten Bouncer am IRC anzumelden.

Bei einem Bouncer handelt es sich um einen IRC-Proxy, der die Verbindung zu IRC – stellvertretend für den eigenen Client – aufrecht erhält.

colloquy-push

Für Nutzer von Colloquy auf dem Mac bietet Mobile Colloquy dabei zum Beispiel auch die Möglichkeit, sich mit der auf dem Mac laufenden Colloquy-Instanz zu verbinden, diese damit quasi als Bouncer zu verwenden, und das iPhone damit zum verlängerten Arm des dort laufenden Client zu machen.

Für diejenigen, die keinen Mac mit Colloquy haben, ihn nicht ununterbrochen laufen lassen wollen, oder etwas mehr Möglichkeiten bei der Auswahl alternativer IRC-Clients für den Desktop möchten, bietet sich jedoch auch die Benutzung eines dedizierten Bouncers an. Die Colloquy-Entwickler empfehlen dazu ZNC, für den ein entsprechendes Push-Modul zur Verfügung steht. Die Installation von ZNC und dem dazu gehörenden Push-Modul unter Linux ist dabei in der Colloquy-Dokumentation beschrieben. Ich hatte hier lediglich etwas Probleme mit der unter Debian paketierten Version von ZNC. Diese mußte ich durch eine selbst übersetzte Version ersetzen, um das Modul nutzen zu können.

Ist der Bouncer einmal konfiguriert und das Push-Modul installiert und geladen, kann der Push-Mechanismus seine Vorteile voll ausspielen: Wird in einem Channel, in dem man angemeldet ist, der eigene Nickname erwähnt, erscheint eine Push-Nachricht. Nach dem Start von Mobile Colloquy bekommt man dann vom Bouncer die letzten Channel-Nachrichten zugespielt und kann direkt ins Gespräch einsteigen. Das gleiche gilt für Queries (also Chats zwischen zwei Nutzern), die ebenfalls eine Push-Nachricht erzeugen.

colloquy-replay

Verliert man die Geduld mit der kleinen Bildschirmtastatur und will am iPhone nicht länger weiterchatten, kann man dank des Bouncers auch auf den IRC-Client am stationären Rechner umsteigen, ohne daß die anderen Channel-Teilnehmer etwas davon bemerken. Ich selbst benutze neben Mobile Colloquy im Wechsel auch noch Colloquy auf dem Mac, irssi in der SSH-Session, X-Chat unter Linux und den berüchtigten Klassiker mIRC auf Windows.

Mein letzter Bouncer-Einsatz liegt einige Jahre zurück und ich bin wirklich verblüfft, was heute ohne großen Konfigurationsaufwand möglich ist. Die Installation des Bouncers erfordert zugegebenermaßen nach wie vor etwas Erfahrung mit den Linux-Konzepten im allgemeinen. Das Ergebnis ist aber gerade im Zusammenspiel mit Push und Mobile Colloquy absolut bestechend. Mobile Colloquy ist keine Krücke, sondern bringt IRC ganz einfach an neue Orte, wo man einfach garnicht damit gerechnet hätte. Vor 5 Jahren habe ich IRC noch totgesagt, heute bin ich mir diesbezüglich schon etwas weniger sicher.

September 26, 2009

Explosiver Darminhalt

Filed under: Paranoia — martin @ 7:39 pm

SpON schreibt über einen Attentäter, der die Bombe im Dickdarm versteckt hatte. Im Artikel wird schon beinahe die Terror-Apokalypse beschworen. Ich bin dagegen fast schon froh, daß es jetzt endlich so weit gekommen ist, wie ich es schon vor Jahren prophezeit habe. Alle Szenarien, alle Sicherheitsmaßnahmen, alle Überwachung sind gegen derart entschlossene Täter vollkommen sinn- und wirkungslos.

Vielleicht kommt dann ja irgendwann mal einer auf die Idee, zu hinterfragen, was einen Menschen überahaupt dazu treibt, sich Sprengstoff in den Arsch zu schieben. Das wäre vielleicht die größte Chance in der Geschichte des Post-9/11-Terrorismus.

September 24, 2009

Do the Roomba

Filed under: Technology — martin @ 7:59 pm

Ordered a Roomba 560 (funny accent there) today. If I don’t show up at the office on monday, the machine has become sentient and I was vacuumed.

git binary merge

Filed under: UNIX & Linux — martin @ 7:54 pm

At last, I’ve found a halfway practical workflow for merging binary files. When I say “merge binary”, I mean: Either let one of the two files win, or edit both files externally (such as in OpenOffice Calc) in order to manually merge them.

If git push has failed, update the remote branch by running git fetch; git merge origin/master. If git pull has failed, the remote branch has already been updated and you’re involuntarily stuck in the middle of a merge operation.

Copy the local version of the file to a temporary name: cp test.dat my.test.dat, then check out the unmerged test.dat from remote: git checkout --theirs test.dat.

Compare the files and update test.dat to contain the desired content. Then: git add test.dat; git commit; git push. Done.

This shall now be my workflow for documentation repositories. Your mileage may vary. Objects in the mirror may be closer than they appear. Thanks for your patience.

Older Posts »

Blog at WordPress.com.