this is obsolete doc -- see http://doc.nethence.com/ instead

Setting up Alpine with Maildir and PGP 

 

Setting up Alpine with Maildir 

Fetch and build Alpine with the Maildir patch, 

wget "ftp://ftp.cac.washington.edu/alpine/alpine.tar.gz"
wget "http://patches.freeiz.com/alpine/patches/alpine-2.00/maildir.patch.gz"
#wget "http://patches.freeiz.com/alpine/patches/alpine-2.00/fancy.patch.gz"
gunzip maildir.patch.gz
tar xzf alpine.tar.gz
cd alpine-2.00/
patch -p1 < ../maildir.patch
#patch -p1 < ../fancy.patch
./configure --without-tcl
make
make install

and create a wrapper if you are an old-timer, 

cd /usr/local/bin/
ln -s alpine pine

 

Create a default configuration by launching Alpine as the mail user (which has ~/Maildir/) and backup it, 

alpine
q
cp .pinerc .pinerc.dist

fix your From field either by using the simple entries, 

M S C
Personal Name
User Domain
#personal-name=YOUR NAME
#user-domain=EXAMPLE.NET

or customized headers (needed if your username doesn't match the email address), 

vi .pinerc
customized-hdrs=From: YOUR NAME <EMAIL@EXAMPLE.NET>

tweak it as you wish e.g., 

M S C
  [ Composer Preferences ]      [X]  Compose Cancel Confirm Uses Yes
  [ Sending Preferences ]      [X]  Enable 8bit ESMTP Negotiation
  [ Folder Preferences ]      [X]  Single Column Folder List
Pruning Rule                      =  (*)  don't rename, ask about deleting

and if you've also applied the fancy patch, enable reverse thread (no need to change thread-sort-key=), 

  [ Message Index Preferences ]      [X]  Enhanced Fancy Thread Support
Sort Key                          =            (*)  Reverse tHread

 

Force the use of Maildir folder for all users (as root), 

cd /usr/local/lib/
cat > pine.conf <<EOF9
folder-collections=Mail #mc/Maildir/[]
EOF9

Note. Using #mc instead of #md if using a dotted folder structure. Otherwise you would have to add :LAYOUT=fs to your Dovecot mail_location= configuration. 

 

Setting up PGP 

Install GnuPG (FreeBSD v8), 

export PACKAGESITE=ftp://ftp.free.fr/mirrors/ftp.freebsd.org/ports/amd64/packages-8.3-release/Latest/

  pkg_add -r gnupg1 (version 1!) 

Note. Using GnuPG version 1 as pinentry [does not work with Alpine](http://lists.freebsd.org/pipermail/freebsd-ports/2007-August/thread.html#43256) in text mode (only the GTK pop-up would work). 

 

Generate a key pair and export the public one to a file, 

cd ~/
gpg --list-keys
gpg --gen-key
gpg --armor --export ID_EIGHT_NUM > USERNAME.2014.asc
gpg --armor --export-secret-keys ID_EIGHT_NUM > /some/safe/place/or/backup/device/USERNAME.2014.private.and.random.text.asc;-)

Note. Eventually chmod 000 or 400 the private key and isolate it on a backup device, for example. 

Note. without argument works too, at least for a single managed key pair. 

 

Configure Alpine so the display and sending PGP filters become available, 

vi .pinerc
display-filters=_LEADING("-----BEGIN PGP SIGNED ")_ /usr/local/libexec/ppf_verify _TMPFILE_,
        _LEADING("-----BEGIN PGP MESSAGE")_ /usr/local/libexec/ppf_decrypt _TMPFILE_
sending-filters=/usr/local/libexec/ppf_sign _INCLUDEALLHDRS_,
        /usr/local/libexec/ppf_encrypt _INCLUDEALLHDRS_ _RECIPIENTS_

Note. TAB on new lines. 

Also add this recommended setting, 

feature-list=... + enable-8bit-esmtp-negotiation

Note. TAB on new feature lines. 

 

Fetch and install Pine PGP filters, 

wget --no-check-certificate "https://dougbarton.us/PGP/ppf/pine-pgp-filters-1.8.tar.gz"
cd pine-pgp-filters-1.8/
./configure
make
make install

Note. It recognizes the GnuPG version at configure time. 

 

Ready to go 

Note. As the result you should see those changes in your .pinerc, 

feature-list=enhanced-fancy-thread-support,
        single-column-folder-list,
        enable-8bit-esmtp-negotiation,
        compose-cancel-confirm-uses-yes
sort-key=tHread/Reverse

Note. TAB on new feature lines. 

 

Troubleshooting 

If you get this error message while generating PGP keys, 

can't connect to the PIN entry module: IPC connect call failed

it is because gnupg2 [requires the pinentry package](http://rdist.root.org/2007/04/26/gpg-now-requires-pinentry-package/). And you should use GnuPG version 2 unless you are using GTK for the pop-up, as Alpine does not work with pinentry in text mode (pinentry-curses). 

 

If you get this error message while sending a signed or encrypted message, 

no LC_CTYPE known - assuming UTF-8

make sure you use GnuPG version 1. See explanation above in the guide. 

 

If you get this warning, 

gpg: WARNING: using insecure memory!

it [doesn't really matter](http://www.gnupg.org/faq/gnupg-faq.html#insecure_memory). 

 

References 

Alpine Messaging System: http://www.washington.edu/alpine/ 

Maildir patch for Alpine: http://patches.freeiz.com/alpine/info/maildir.html 

Support for Courier/Cyrus/Dovecot file systems in the Maildir patch for Alpine: http://patches.freeiz.com/alpine/info/courier.html 

Pine PGP Filters: https://dougbarton.us/PGP/ppf/ 

pine-pgp-filters-1.8/README 

pine-pgp-filters-1.8/INSTALL