Tales From The Geek Side

The geeky musings of Greg Rowe.

Archive for the 'Tips' Category

HTML Composition in Thunderbird

August 11th, 2008 by greg

Generally I write email using plain text.  Sometimes I really want to use HTML.  I couldn’t find an easy way to switch to compose in HTML when composing a message in Thunderbird so I started searching for extensions.  I found that you don’t need an extension to accomplish this.  All you need to do is hold shift while clicking on the compose button (”write” button).  This doesn’t work with the keyboard (ctrl-shift-m) but I’m OK with that since it’s rare that I compose in HTML.

I also found that holding shift while clicking on Reply or Reply to All also opens the composition window in HTML editing mode.

References:

1

Category: Geek, Tips | No Comments »

Symantec Backup Agent for Linux

June 23rd, 2008 by greg

At work I administer a few Linux servers. I’m a long time Debian user who has rarely been disappointed by the distribution. As such I have Debian on the machines I administer. The company has chosen to use Symantec’s Backup Exec software. They “support” Linux but, in my experience with their software, it’s terrible. Memory leaks, crashes, and the most convoluted install scripts I’ve ever seen. If it were my choice I wouldn’t use their crapware at all but I have to use it.

Long ago I found this set of instructions for installing “RALUS” on Debian. Since their install scripts were so terrible I was happy to find good alternative. I’m reproducing the instructions here for my own reference. These instructions are based off of installing version 11d.7170. Read the rest of this entry »

Category: Software, Tips | No Comments »

Extracting Audio From Video

June 20th, 2008 by greg

I recently came across some some excellent concert footage. I wanted to have the performance available on my mp3 player but I didn’t want to re-encode the audio. Ffmpeg came to the rescue.

Using ffmpeg you can split out the audio and video components of any video stream it understands. In fact you can tell ffmpeg to transcode the audio as well. In my case the audio was already in mp3 format so I didn’t want to transcode. Ffmpeg allows you to specify “copy” as an output format in which case it doesn’t modify the audio stream in any way.

To extract the audio I ran the following. The -vn switch instructs ffmpeg to omit the video stream. The default behavior would be to output a video stream as well as audio streams. The -acodev switch tells ffmpeg what format you want the audio stream to be output as. In my case I didn’t want it transcoded so I specified “copy.”

$ ffmpeg -i slayer-rock-am-ring-2007.avi -vn -acodec copy slayer-rock-am-ring-2007.mp3

Now I just need to find a tool to break mp3s into audio tracks without re-encoding.

References:
http://howto-pages.org/ffmpeg/#strip

Category: Geek, Tips | No Comments »

Sync Kolab

January 17th, 2008 by greg

Sync Kolab is an add-on for Thunderbird that synchronizes your address book as well as calendar data. The calendar features are optional and only available if you use the Lightning add-on (I do not). You can store your address book data in an IMAP folder or on a Kolab server. I’ve long been an IMAP user and I do not wish to administer a Kolab server so I’ve opted for the IMAP backend.

I’ve been using Sync Kolab for months now but I’ve always been disappointed. Thunderbird has an option to choose the format of messages, either plain text or HTML, for each contact. This is great because I like the richer formatting available in HTML but HTML isn’t appropriate for many situations. Mailing lists are a prime example of when to use plain text. I’d finally grown annoyed enough that I started peering into the source code to add the feature myself.

What I found in the code was that the feature was already supported — if you are using the VCARD backend. Now that I’ve switched to the VCARD backend all is well!

Category: Geek, Software, Tips | No Comments »

Creating a Certificate With Multiple Hostnames

January 8th, 2008 by greg

Multiple Names on One Certificate

While it is not possible without TLS extensions to serve different certificates for a single IP (See here on how to setup apache on Debian for TLS extensions.) it is possible to have a single certificate that works with any number of hostnames. I’m not talking about a wildcard certificate but a certificate that allows completely different hostnames to be valid for a single certificate. For example www.foo.com and www.foo.org can share a certificate. This approach would not be appropriate except in certain circumstances. You wouldn’t want to have two different customers using the same certificate but a single customer may wish to use one certificate for all of their domains. Both Internet Explorer and Firefox honor certificates of this type. From what I read some Java SSL libraries do not handle this type of certificate properly but Java was the only exception.

