Skip to content

Instantly share code, notes, and snippets.

@mumumu
Last active October 23, 2018 15:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mumumu/dda0c12dee9f14100d1615e1a07107b4 to your computer and use it in GitHub Desktop.
Save mumumu/dda0c12dee9f14100d1615e1a07107b4 to your computer and use it in GitHub Desktop.

Git 版 Courier IMAP をビルドし、起動する方法のメモ

courier-unicode は、以下の方法でビルドし、インストールしておく

$ git clone https://github.com/svarshavchik/courier-libs
$ cd courier-libs/unicode
$ autoheader
$ aclocal
$ automake -a -c
$ autoconf
$ ./configure --prefix=/home/mumumu/local
$ make -j8 docs
$ make -j8
$ sudo make install

その後、以下のやり方で courier-imap をインストールする

$ sh INSTALLME courier-authlib https://github.com/svarshavchik/courier-libs
$ cd courier-authlib
$ ./configure --prefix=/home/mumumu/local
$ make -j8
$ sudo make install

$ cd /home/mumumu/local/etc/authlib
$ sudo cp authdaemonrc.dist authdaemonrc
$ sudo /home/mumumu/local/sbin/authdaemond start

$ sh INSTALLME courier-imap https://github.com/svarshavchik/courier-libs
$ cd courier-imap
$ COURIERAUTHCONFIG=/home/mumumu/local/bin/courierauthconfig CFLAGS=-I/home/mumumu/local/include ./configure --prefix=/home/mumumu/local/ --with-notice=unicode
$ make -j8
$ sudo make install
$ sudo make install-configure

$ sudo /home/mumumu/local/libexec/imapd-ssl.rc start

courier-imap を、OpenSSL ではなく、GnuTLS でコンパイルするには、configure 時に以下のように --with-gnutls を付ける。 libgcrypt のヘッダが入っていないとコンパイルエラーになるので注意

$ COURIERAUTHCONFIG=/home/mumumu/local/bin/courierauthconfig CFLAGS=-I/home/mumumu/local/include ./configure --prefix=/home/mumumu/local/ --with-gnutls

テスト用ユーザーの作成。uid と gid は、courier をインストールするシステムに存在する uid, gid 値に置き換えること
courier はそれに該当するユーザ権限でMaildirを開こうとするので。

また、この手順は AUTH=LOGIN (=クリアテキストでの認証) を使う場合のものである。
CRAM-MD5 を使いたい場合は、 https://github.com/mumumu/settings/tree/master/courier-imap を参照のこと。

$ /home/mumumu/local/sbin/userdb test@example.com set uid=9999
$ /home/mumumu/local/sbin/userdb test@example.com set gid=9999
$ /home/mumumu/local/sbin/userdb test@example.com set home=/home/mumumu
$ /home/mumumu/local/sbin/userdbpw -md5 | /home/mumumu/local/sbin/userdb test@example.com set imappw
$ /home/mumumu/local/sbin/makeuserdb

$ sudo /home/mumumu/local/sbin/mkimapdcert
$ sudo /home/mumumu/local/sbin/mkdhparams

以下はおまけ。maildrop のインストール

$ sh INSTALLME maildrop https://github.com/svarshavchik/courier-libs
$ cd maildrop
$ ./configure prefix=/home/mumumu/local/
$ make -j8
$ sudo make install

以下のような内容を $HOME/.forward に書き込む

"|spamassassin|/usr/local/bin/maildrop -d mumumu"

spamassasin は、maildrop や courier-authdaemon と通信するには、socket 経由で通信する。
そのため、courier-authdaemon の socket が読めるように permission を変更する

$ chmod +x /home/mumumu/local/var/spool/authdaemon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment