debian 9のexim4でTLSの致命的な警告が受信されました

debian 9のexim4でTLSの致命的な警告が受信されました

メールを送信するようにサーバーを設定しようとしていますが、メールを送信しようとするたびに「TLS 致命的アラート」エラーが表示されます。

私は以下の手順に従いましたこの郵便受け私の問題に関連して、問題を克服しようとしましたが、最終的に私が説明したエラーが発生します。

apt install gnutls-bin
cd /etc/exim4/
certtool --generate-privkey --outfile exim.key
certtool --generate-request --load-privkey exim.key --outfile exim.csr
  • 通称: gestiondecorreos.es

  • 残りは空白のままにします(入力)

  • URL:http://www.cacert.org/

  • CACertにログイン => 「サーバー証明書」をクリック => 新規

  • 証明書要求を貼り付けるように求められます。exim.csr ファイルの内容を貼り付けます。

  • CACert はホスト名の確認を求めます。

  • その後、結果のWebページに証明書が表示されます。証明書をexim.crtという名前の新しいファイルに保存します。

    cd /etc/exim4/ chgrp Debian-exim exim.key chmod g+r exim.key vim /etc/exim4/conf.d/main/000_local (新しいファイル)

  • 中に挿入します:

    MAIN_LOG_SELECTOR=+tls_cipher +tls_peerdn MAIN_TLS_ENABLE=t

    update-exim4.conf /etc/init.d/exim4 再起動

tls でメール サーバーに接続しようとします:

gnutls-cli -s -p 587 gestiondecorreos.es
ehlo gestiondecorreos.es
starttls
^D (ctr+d)
  • エラー結果:

*** Starting TLS handshake
- Certificate type: X.509
- Got a certificate list of 1 certificates.
- Certificate[0] info:
 - subject `EMAIL=eguz*****@gmail.com,CN=server.example.com,OU=IT,O=Vesta Control Panel,L=San Francisco,ST=California,C=US', issuer `EMAIL=eguz*****@gmail.com,CN=server.example.com,OU=IT,O=Vesta Control Panel,L=San Francisco,ST=California,C=US', serial 0x0086e738bec1714309, RSA key 4096 bits, signed using RSA-SHA256, activated `2020-02-04 15:42:00 UTC', expires `2021-02-03 15:42:00 UTC', key-ID `sha256:6095e39dc286060d74d300f494814744d803ad2f5c55587ca38a2d7ed2b58194'
   Public Key ID:
      sha1:5f4b******************
      sha256:6095****************
   Public key's random art:
      +--[ RSA 4096]----+
      |        ..o    .o|
      |       .   o   +.|
      *******************
      |             .oo.|
      +-----------------+

- Status: The certificate is NOT trusted. The certificate issuer is unknown. The name in the certificate does not match the expected.
*** PKI verification of server certificate failed...
*** Fatal error: Error in the certificate.
*** Handshake has failed

なぜ件名のように CN=server.example.com が表示されるのか分かりません。

/var/log/exim4/mainlog ファイルには次のように記載されています:

TLS error on connection from lixxxxxx.members.linode.com ([127.0.0.1]) [xxxxxxxxxxx] (gnutls_handshake): A TLS fatal alert has been received.

私の linode-vps では、メイン ドメインは gestiondecorreos.es で、orbelanet.com は SMTP テストを実行している別のドメインです。

よろしくお願いします!ミケル

答え1

試みられた解決策:

  • ホスト名を変更します (vestacp 内): (サーバー => gestiondecorreos.es、サーバー内のメイン ドメイン):

    /usr/local/vesta/bin/v-change-sys-hostname gestiondecorreos.es

  • gestiondecorreos.es にletsencryptをインストールします。

/usr/local/vesta/bin/v-add-letsencrypt-domain 'admin' gestiondecorreos.es '' 'yes'

  • 前の手順でインストールした SSL 証明書を vesta、exim、dovecot に適用します。

/usr/local/vesta/bin/v-update-host-certificate admin gestiondecorreos.es

  • /usr/local/vesta/conf/vesta.conf に "update_hostname_ssl='yes'" を追加します。

    echo "UPDATE_HOSTNAME_SSL='yes'" >> /usr/local/vesta/conf/vesta.conf

これは、SSLが更新されるたびに、Vesta、Exim、dovecotデーモンへのSSLを更新するようにVestaに指示します。これは自動的に行われます。

ソリューション

  • 前の手順で、、およびファイルを再作成し、今度は tls メール サービス テストを実行すると、exim.keyエラーexim.csrexim.crt発生gnutls-cli -s -p 587 gestiondecorreos.esせず、すべて正常です。

  • しかし、新しいメールを送信しようとすると、次のエラーが発生します。

    H=lixxxxxxxx.linode.com ([127.0.0.1]) [172.xxxxxxxxxx] X=TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128 CV=no rejected MAIL <xxxx@xxxxxxxx>: Helo name contains a ip address (HELO was [127.0.0.1]) and not is valid

  • 解決策としては、/etc/exim4/exim4.conf で次の行を無効にし続けることです。

\# deny condition = ${if eq{$sender_helo_name}{}}
\# message = HELO required before MAIL

\# drop message = Helo name contains a ip address (HELO was $sender_helo_name) and not is valid
\# condition = ${if match{$sender_helo_name}{\N((\d{1,3}[.-]\d{1,3}[.-]\d{1,3}[.-]\d{1,3})|([0-9a-f]{8})|([0-9A-F]{8}))\N}{yes}{no}}
\# condition = ${if match {${lookup dnsdb{>: defer_never,ptr=$sender_host_address}}\}{$sender_helo_name}{no}{yes}}
\# delay = 45s

\# drop condition = ${if isip{$sender_helo_name}}
\# message = Access denied - Invalid HELO name (See RFC2821 4.1.3)
  • exim4を再起動します:

    service exim4 restart

そして今では問題なくメールを送信できます!

関連情報