Adam Wolfe Gordon <awg@xvx.ca>
Hosted at Linode
Design by Minimalistic Design
Powered By Loathsxome

21 November 2011

Using Exchange Effectively on Linux

I've just started a new job at a company that uses Exchange for email et al. Exchange works pretty well with Outlook on Windows, and the web UI is pretty good in Internet Explorer, but if you want to use Linux it's a bit trickier. But, I think I have everything working to my liking now, so I thought I should post what I did.

Specifically, the problems to solve with Exchange on Linux are:

  1. What to do with email, especially given that I only really like using Gmail.
  2. What to use for calendaring, with bonus points if it syncs to my Android phone.
  3. How to access the company address book, for email recipient completion.
  4. How to do all this without storing passwords in plaintext.

Email

Email is pretty easy: Exchange exposes IMAP, so I use offlineimap to fetch it, and then index it with notmuch. Notmuch approximates Gmail better than anything else I've seen, and the Emacs interface works well.

My offlineimap config is very plain: it just synchronizes every two minutes. There are only two customized things: a post-sync hook that imports mail into notmuch and tags it, and a python script that fetches my username and password from gnome-keyring. The python script is based on one from Carsten Clasohm, and on his page you will find an accompanying script to add your passwords to the keyring. The only addition I've made is a main method that lets us fetch the username and password; we'll see later why we want this.

I use a special .emacs for notmuch. I start Emacs using an alias: emacs -q -l $HOME/.emacs-notmuch -f notmuch, which loads the config and starts the notmuch module. A few notes on the config:

Calendar

Google actually has a tool that syncs your Outlook calendar with your Google Calendar. It does require that you have Outlook running, so you'll need a Windows VM and a registered Outlook. If you're willing to do that, it's the perfect solution: your calendars get synced, and since your Exchange calendar events are on your Google calendar, they'll show up on your Android phone.

Address Book

Tab completion from emails that are already in your notmuch database is easy: just use Sebastian Spaeth's addrlookup (hint: check out the static-sources branch if you don't want to compile Vala code). However, I wanted to have tab completion of the whole company directory, not just people I've emailed before. This involves three steps.

Step 1: Setup DavMail to provide LDAP access to the Exchange address book. The trickiest part of this was figuring out how to setup DavMail nicely. The best way I found was to use the EWS URL (e.g. https://exchange.example.com/ews/exchange.asmx), NOT the OWA URL that most of the DavMail docs refer to. You can tell DavMail it's talking to EWS with the davmail.enableEws=true config line.

Step 2: Make something talk LDAP to DavMail. I started with the old mutt-ldap.pl script, but made some changes. In particular, this uses my offlineimap.py script to fetch my credentials, and changes the criteria a bit to work better with DavMail's LDAP implementation.

Step 3: Integrate the LDAP script with the notmuch script to search both places. This is my address-lookup script. It searches notmuch, and if it doesn't find anything then it searches LDAP; this keeps it fast for the most-contacted people. To facilitate this, I made some changes to addrlookup so that it returns the number of results it finds.

That's All!

Not so bad, eh? I hope this will help other people deal with Exchange in a sane manner.

link -- [exchange, linux, email]

06 July 2010

Installing Debian Packages Locally

My department is planning to install Ubuntu on all our lab machines, and probably take away sudo access from everyone who doesn't truly need it (i.e. anyone who isn't a sysadmin). I'm looking forward to having Ubuntu, but it's less useful if I can't install the software I want with apt-get. Thus, I started wondering whether it's possible to install Debian packages in a non-standard location, without being root.

dpkg has a --root option that lets you change the installation prefix, but it still won't let you install anything without being root. apt-get will fetch packages, but, again, only as root. So I figured I'd write a script to do it all.

The script is here. It takes as arguments either the name of a package (like you'd pass to apt-get install) or the filename of a .deb, and the prefix to which you'd like to install it. It fetches dependencies (and the package itself if necessary), then unpacks the debs and installs them. I'm planning to use it in combination with stow to install packages to $HOME/.local.

Caveats:

link -- [linux, dpkg, software]

08 November 2009

Sending Keystrokes to Applications in Linux (Programatically)

Lately I've been using the Awesome window manager, a simple dynamic window manager based on dwm. It's great, but it seems to fight with imwheel, which I've long used to map my mouse's thumb buttons to page-up and page-down. I wondered: why is there no reasonable imwheel alternative?

I tried xrebind and xnee, but it wasn't easy to get either to do what I wanted. I realized that Awesome has a built-in mouse binding support, but doesn't have a way to send keystrokes to client applications. So, I ended up figuring out a little C program that sends a keystroke to the focused client, and telling Awesome to run the program with the appropriate argument when the mouse thumb buttons are pressed.

Read more…

link -- [linux, software]

25 August 2008

Xubuntu on the HP 2133 Mini-Note

After getting tired of the default SUSE on my Mini-Note, I decided to install Xubuntu (my Linux of choice). It didn't all go smoothly, following the wiki instructions, so I thought I'd write it up here. Note that these are instructions for installation from a USB drive. Doing it from an external CD drive may be easier, but I don't have one of those.

Read more…

link -- [linux, hardware]

18 April 2008

Getting Pretty Emacs Colors in Screen

Emacs 22 has extremely nice color schemes for syntax hilighting. However, they only work in terminals that support lots of colors. By default, screen doesn't support lots of colors, so you're stuck with the plain old color scheme in emacs when using screen.

I recently found a good guide about how to make the pretty colors work in screen. The original URL of the guide is http://pastie.caboo.se/125089.txt, and I've mirrored it on xvx.ca in case the original disappears.

Happy emacsing.

link -- [linux, emacs, screen]