1.ssl用ディレクトリを作成します。
# mkdir /etc/postfix/ssl
2.セルフサインの証明書をsslディレクトリにコピーします。
# cp /etc/pki/tls/certs/Makefile /etc/postfix/ssl
3.sslディレクトリに移動します。
# cd /etc/postfix/ssl
4.postfix用のMakefileを作成します。
# sed -i 's/^KEY=.*/KEY=example.co.jp.key/' Makefile
# sed -i 's/^CSR=.*/CSR=example.co.jp.csr/' Makefile
# sed -i 's/^CRT=.*/CRT=example.co.jp.crt/' Makefile
# sed -i 's/-days 365/-days 3650/g' Makefile
5.サーバ用の秘密鍵をの作成します。
# openssl genrsa 1024 > example.co.jp.key
6.Makefileをコンパイルします。
# make testcert
7.適宜、パラメータを入力します。(以下は入力例)
Country Name (2 letter code) [GB]:JP
State or Province Name (full name) [Berkshire]:Tokyo
Locality Name (eg, city) [Newbury]:Nakano-Ku
Organization Name (eg, company) [My Company Ltd]:Rewse Lab.
Organizational Unit Name (eg, section) []: [Enter]
Common Name (eg, your name or your server's hostname) []:example.co.jp
Email Address []:[Enter]
8.クライアントマシンに登録する証明書を作成します。
# openssl x509 -in example.co.jp.crt -outform der -out example.co.jp.der
9./etc/postfix/main.cf にTLS用パラメータを追記します。
smtpd_use_tls = yes
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/postfix/ssl/example.co.jp.crt
smtpd_tls_key_file = /etc/postfix/ssl/example.co.jp.key
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
tls_random_source = dev:/dev/urandom
10./etc/postfix/master.cf を開き、以下、行頭の#を削除して保存します。
smtps inet n - n - - smtpd
11. CRAM-MD5認証用のアカウントとパスワードを作成します。
# saslpasswd2 -u example.co.jp アカウント名
Password:(パスワード)
Again (for verification):(パスワード)
12.postfix を再起動します。
# service postfix stop
# service postfix start
サーバー側の設定が完了後、以下のとおり、自己署名したサーバー証明書をクライアントに登録します。
1.Windowsの場合はFTPソフトにて example.co.jp.der ファイルをPCにコピーします。
2.コピーしたファイルをダブルクリックし、[証明書のインストール…]ボタンをクリックすると「証明書インポートウィザード」が表示されます。
3.「証明書をすべて次のストアに配置する」の「信頼されたルート証明機関」を選択し、[次へ]ボタンをクリックします。