mail serverとしての設定にミスがありました。
それも致命的なものです。
なんと証明書が期限切れでした。
倉庫に新しく購入した証明書セットがあったので、それに差し替えました。つまり差し替えをしていなかったんですね。
序でにdovecotのconf.d/10-ssl.confとpostfixのmain.cfの証明書のpathを一致させ(今まで2か所で管理していた、理由は判らん)て、一つに纏め管理し易いようにしました。
そして、keyとcertのセットが正しいことを確認。
|
1 2 |
sudo openssl x509 -noout -modulus -in /opt/local/etc/ssl/certs/server.crt | openssl md5 sudo openssl rsa -noout -modulus -in /opt/local/etc/ssl/private/server.key | openssl md5 |
結果は
MD5(stdin)= 5f240b9153d4dd8595c32ea1ff47f9e3
で一致。(一致すると正しいペアであると証明できるらしい)
続けてopensslによるサーバー証明書が正しく読み込まれているか確認をします。
postfixの証明書の確認をします。
|
1 2 3 4 5 6 7 8 9 10 11 |
openssl s_client -connect mail.k-in.co.jp:587 -starttls smtp | openssl x509 -noout -dates Connecting to 192.168.0.35 depth=2 C=GB, O=Sectigo Limited, CN=Sectigo Public Server Authentication Root R46 verify return:1 depth=1 C=JP, O=Nijimo, Inc., CN=FujiSSL RSA Domain Validation Secure Server CA 2 verify return:1 depth=0 CN=mail.k-in.co.jp verify return:1 250 CHUNKING notBefore=Nov 28 00:00:00 2025 GMT notAfter=Dec 29 23:59:59 2026 GMT |
dovecotの証明書(同じものだけれど)の確認。
|
1 2 3 4 5 6 7 8 9 10 11 12 |
openssl s_client -connect mail.k-in.co.jp:993 | openssl x509 -noout -dates Connecting to 192.168.0.35 depth=0 CN=mail.k-in.co.jp verify error:num=20:unable to get local issuer certificate verify return:1 depth=0 CN=mail.k-in.co.jp verify error:num=21:unable to verify the first certificate verify return:1 depth=0 CN=mail.k-in.co.jp verify return:1 notBefore=Nov 28 00:00:00 2025 GMT notAfter=Dec 29 23:59:59 2026 GMT |
|
1 2 3 |
dovecotが上手くCA fileを読めないようなので対応することにした。 /opt/local/etc/ssl/certs/内の2つのファイルを合体させる。 <pre class="height:300 lang:default decode:true" title="">cat server.crt server-ca.crt | tee bundle.crt > /dev/null |
で、これをcertとして読み込み、caは読まないように変更。
postfix側はこれ。
|
1 2 |
smtpd_tls_cert_file = /opt/local/etc/ssl/certs/bundle.crt #smtpd_tls_CAfile = /opt/local/etc/ssl/certs/server-ca.crt |
dovecot側はこう。
|
1 |
ssl_cert = </opt/local/etc/ssl/certs/bundle.crt |
postfix、dovecotをreloadする。
その結果、dovecotも問題なく正常な返事をよこした。
|
1 2 3 4 5 6 7 8 9 10 |
openssl s_client -connect mail.k-in.co.jp:993 | openssl x509 -noout -dates Connecting to 192.168.0.35 depth=2 C=GB, O=Sectigo Limited, CN=Sectigo Public Server Authentication Root R46 verify return:1 depth=1 C=JP, O=Nijimo, Inc., CN=FujiSSL RSA Domain Validation Secure Server CA 2 verify return:1 depth=0 CN=mail.k-in.co.jp verify return:1 notBefore=Nov 28 00:00:00 2025 GMT notAfter=Dec 29 23:59:59 2026 GM |
おまけでapache2の証明書の確認。
|
1 2 3 4 5 6 7 8 9 10 |
openssl s_client -connect www.k-in.co.jp:443 | openssl x509 -noout -dates Connecting to 192.168.0.35 depth=2 C=GB, O=Sectigo Limited, CN=Sectigo Public Server Authentication Root R46 verify return:1 depth=1 C=JP, O=Nijimo, Inc., CN=FujiSSL RSA Domain Validation Secure Server CA 2 verify return:1 depth=0 CN=www.k-in.co.jp verify return:1 notBefore=Nov 28 00:00:00 2025 GMT notAfter=Dec 29 23:59:59 2026 GMT |
今日はこんなところで。

