Category Archives: Postfix

Installing postfix in freenas jail

As part of my occasional series of how I used my FreeNAS server as the heart of my home network, I decided to transfer my mail/IMAP server from a standalone Linux box to a FreeNAS jail.

Linux Configuration

This machine is only serving as the mail server, so it needs a minimal install with sufficient packages to support mail. It doesn’t need the overhead of running X sessions.

  • Linux: OpenSUSE 12.3
  • Postfix
  • Dovecot
  • Apache server
  • postfixadmin
  • eGroupware
  • fetchmail
  • PHP and perl support
  • Some support tools such as the PostgresQL command-line client

The hardware running this is an old laptop (circa 2005) with a fairly modest specification (by today’s standards).  An Intel Celeron processor, 700Mb memory and a 60MB HDD with a 100Mbit ethernet connection.  However, looking at the load on this system, it is spending most of it’s time idle.  The backend PostgresQL database used by postfix and the groupware product is already sitting in another FreeNAS jail. Continue reading Installing postfix in freenas jail

Why Use Postfix.admin at Home?

Why use postfixadmin? Isn’t this overkill?

If you’re running a Linux system at home, you’re quite likely to be using Postfix as your mail transfer agent MTA. Postfix has been around for years and is secure and relatively easy to maintain.  Most Linux distributions come with a configuration utility which makes it even easier.

Like almost all other Linux applications, the configuration files are plain text files sitting in the /etc directory so any text editor can be used to maintain these.

Postfix also works well with things like IMAP servers like Dovecot. This makes it straightforward to set up a home mail server that you can access from outside your home and on your smartphone.

Continue reading Why Use Postfix.admin at Home?

Missing dovecotpw command

When installing the Dovecot IMAP server and Postfix.admin , one of the Postfix.admin configuration lines required the dovecotpw command which wasn’t included in the version (2.1.3) of Dovecot I had installed.

The doveadm utility performs all the management functions, but simply calling this from postfix admin didn’t work.

Here’s the small wrapper I wrote around the doveadm program so the postfixadmin sees a dovecotpw utility

#!/bin/sh
# front end to mimic dovecotpw using doveadm for postfixadmin
#
# doveadm pw [-l] [-p plaintext] [-r rounds] [-s scheme] [-t hash] [-u user] [-V]

cmdargs="pw "
while getopts ":lp:r:s:t:u:V" opt ; do
case $opt in 
        l ) cmdargs="$cmdargs -l ";;
        V ) cmdargs="$cmdargs -V ";;
        p ) cmdargs="$cmdargs -p $OPTARG " ;;
        r ) cmdargs="$cmdargs -r $OPTARG " ;;
        s ) cmdargs="$cmdargs -s $OPTARG " ;;
        t ) cmdargs="$cmdargs -t $OPTARG " ;;
        u ) cmdargs="$cmdargs -u $OPTARG " ;;
esac
done
shift $(($OPTIND - 1))

/usr/bin/doveadm $cmdargs

I placed this in /usr/local/bin and referenced it directly from the postfixadmin configuration file.

Make the file executable by using chmod.

mailserv:/root # chmod 755 /usr/local/bin/dovecotpw
mailserv:/root # ls -al /usr/local/bin/dovecotpw 
-rwxr-xr-x 1 root root 519 Feb  6  2013 /usr/local/bin/dovecotpw

Here are the relevant lines from the postfixadmin configuration file config.inc.php. (In OpenSuse 12.3 this file is found in /srv/www/htdocs/postfixadmin/config.inc.php).

$CONF['encrypt'] = 'dovecot:CRAM-MD5';
// If you use the dovecot encryption method: where is the dovecotpw binary located?
$CONF['dovecotpw'] = "/usr/local/bin/dovecotpw";