Superuser / administrators group in courier imap

One not obvious feature in courier imap is the superuser account. The feature is a bit hidden in documentation for courier-authlib (see man auth_generic). It is based on the IMAP group functionality of courier.

You can assign a user account to different groups independently from other (system) groups the belongs to. The group assignement is implemented with the option field in courier-authlib, see man auth_generic.

There is a special group name “administrators”. If you assign one account to that group you have automatically full access to all other users mailboxes and folders over the #shared namespace. This is especially usefull when doing e.g. email migration over IMAP from one server to another.

If you use courier-authlib-ldap there is neither a explicit option field nor a groups field in couriers LDAP scheme. But you can assign arbitrary text attributes to group setting with the LDAP_AUXOPTIONS variable. As I don’t use the sharedgroup attribute I simply misused it for the group setting by adding the following to /etc/authlib/authldaprc:

LDAP_AUXOPTIONS disableimap=disableimap,disablepop3=disablepop3,disablewebmail=disablewebmail,sharedgroup=group

Git: Reverting files in working copy

If you have want to revert some single file in your working copy to the “official” repository version use $ git checkout filename. git revert does not work like in other versioncontrol systems, instead it reverts already submitted changes.

If you want to revert the whole working copy use git reset.

See also man page of git-revert and Bryan Murdocks blog post.

Correct wrong exif timestamps

Found out that the exif timestamps of my last holiday pictures had the wrong timezone. This can be easily corrected with Phil Harveys exiftool. There is even a description of exactly that problem in the documentation

In my case I did not only correct the timezone shift, but also the error to UTC time. For this purpose I simply took a picture of my GPS receivers clock display to compare the GPS / UTC timestamp to the EXIF data. It was a time shift of plus 59 minutes and 39 seconds so I used the following command line:

$ exiftool -AllDates+=:59:39 pictureDirectory

Note that by default exiftool generates backup copies to *_original files which you may want to delete afterwards.

Debugging Exchange IMAP sessions with openssl s_client

I was just curious about the fact that openssl s_client -connect exchangeserver:993 was not working the way I expected it to work. I saw the greeting of the server but wasn’t able to do send any commands such as A1 CAPABILITY. The same worked for all other servers in the past.

Interestingly enough telnet exchangeserver 143 worked, but for obvious reasons unencrypted connections are not an option.

The reason behind is that in fact IMAP and telnet protocol and uses CRLF as line endings and Exchange servers are a bit picky on this specific point. As openssl is not a native client like telnet it sends whatever the terminal uses.

However there is already an solution builtin openssl s_client. Just pass the additional crlf option:

$ openssl s_client -connect exchangeserver:993 -crlf

Show http header / file information without actually downloading

To show the http meta information such as modification date or file size without downloading actually the data you can use the following commands:

$ HEAD http://www.georglutz.de/blog
200 OK
Cache-Control: no-cache, pre-check=0, post-check=0
Connection: close
Date: Sat, 05 Sep 2009 18:12:30 GMT
Pragma: no-cache
ETag: "Sat, 05 Sep 2009 09:11:22 GMT"
Server: Apache/2.0.52 (CentOS)
Content-Type: text/xml; charset=utf-8
Expires: 0
Last-Modified: Sat, 05 Sep 2009 09:11:22 GMT
Client-Date: Sat, 05 Sep 2009 18:12:31 GMT
Client-Peer: 85.214.18.185:80
Client-Response-Num: 1
Set-Cookie: PHPSESSID=xyz; path=/
Set-Cookie: PHPSESSID=abc; path=/
Status: 200 OK
X-Blog: Serendipity
X-Powered-By: PHP/4.3.9
X-Serendipity-InterfaceLang: de
X-Serendipity-InterfaceLangSource: Content-Negotiation
X-Session-Reinit: true

$ wget -S --spider http://www.georglutz.de/blog/feeds/index.rss
Spider-Modus eingeschaltet.  Prüfe ob die Datei auf dem Server existiert.
--2009-09-05 20:13:38--  http://www.georglutz.de/blog/feeds/index.rss
Auflösen des Hostnamen »www.georglutz.de«.... 85.214.18.185, 2002:55d6:12b9::1
Verbindungsaufbau zu www.georglutz.de|85.214.18.185|:80... verbunden.
HTTP Anforderung gesendet, warte auf Antwort...
  HTTP/1.1 200 OK
  Date: Sat, 05 Sep 2009 18:13:38 GMT
  Server: Apache/2.0.52 (CentOS)
  X-Powered-By: PHP/4.3.9
  Status: 200 OK
  Set-Cookie: PHPSESSID=xyz; path=/
  Expires: 0
  Cache-Control: no-cache, pre-check=0, post-check=0
  Pragma: no-cache
  Set-Cookie: PHPSESSID=abc; path=/
  X-Session-Reinit: true
  X-Serendipity-InterfaceLangSource: Content-Negotiation
  X-Serendipity-InterfaceLang: de
  X-Blog: Serendipity
  Last-Modified: Sat, 05 Sep 2009 09:11:22 GMT
  ETag: "Sat, 05 Sep 2009 09:11:22 GMT"
  Connection: close
  Content-Type: text/xml; charset=utf-8
Länge: nicht spezifiziert [text/xml]
Datei auf dem Server existiert.

In Fedora 10 HEAD is part of the package perl-libwww-perl.