Postfix と Dovecot のそれぞれで、SSL (TLS) を使用した通信経路の暗号化ができるようにします。
これはつまり、SMTPS (Postfix) と POP3S (Dovecot) のプロトコルをサポートをするということです。
これによって、STARTTLS コマンドによる暗号化も可能になります(SSL/TLSとSTARTTRSの違いは使用するポート番号)。
まずは
電子証明書の公開鍵と秘密鍵を作成する。
電子証明書の公開鍵と秘密鍵を作るのには openssl コマンドを対話的に使用しますが、これは前回の課題で行いました。
次に
Postfix 用の公開鍵と秘密鍵を使って SSL をサポートするように Postfix の設定を修正します。
修正する設定ファイルは /etc/postfix/main.cf ファイルと /etc/postfix/master.cf ファイルの2つとなります。
# vi /etc/postfix/main.cf 最後に以下の設定を追加します。
(公開鍵と秘密鍵のファイル名と格納場所に注意)
# TLS parameters
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem
smtpd_tls_key_file = /etc/pki/tls/private/postfix.key
smtpd_tls_security_level = may
# vi /etc/postfix/master.cf 以下のコメントを外します。
[root@cs7sv31 private]# cat /etc/postfix/master.cf
#
# Postfix master process configuration file. For details on the format
# of the file, see the master(5) manual page (command: "man 5 master").
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (yes) (never) (100)
# ==========================================================================
smtp inet n - n - - smtpd
#smtp inet n - n - 1 postscreen
#smtpd pass - - n - - smtpd
#dnsblog unix - - n - 0 dnsblog
#tlsproxy unix - - n - 0 tlsproxy
#submission inet n - n - - smtpd
# -o syslog_name=postfix/submission
# -o smtpd_tls_security_level=encrypt
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
smtps inet n - n - - smtpd ← ここ
# -o syslog_name=postfix/smtps
-o smtpd_tls_wrappermode=yes ← ここ
# -o smtpd_sasl_auth_enable=yes
# -o smtpd_reject_unlisted_recipient=no
# -o smtpd_client_restrictions=$mua_client_restrictions
# -o smtpd_helo_restrictions=$mua_helo_restrictions
# -o smtpd_sender_restrictions=$mua_sender_restrictions
# -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
# -o milter_macro_daemon_name=ORIGINATING
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
最後に postfix を再起動して修正は終了です。
# systemctl restart postfix.service
メールクライアントから「SMTPS」あるいは「SMTP+STARTTLS」で送受信してみます。