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

# 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 " ;;
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";


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.