2014年11月22日土曜日

OP25BとSubmission587

OP25B対策には以下の2種類がある

(1)実験サーバSMTPサーバ(SMTP構内)から外部へ送信する場合
(2)外部(たとえばPlala構内)から実験サーバSMTPサーバ(SMTP構内)に接続(メールを受けとるという意味では受信)する場合

(1)に対する対策

/etc/postfix/main.cfに書きを追加

relayhost = [smtp.poem.ocn.ne.jp]

これは,外部へ送信する場合,OCNのメールサーバを中継する設定である。

(2)に対する対策

①cyrus-saslのインストール

# /usr/sbin/postconf -a
cyrus
dovecot

# sudo rpm -qa | grep cyrus-sasl
cyrus-sasl-2.1.22-7.el5_8.1
cyrus-sasl-lib-2.1.22-7.el5_8.1
cyrus-sasl-plain-2.1.22-7.el5_8.1

# sudo yum -y install cyrus-sasl-md5
# sudo yum -y install cyrus-sasl-plain

# sudo rpm -qa | grep cyrus-sasl
cyrus-sasl-2.1.22-7.el5_8.1
cyrus-sasl-lib-2.1.22-7.el5_8.1
cyrus-sasl-plain-2.1.22-7.el5_8.1
cyrus-sasl-md5-2.1.22-7.el5_8.1

②パスワードの設定

# sudo /usr/sbin/saslpasswd2 -c -u some.domain.jp userAccount

# /usr/sbin/sasldblistusers2
userAccount@some.domain.jp: userPassword

※削除する場合
# sudo /usr/sbin/saslpasswd2 -d -u some.domai.jp userAccount

③データベースのオーナーをpostfixに変更

# sudo chown postfix /etc/sasldb2

④Postfixの設定(SMTP AUTHの設定)

$ sudo vim /etc/postfix/main.cf
# SMTP AUTH
smtpd_sasl_auth_enable=yes
smtpd_sasl_local_domain=$mydomain
smtpd_recipient_restrictions=
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_destination
smtpd_sasl_security_options=noanonymous,noplaintext

⑤確認テスト

# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 kumw-hinfo.ddo.jp ESMTP Postfix
EHLO localhost
250-kumw-hinfo.ddo.jp
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-AUTH DIGEST-MD5 CRAM-MD5
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN

【参考】

OP25B対策(Outbound Port 25 Blocking対策)
http://www.aconus.com/~oyaji/mail2/op25b.htm

⑥Submission587の設定

/etc/postfix/master.cf

# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#submission inet n       -       n       -       -       smtpd
#  -o smtpd_enforce_tls=yes
#  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

  ↓

submission inet n      -       n       -       -       smtpd
  -o smtpd_etrn_restrictions=reject
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

⑦ファイアウォールの設定(port587に穴を開ける)

/etc/sysconfig/iptables
-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 587 -j ACCEPT

/etc/postfix/main.cf
mynetworks = xxx.xxx.xxx.xxx/32, 127.0.0.0/8, xxx.xxx.xxx.xxx/32

【参考】
Postfix + Cyrus SASL で SMTP AUTH を設定した
http://www.1x1.jp/blog/2012/10/postfix_and_cyrus_sasl2_stmp_auth.html

0 件のコメント:

コメントを投稿