主机名与服务器证书不匹配(Let's Encrypt)

您好,我在 Discourse 安装后无法收到激活邮件。

我的操作流程如下:

目前我没有邮件服务器,因此希望在同一台机器上同时运行邮件服务器和 Discourse。我决定使用 docker-mailserver。我从一家德国供应商处订购了一台 VPS,并使用了一个不再使用的 Namecheap 域名。
由于不希望该域名公开,我在下文中将其替换为“domain.com”。希望这样没问题。

  1. 邮件服务器:我安装了邮件服务器,使用 setup.sh 创建了一些邮箱地址,生成了 DKIM 密钥,并在我的 DNS 提供商处为其创建了 TXT 记录。我使用 Thunderbird 测试了这些邮箱,能够正常收发邮件。Telnet 也返回了 220 状态码,一切似乎正常。
    以下是 DNS 记录的截图


    SSL-Tools 结果
    Imgur: The magic of the Internet

  2. Discourse:我按照 Docker 初学者安装指南 安装了 Discourse。
    我运行了 discourse-setup 并输入了以下信息:

    Hostname      : domain.com
    Email         : dun@domain.com
    SMTP address  : domain.com
    SMTP port     : 587
    SMTP username : discourse@domain.com
    SMTP password : ABCDEFG123
    LETSENCRYPT_ACCOUNT_EMAIL: tls@domain.com
    

随后,我尝试向 dun@domain.com 发送激活链接,但从未收到。

dun@server:~$ tail /var/discourse/shared/standalone/log/rails/production.log 

Sent mail to dun@domain.com (69.5ms)
Job exception: hostname "domain.com" does not match the server certificate

Sent mail to dun@domain.com (61.3ms)
Job exception: hostname "domain.com" does not match the server certificate

Sent mail to dun@domain.com (22.8ms)
Job exception: hostname "domain.com" does not match the server certificate

我不完全理解这条错误信息的含义,因为这是我第一次配置 TLS。我猜测是因为我为邮件服务器使用了不同的证书。如何让两个容器使用相同的证书?

This is an issue with the mail server certificate. You can probably get one with Let’s Encrypt, but it’s not a problem with Discourse, so ask for help from the docker-mailserver people. If you want people to receive your mail and not to spend a long long time getting your mail server trusted, you’ll be better off using a mail service like Mailgun.

1 个赞

Thanks for your reply.
I guess I understand it a little bit better now. With my configuration Discourse already created the LE certificate while installing. The next step to get this running would be using that certificate on my mailserver which seems to be kinda tricky. At least I didn’t found anyone mentioning a process like this. I searched for pem files in the Docker VM and found them in /etc/ssl/certs and in ruby-folders under /usr/local/lib and /var/www/discourse/vendor. But I don’t really know if I could just copy them to the virtual machine that’s running the mailserver.

So the conclusion is, that it’s not possible to make this setup run without having more knowledge about TLS.