ubuntuでSMTPサーバの構築(TLSの設定)

postfixtlsを使った通信をできるように設定

基本的な設定についてこちら
http://jsapachehtml.hatenablog.com/entry/2014/01/20/001653

参考ページ
http://www.yam-web.net/ssl/

/etc/postfix/main.cfに以下の設定を追加

smtpd_use_tls = yes                               
smtpd_tls_cert_file = /etc/ssl/certs/myserver.crt 
smtpd_tls_key_file = /etc/ssl/private/myserver.key

465番で待ち受けるように設定(コメントはずすだけ)
/etc/postfix/master.cf

smtps     inet  n       -       -       -       -       smtpd                                 
  -o smtpd_tls_wrappermode=yes                                  
  -o smtpd_sasl_auth_enable=yes                                 
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject 

smtpd_tls_wrappermodeはTLSに対応していないOutlook ExpressOutlook 2002用の設定

サーバの再起動

$ sudo service postfix restart

ポートが開いていること確認

$ netstat -an | grep 465

465番では暗号化していないとしゃべれないため、telnetではなくopensslを使う

openssl s_client -quiet -connect localhost:465
AUTH PLAIN <base64エンコードしたユーザ名・パスワード>
235 2.0.0 Authentication successful