2017年1月6日金曜日

FreeBSD11でpostfix-current-3.2.20160925,4を設定する

FreeBSD11のサーバーで必要なコマンドはだいたいpkgを使ってインストールすることができたので、次は個々のサーバー・ソフトウェアの設定です。

最初に、インストールしたpostfixのパッケージに付属するメッセージを確認します。
$ pkg query "%M" `pkg info -x postfix`
Always:
To use postfix instead of sendmail:
  - clear sendmail queue and stop the sendmail daemons

Run the following commands to enable postfix during startup:
  - sysrc postfix_enable="YES"
  - sysrc sendmail_enable="NONE"

If postfix is *not* already activated in /usr/local/etc/mail/mailer.conf
  - mv /usr/local/etc/mail/mailer.conf /usr/local/etc/mail/mailer.conf.old
  - install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf

Disable sendmail(8) specific tasks,
add the following lines to /etc/periodic.conf(.local):
  daily_clean_hoststat_enable="NO"
  daily_status_mail_rejects_enable="NO"
  daily_status_include_submit_mailq="NO"
  daily_submit_queuerun="NO"

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 prior postfix version, please see the README
files for recommended changes to your configuration and additional
http://www.postfix.org/COMPATIBILITY_README.html

$
最初のメールのキューについては、まだメールは使っていないので、実行する必要はありません。次にsysrcコマンドでrc.confファイルを設定するようです。
$ sudo sysrc postfix_enable="YES"
password:
postfix_enable:  -> YES
kona$ sudo sysrc sendmail_enable="NONE"
password:
sendmail_enable: NO -> NONE
$ tail /etc/rc.conf

rpc_ypupdated_enable="NO"       # Run if NIS master and SecureRPC (or NO).

nfsv4_server_enable="YES"       # Enable support for NFSv4
nfscbd_enable="YES"             # NFSv4 client side callback daemon
nfscbd_flags=""                 # Flags for nfscbd
nfsuserd_enable="YES"           # NFSv4 user/group name mapping daemon
nfsuserd_flags=""               # Flags for nfsuserd
postfix_enable="YES"
sendmail_enable="NONE"
$
確かにrc.confが書き換わっています。

次にmailer.confファイルを設定します。
$ ls -d /usr/local/etc/mail
ls: /usr/local/etc/mail: No such file or directory
$ sudo mkdir -p /usr/local/etc/mail
password:
kona$ sudo install -m 0644 /usr/local/share/postfix/mailer.conf.postfix /usr/local/etc/mail/mailer.conf
password:
$ cat /usr/local/etc/mail/mailer.conf
#
# Execute the Postfix sendmail program, named /usr/local/sbin/sendmail
#
sendmail        /usr/local/sbin/sendmail
send-mail       /usr/local/sbin/sendmail
mailq           /usr/local/sbin/sendmail
newaliases      /usr/local/sbin/sendmail
$
/etc/periodic.confは以下のようにします。
$ cat /etc/periodic.conf
daily_status_mail_rejects_enable="NO"
daily_status_include_submit_mailq="NO"
daily_submit_queuerun="NO"
$
次にpostfixの設定ファイルを編集します。