そろそろPostfixを何とかしよう
Postfixを設定してみます。とりあえず動く程度の設定です。
DNS設定でSPF関係は以下が参考になるかもしれないです。
・Sender IDについて調べてみた
導入
# yum install postfix
設定
設定ファイルは /etc/postfix/main.cf
初期状態だと、コメントが多く設定し難いのでパラメータのみ抽出します。
# postconf -n > main.cf.new
CentOSの初期状態だと以下の感じになってると思われます。
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /usr/sbin config_directory = /etc/postfix daemon_directory = /usr/libexec/postfix debug_peer_level = 2 html_directory = no inet_interfaces = localhost mail_owner = postfix mailq_path = /usr/bin/mailq.postfix manpage_directory = /usr/share/man mydestination = $myhostname, localhost.$mydomain, localhost newaliases_path = /usr/bin/newaliases.postfix queue_directory = /var/spool/postfix readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES sample_directory = /usr/share/doc/postfix-2.3.3/samples sendmail_path = /usr/sbin/sendmail.postfix setgid_group = postdrop unknown_local_recipient_reject_code = 550
文法
パラメータは以下の形式で書かれています。
パラメータ名 = 値
先頭行を空白で始めることによって、前の行からの継続行とみなされます。(値を複数行にわたって書く場合)
値は $パラメータ名 とすれば参照できます。任意のパラメータ値を設定して変数のように使うことも可能です。
設定をリロード
main.cf.newをmain.cfに上書きしてサーバをリロードします。
# /etc/init.d/postfix reload
設定時に便利なコマンド
以下のコマンドを覚えておくと設定時にちょっと便利です。
・現在の設定値を調べる
(以下はmydomainを調べる場合)
# postconf mydomain
・規定値を調べる
# postconf -d mydomain
・規定値から変更させた設定一覧を出力する
# postconf -n