postfix の変更点   

  • 追加された行はこの色です。
  • 削除された行はこの色です。
  • postfix へ行く。

#author("2021-10-25T23:48:09+00:00","default:pentacle","pentacle")
* install [#ke521ec1]

 yum -y install postfix

複数 mta が入っていた場合
 alternatives --config mta



backscatter対策

''/etc/postfix/main.cf''
 local_recipient_maps =
 luser_relay = devnulluser@domain

 参考
 backscatter対策
 http://www.kobitosan.net/postfix/trans-2.2/jhtml/BACKSCATTER_README.html
 http://wrysmile.blog48.fc2.com/blog-entry-25.html

*** 自動起動 [#e18ab0a0]
 chkconfig postfix on

*** 不正中継テスト [#he071984]
 http://www.rbl.jp/svcheck.php

* メールクライアントを入れる [#u451d271]
 yum -y install mailx

* POPを入れる [#bf946104]

 yum -y install dovecot
 chkconfig dovecot on

*** POPをインターネットに公開しない場合 [#m1f059b7]
''/etc/dovecot/conf.d/10-auth.conf''
 disable_plaintext_auth = no

''/etc/dovecot/conf.d/10-ssl.conf''
 ssl=no


* 他社 SMTP に丸投げ [#e5f733e0]

'' yahooのメールサーバは STARTTLS(587) を閉じた、およびpostfix がTSL未対応のため使えなくなった ''

*** gmail のアカウント [#k6f16dea]
+ gmail アカウントを作成
+ いったんブラウザでログインし、脆弱なクライアントを許可する

*** postfix 側の設定 [#ncf265ed]
 sudo yum install cyrus-sasl-md5
 sudo yum install cyrus-sasl-plain
 sudo yum install cyrus-sasl-devel

''/etc/postfix/main.cf''
 transport_maps = hash:/etc/postfix/transport
 
 smtp_sasl_auth_enable = yes
 smtp_sasl_password_maps = hash:/etc/postfix/password_maps
 smtp_sasl_security_options = noanonymous

''/etc/postfix/transport''
 *       smtp:[smtp.gmail.com]:587

''/etc/postfix/password_maps''
 [smtp.gmail.com]:587     【user】@gmail.com:【password】

 postmap hash:/etc/postfix/transport
 postmap hash:/etc/postfix/password_maps

''password_maps.db が作成されるので、生パスワードが書かれているpassword_mapを閲覧不可か、削除すること''

 service postfix restart

*** from 変更 [#u7974931]
'' /etc/postfix/sender_canonical''
/.+/    username@example.com



* install ubuntu20 [#zadbf52a]
#pre{{

apt install postfix sasl2-bin mailutils

cp /usr/share/postfix/main.cf.dist /etc/postfix/main.cf
postmap hash:/etc/postfix/password_maps


}}



*** main.cf [#z67f8c0f]

AWS用

#pre{{

smtp_tls_security_level = encrypt
meta_directory = /etc/postfix
smtp_tls_note_starttls_offer = yes
smtp_sasl_password_maps = hash:/etc/postfix/password_maps
smtp_sasl_security_options = noanonymous
relayhost = [email-smtp.ap-northeast-1.amazonaws.com]:587
smtp_sasl_auth_enable = yes
smtp_use_tls = yes
mynetworks = localhost, 127.0.0.1

}}


credential はaccess key / secret がもらえるのでそれを記載する

''/etc/postfix/password_maps''

[email-smtp.ap-northeast-1.amazonaws.com]:587 【アクセスキー】:【アクセストークン】
生のパスワードを書いているに等しいので、これを hash 化する

postmap hash:/etc/postfix/password_maps
/etc/postfix/password_maps.db が出来上がり、 postfix はこのファイルを読み来る
/etc/postfix/password_maps は消して置くことを推奨


*** test [#fef245a0]
 mail -r user@gmail.com to@gmail.com