postfixのインストール
インストールするverはpostfix-2.3.3-2.3.el5_6
[root@server]# yum -y install postfix [root@server]#
メールの要件
サーバ名:mail
ドメイン名:hoge.jp
受信ドメイン: hoge.jp mail.hoge.jp localhost
コネクションを受け付ける際、バージョンは表示しない
外部から受信ドメイン宛のメールのみリレーし、それ以外はリレーしない。
ただし、内部ネットワークからのメールはリレーする
コンフィグの基本設定
変更箇所は以下の通り
[root@server]# cp /etc/postfix/main.cf /etc/postfix/main.cf.org [root@server]# vi /etc/postfix/main.cf myhostnamne = mail.hoge.jp mydomain = hoge.jp myorigin = hoge.jp inet_interfaces = all mydestination = hoge.jp, $myhostname, localhost.$mydomain, localhost mynetworks_style = subnet mynetworks = 192.168.100.0/24, 127.0.0.0/8 home_mailbox = Maildir/ smtpd_banner = $myhostname ESMTP Unknown relayhost = [環境に応じて] [root@server]#
※snmpauthを利用する場合はmynetworksで指定したネットワークからの通信は認証処理が行われない。
127.0.0.1にすることですべて認証されるようになる。
postconf -n コマンドで確認
[root@server]# postconf -n
myhostnamne = mail.hoge.jp
mydomain = hoge.jp
myorigin = hoge.jp
inet_interfaces = all
mydestination = hoge.jp, $myhostname, localhost.$mydomain, localhost
mynetworks_style = subnet
mynetworks = 192.168.100.0/24, 127.0.0.0/8
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP Unknown
relayhost = [環境に応じて]
[root@server]#
SMTP-AUTH
cyrus-saslのrpmがインストールされていることが前提となります。
[root@server]# vi /etc/postfix/main.cf smtpd_sasl_auth_enable = yes smtpd_sasl_security_options = noanonymous broken_sasl_auth_clients = yes smtpd_recipient_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination [root@server]#
/etc/sasl2/smtpd.conf
[root@server ]# vi /etc/sasl2/smtpd.conf pwcheck_method: saslauthd mech_list: plain login [root@server ]#
SMTP-TLS
自動起動の有効化
[root@server]# chkconfig postfix on
[root@server]#
第3者中継チェック
不正にリレーされないかをチェックする
http://www.rbl.jp/svcheck.php
運用コマンド
postconf
なし 現状の設定値を表示する
-n デフォルト値と異なるパラメータのみを表示する
-d デフォルト値を表示する
-c config_dir 指定したコンフィグファイルを読み込む
-l サポートされたmailboxのロック方法を表示する
postqueue
-p キューの状態を確認する (mailqコマンドで代用可)
-f キュー内のメールを強制送信を試みる
postsupre -d ALL キューをすべて削除する
[参考サイト]
・Postfixのぺーじ
→http://www.postfix-jp.info/