FreeBSD 14.3 RELEASE - postfix - SSL/TLS


 クラウディア


1. 概要
2. 証明書の作成
3. 設定
4. 再起動

1. 概要

 「SSL/TLS」の設定を行います。

2. 証明書の作成

 「SSL/TLS」の設定を行うには、証明書が必要です。  証明書は、なんちゃって証明書ではいけません。  無料で証明書を作成するものとするならば、「SSL(Secure Sockets Layer)- SSL 無料証明書(Let's Encrypt)」をご参照ください。  証明書をドメイン名「sub.example.com」で作成したものとして、証明書は。

/usr/local/etc/letsencrypt/live/sub.example.com/
 にあるものとします。

3. 設定

 「root」ユーザ権限で。

vi /usr/local/etc/postfix/main.cf
 末尾に下記を記述します。

# SSL/TLS 設定
smtpd_tls_security_level = may
smtpd_tls_cert_file = /usr/local/etc/letsencrypt/live/sub.example.com/fullchain.pem
smtpd_tls_key_file = /usr/local/etc/letsencrypt/live/sub.example.com/privkey.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_tls_loglevel = 1
 上から順に。  可能であれば、「TLS」を設定。(必須にする場合は、「may」を「encrypt」と記述)  証明書ファイルの定義。  キーファイルの定義。  キャッシュの定義。  ログレベルの定義。(1 はデバッグレベルらしい)

vi /usr/local/etc/postfix/master.cf
 末尾に下記を記述します。

# smtps (465)
smtps     inet  n       -       n       -       -       smtpd
  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes

vi /usr/local/etc/dovecot/conf.d/10-ssl.conf

# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
#ssl = yes

# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
#ssl_cert = </etc/ssl/certs/dovecot.pem
#ssl_key = </etc/ssl/private/dovecot.pem
 上記を下記へ変更します。

# SSL/TLS support: yes, no, required. <doc/wiki/SSL.txt>
ssl = yes

# PEM encoded X.509 SSL/TLS certificate and private key. They're opened before
# dropping root privileges, so keep the key file unreadable by anyone but
# root. Included doc/mkcert.sh can be used to easily generate self-signed
# certificate, just make sure to update the domains in dovecot-openssl.cnf
ssl_cert = </usr/local/etc/letsencrypt/live/sub.example.com/fullchain.pem
ssl_key = </usr/local/etc/letsencrypt/live/sub.example.com/privkey.pem
 編集が終わったら、チェック。

postfix check

doveconf -n

4. 再起動

 設定を反映します。

service postfix restart

service dovecot restart
 ここの後、動作確認を書いておりましたが、消しました。  以降の作業をやってからの方が正しそうです。

audiobook.jp
薬屋の独り言
5G CONNECT
Amazonギフトカード
TikTok Shop 【リピート用プログラム】
earthcar(アースカー)
アフィリエイトのアクセストレード
ハイスピードプラン
健康サポート特集
ベルリッツ
損保との違い
JETBOY
サウンドハウス
【usus ウズウズ】
ネットオークションの相場、統計、価格比較といえばオークファン
葬送のフリーレン Prime Video
EaseUS
U-NEXT
それがだいじWi-Fi