2012-04-03Mail関連のサービスをしていたサーバの調子が悪くなって,そろそろ移行しようかと思っていたタイミグでHDDがお亡くなりになってしまった。HDDを修復して復活させるかとも思ったんだけどサーバを収容しているServer CondominiumであるHelmerの出す音の要因の一つにHDDの動作音があった。そこでSSDに変更し新たにPostfixとDovecotをインストールした。
例にもれず,この記事はインストール時のメモなので随時更新するかもしれないし,しないかもしれない。
以前のPostfixの記事は,Postfix_oldとして引退してもらった。
となるとPostfixのVirtual Mailboxの仕組みを利用しDovecotのユーザ認証機能を使ってユーザアカウントを共有することにする。
HDDがお亡くなりになったとはいえ,とりあえずテスト用のマシンに接続しFSCKをかけたら読める場所もあったので設定の箇所をサルベージしておいた。
新しく作るサーバは以前の記事やいろいろなサイトを回って設定してみた。
この状態でインストールしUNIXアカウントからメールの送受信ができることを確認。
Virtual環境を設定。どこの設定がNGなのかわからないけど今一つメールの送受信ができるようなできないような感じ。
改めて設定してみたけど,途中からメールの送受信が今一つ。
なので,ソースからの構築に切り替えてみる。
$ wget http://mirror.ramix.jp/postfix-release/official/postfix-2.9.1.tar.gz
今時点のバージョンであるpostfix-2.9.1.tar.gzを使用する。
今回は、workというディレクトリを作成し、アーカイブされたソースを伸張する。
$ tar xvzf postfix-2.9.1.tar.gz
多分linuxではそのままmakeできるのであろけど、FreeBSD9では一部パッチする必要がある。
今回は、手動で変更した。
FreeBSD.8*) SYSTYPE=FREEBSD8 ;; FreeBSD.9*) SYSTYPE=FREEBSD9 ;; OpenBSD.2*) SYSTYPE=OPENBSD2 ;;
|| defined(FREEBSD8) || defined(FREEBSD9) \
これでmakeができる。
$ make素直に終わるはず。次はインストールを行うがその前にユーザの追加を行う。
# vipw postfix:*:125:125::0:0:Postfix Mail System:/var/spool/postfix:/usr/sbin/nologin dovecot:*:143:143::0:0:Dovecot User:/var/empty:/usr/sbin/nologin
# make install対話形式でインストール時のファイルを置く場所等が質問されるので、とりあえずデフォルで進めていく。
# cp /usr/ports/mail/postfix-current/file/postfix.sh.in . # vi postfix.sh.in : : :%s-%%PREFIX%%-/usr- # chmod +x postfix.sh.in # cp postfix.sh.in /etc/rc.d/postfix
# vi /etc/rc.conf : sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" postfix_enable="YES"
# postalias /etc/aliasesを実行し、postfix用のaliasデータベースを作成する。
これで起動する準備ができたはず... つづく
===> Installing rc.d startup script(s) Would you like to activate Postfix in /etc/mail/mailer.conf [n]? y # Fix compressed man pages To enable postfix startup script please add postfix_enable="YES" in your rc.conf If you not need sendmail anymore, please add in your rc.conf: sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" And you can disable some sendmail specific daily maintenance routines in your /etc/periodic.conf file: daily_clean_hoststat_enable="NO" daily_status_mail_rejects_enable="NO" daily_status_include_submit_mailq="NO" daily_submit_queuerun="NO" If /etc/periodic.conf does not exist please create it and add those values. If you are using SASL, you need to make sure that postfix has access to read the sasldb file. This is accomplished by adding postfix to group mail and making the /usr/local/etc/sasldb* file(s) readable by group mail (this should be the default for new installs). If you are upgrading from Postfix 2.6 or earlier, review the RELEASE_NOTES to familiarize yourself with new features and incompatabilities. ===> Correct pkg-plist sequence to create group(s) and user(s) ===> Compressing manual pages for postfix-2.8.7,1 ===> Registering installation for postfix-2.8.7,1 ===> SECURITY REPORT: This port has installed the following binaries which execute with increased privileges. /usr/local/sbin/postdrop /usr/local/sbin/postqueue This port has installed the following files which may act as network servers and may therefore pose a remote security risk to the system. /usr/local/libexec/postfix/nqmgr /usr/local/libexec/postfix/postscreen /usr/local/libexec/postfix/qmgr /usr/local/libexec/postfix/showq /usr/local/libexec/postfix/master /usr/local/libexec/postfix/error /usr/local/libexec/postfix/scache /usr/local/libexec/postfix/qmqpd /usr/local/libexec/postfix/anvil /usr/local/libexec/postfix/cleanup /usr/local/libexec/postfix/dnsblog /usr/local/libexec/postfix/pickup /usr/local/libexec/postfix/discard /usr/local/libexec/postfix/virtual /usr/local/libexec/postfix/oqmgr /usr/local/libexec/postfix/verify /usr/local/libexec/postfix/spawn /usr/local/libexec/postfix/local /usr/local/libexec/postfix/flush /usr/local/libexec/postfix/tlsmgr /usr/local/libexec/postfix/bounce /usr/local/libexec/postfix/tlsproxy /usr/local/libexec/postfix/smtpd /usr/local/libexec/postfix/pipe /usr/local/libexec/postfix/smtp /usr/local/libexec/postfix/proxymap /usr/local/libexec/postfix/trivial-rewrite /usr/local/libexec/postfix/lmtp This port has installed the following startup scripts which may cause these network services to be started at boot time. /usr/local/etc/rc.d/postfix If there are vulnerabilities in these programs there may be a security risk to the system. FreeBSD makes no guarantee about the security of ports included in the Ports Collection. Please type 'make deinstall' to deinstall the port if this is a concern. For more information, and contact details about the security status of this software, see the following webpage: http://www.postfix.org/