x509 certificates, those that are served in SSL communications, offer a feature known as Subject Altnerative Names. A subject Alternative Name is an attribute that lists an alternate name for the subject of the certificate (that’s oddly fitting isn’t it?). In a web context that subject is the hostname. However it’s not just hostnames that can be an alternative subject. Email is an option as is IP addresses.

The first step is to create a CSR (certificate signing request) that contains the subject alternative names that you desire for your certificate. I will show how to do that using openssl. You will likely need to modify the default openssl.cnf file. In Debian this is located in /etc/ssl/openssl.cnf. Note that you may prefer to make modifications to a local copy and tell openssl to use your locally modified copy using the -config option. For simplicity I will omit -config localopenssl.cnf from my examples.

Config File Settings

You need to tell openssl to create a CSR that includes x509 V3 extensions and you also need to tell openssl to include a list of subject alternative names in your CSR. In my openssl.cnf I have the following:

In the [req] section

[req]
req_extensions = v3_req

In the v3_req section:

[ v3_req ]

# Extensions to add to a certificate request
basicConstraints = CA:FALSE
keyUsage = nonRepudiation, digitalSignature, keyEncipherment

# Some CAs do not yet support subjectAltName in CSRs.
# Instead the additional names are form entries on web
# pages where one requests the certificate...
subjectAltName          = @alt_names

[alt_names]
DNS.1   = www.foo.com
DNS.2   = www.foo.org

Generating the CSR

Then the CSR is generated using:

$ openssl req -new -out $CSR_FILENAME -key $KEY_FILE

To check to see if you got everything correct use:

$ openssl req -text -noout -in $CSR_FILENAME

You should see something similar to this:

        Attributes:
        Requested Extensions:
            X509v3 Basic Constraints:
                CA:FALSE
            X509v3 Key Usage:
                Digital Signature, Non Repudiation, Key Encipherment
            X509v3 Subject Alternative Name:
                DNS:www.foo.com, DNS:www.foo.org

Creating the Certificate

Now you must have a CA (certificate authority) create a signed certificate based on the information provided in your request. Unfortunately most CA software will not honor the subject alternative names in a CSR by default. In the case of the certificate signing tools from Microsoft in Windows 2003 you can tell it to honor subject alternative names using the following:

certutil -setreg policy\EditFlags +EDITF_ATTRIBUTESUBJECTALTNAME2
net stop certsvc
net start certsvc

For openssl you need to use a policy that allows subject alternative names. I believe the policy named policy_anything in the default openssl.cnf file will work. To use that policy:

$ openssl ca -policy policy_anything -in $CSR_FILENAME -out $CERT_FILENAME

Finally to test that your certificate was created correctly use the following:

$ openssl x509 -text -noout -in $CERT_FILENAME

You should see something like this:

 X509v3 extensions:
            X509v3 Basic Constraints: critical
                CA:FALSE
            X509v3 Key Usage:
                Digital Signature, Key Encipherment
            X509v3 Subject Alternative Name:
                DNS:www.foo.org DNS:www.foo.org

Category: Geek, Tips | 1 Comment »

Debian Volatile

November 25th, 2007 by greg

I administer a couple of Debian based email servers all with similar setups. Each runs Exim, ClamAV, and Spamassassin. Around the time I upgraded the servers from sarge to etch I noticed that exim was logging to the panic log periodically. This hasn’t been a huge concern to me as it should result in a temporary delivery error and the sending email server should resend the failed message. Still any issue annoys me. I didn’t get very far tracking the problem down. As best I could tell ClamAV was taking longer than 3 minutes to reload virus definitions and was unresponsive to Exim during the reload period. Exim would then panic.

The log file contained entries that looked like this:

malware acl condition: clamd: unable to read from socket (Connection timed out)

Recently a friend who seemed to have a similar problem alerted me to the Debian Volatile project. This project is, essentially, a backport project for software that is “volatile.” This includes software such as ClamAV and Spamassassin. It can be critical to keep up to date with these packages if you are running a mail server. A few days ago I upgraded Spamassassin and ClamAV to the versions provided in etch/volatile. This seems to have corrected the ClamAV problem I was faced and now I have a more recent version of Spamassassin to better fight spam with.

The problem it seems was that freshclam, the tool that updates the virus definitions, wasn’t able to get new definitions because it was too old. Apparently freshclam sends along version information and the server rejects the request if the version is too old.

Category: Tips | No Comments »

Auto Remounting with Apt

September 5th, 2007 by greg

On most of my Internet facing Linux systems I have /tmp as a separate file system. I do this primarily so that I can set noexec and nosuid on the file system. While that won’t stop a real intruder it will slow down or stop script kiddies and worms.

This causes a minor issue with Debian. When I upgrade packages I’ve noticed that many packages create scripts in /tmp and try to execute them. That, of course, fails with noexec set on the file system. For a while I’ve been forcing myself to remember to remount /tmp prior to upgrading. This is error prone and I knew there must be a better way. Today I took the time to find a better way.

Apt is highly configurable but you’d never know it because you almost never need to changes default settings — at least that’s been my experience. Browsing through /usr/share/doc/apt/examples/configure-index.gz I found what I was looking for. You can specify shell code to run before and after apt invokes dpkg. I created a file /etc/apt/apt.conf.d/99local where I placed the following:

// Auto re-mounting of /tmp
Pre-Invoke {"mount -o remount,exec,suid /tmp";};
Post-Invoke {"mount -o remount,noexec,nosuid /tmp";};

Now I don’t have to remember to remount anything. This is also useful if you wanted to keep things like /usr/bin mounted readonly.

Category: Geek, Tips | No Comments »

Regenerating Large Mailman Archives

September 3rd, 2007 by greg

In the fall of 2005 a server that I operated was broken into. The perpetrators defaced every index.* file on the system including those in the archives of a mailing list that I’ve run since December of 2005. Recently it came to my attention that those files were overlooked in the cleanup process. I checked my backup CDs from 2005 and found that I did not have any backups that could be used to restore the defaced archives. So I did what anyone would do, I searched for ways to regenerate the archive. Mailman includes tools to regenerate archives but there are some issues.

Read the rest of this entry »

Category: Code, Geek, Site, Software, Tips | No Comments »

Incrementing Version Numbers

August 14th, 2007 by greg

Dealing with software version numbers is a pain. If you try to do it manually you will invariably end up forgetting to update the version information in your source code or forget to commit the changes. Having programatic access to version information is helpful too.

Read the rest of this entry »

Category: Code, Geek, Tips | No Comments »

Debian and NFS Root Filesystems

July 31st, 2007 by greg

This past weekend I did something I rarely do. I ran `apt-get dist-upgrade` on my desktop machine. I track the unstable branch of Debian on that machine and I rarely have any issues. This time things didn’t go so well.

After the upgrade the next time I booted my computer almost nothing would start. The root filesytem was mounted read-only and `mount / -o remount,rw` failed because my root filesystem is an nfs mount and rpc.statd wasn’t started. Big deal right? Just start rpc.statd. Not so fast! rpc.statd wouldn’t start because it writes its PID to /var/run. Of course /var/run was read-only so rpc.statd would not load. There was no documented command line option to write the PID to a different file.

After reading through a lot of the startup scripts in /etc/rcS.d I noticed that `nolock` is handled specially in many of the scripts. I added nolock (which is safe for a root filesystem that is not shared among multiple machines or any filesystem that would be mounted read-only) to the line for my root filesystem and rebooted. Viola! I have a computer again.

Now I need to figure out why my i915 video card using the i810 xorg driver is flickering…

Category: Geek, Tips | No Comments »