| # /etc/rc.d/init.d/sendmail stop |
| # cd /usr/ports/security/cyrus-sasl2 |
| # make install clean |
| # cd /usr/ports/security/cyrus-sasl2-saslauthd |
| # make WITH_OPENLDAP=yes install clean |
| # pw groupadd postfix |
| # pw groupadd postdrop |
| # pw useradd postfix -d /nonexistent -g postfix -s /sbin/nologin |
| % tar xvfz postfix-2.7.2.tar.gz |
| % cd postfix-2.7.2 |
| % gzip -dc postfix-2.7-patch01.gz | patch -p1 |
| % gzip -dc postfix-2.7-patch02.gz | patch -p1 |
| % make CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2" |
| % make install |
| install_root: / |
| tempdir: /usr/home/hm/src/postfix-2.7.2 |
| config_directory: /etc/postfix |
| command_directory: /usr/sbin |
| daemon_directory: /usr/libexec/postfix |
| data_directory: /var/lib/postfix |
| html_directory: [no] |
| mail_owner: [postfix] |
| mailq_path: /usr/bin/mailq |
| manpage_directory: /usr/local/man |
| newaliases_path: /usr/bin/newaliases |
| queue_directory: /var/spool/postfix |
| readme_directory: [no] |
| sendmail_path: /usr/sbin/sendmail |
| setgid_group: [postdrop] |
| ・・ |
| # |
| # cd /etc/postfix |
| # cp main.cf main.cf.org |
| # vi main.cf |
| myhostname = main.ドメイン名 | # mail.mydomain.dip.jpなどを指定 | |
| mydomain = ドメイン名 | # mydomain.dip.jpなどを指定 | |
| myorigin = $mydomain | # コメントを外して有効にする | |
| inet_interfaces = all | # コメントを外して有効にする | |
| mydestination = $myhostname, | # コメントを外して有効にする | |
| localhost.$mydomain | ||
| localhost, $mydomain = all | ||
| mynetworks_style = host | # コメントを外して有効にする | |
| mynetworks = 192.168.0.0/24, 127.0.0.0/8 | # コメントを外して有効にする | |
| alias_maps = hash:/etc/mail/aliases | # エリアス・マップのパスを指定 | |
| alias_database = hash:/etc/mail/aliases | # エリアスDBのパスを指定 | |
| mail_spool_directory = /var/mai | # Sendmailで使用していたスプールパスを指定 | |
| smtpd_banner = $myhostname ESMTP $mail_name | # コメントを外して有効にする | |
| smtp_sasl_type = cyrus | # 追加 (SASLタイプ) | |
| smtp_sasl_auth_enable = yes | # 追加 (SASL認証を有効にする) | |
| smtp_sasl_password_maps = hash:/etc/postfix/isp_auth | # 追加 (認証パスワードのパス) | |
| smtp_sasl_security_options = noanonymous | # 追加 (匿名認証を許可しない) | |
| smtp_sasl_mechanism_filter = cram-md5, login, plain | # 追加 (SMTP認証のルール) |
| ※ | 行の先頭にスペースが入ると前の行の続きと見なされます。 |
| ※ | 同じ定義を誤って指定した場合、最後に指定されたものが有効になります。(ミスに注意) |
| ※ | Sendmailから乗り換えの場合、mail_spool_directory で今まで使用していたスプール・パスを指定します。「home_mailbox = Mailbox」も一緒に指定してしまうとホームディレクトリの Mailbox にメールが配信され、標準の設定では「mail -f Mailbox」でメールを読むことになり、Windowsのメーラーなどで読み込む事が出来なくなります。(ちょっとはまった) |
| ※ | 上記の smtp_sasl_mechanism_filter の設定値は、私が使っているBIGLOBE用の認証ルールです。 |
| # vi /etc/mail/aliases |
| postfix: root |
| # newaliases |
| # vi /etc/postfix/isp_auth |
| [リレーサーバー]:25 メールアドレス:パスワード |
| # chmod 600 /etc/postfix/isp_auth |
| # postmap /etc/postfix/isp_auth |
| # postfix check |
| # /usr/sbin/postfix start |
| # vi /etc/rc.conf |
| sendmail_enable="YES" |
| sendmail_flags="-bd" |
| sendmail_outbound_enable="NO" |
| sendmail_submit_enable="NO" |
| sendmail_msp_queue_enable="NO" |
| # vi /etc/postfix/main.cf | ||
| disable_vrfy_command = yes | # SMTPのVRFY コマンドを使用不可にする | |
| allow_percent_hack = yes | # 不明なものをリレーしないようにする | |
| swap_bangpath = yes | # 不明なものをリレーしないようにする | |
| smtpd_recipient_restrictions = permit_mynetworks, | # ホスト名やドメイン名で許可されているものだけを受信 | |
| reject_sender_login_mismatch, | ||
| check_relay_domains | ||
| smtpd_sender_restrictions = reject_unknown_sender_domain, | # 実在しないドメイン名からのメールを拒絶 | |
| reject_sender_login_mismatch |
| # telnet relay-test.mail-abuse.org |
| Trying nnn.nnn.nn.nn |
| ・ |
| Connection closed by foreign host. |