mailcow使用自己的SSL证书(二)

这是mailcow自建邮局系列的第二篇教程,出于网络传输安全考虑,有必要对邮局启用TLS/SSL加密,这时候就需要用到SSL证书。

mailcow自动申请SSL证书

mailcow部署完毕后会自动使用ACME申请SSL证书,但前提是您使用的默认WEB端口80(Let’s Encrypt验证需要),如果非默认端口,则无法申请。也或者其它原因(如网络原因)可能导致申请失败。
由于磊大并未使用默认的80端口,因此就无法使用mailcow的自动SSL证书申请,我们也可以自行申请SSL证书后部署到mailcow,这样更加靠谱。
申请SSL证书
上一篇文章提到,如果您主机名设置为mail.domain.com,那么去申请SSL证书的时候也需要用这个域名(注意是二级域名,不是顶级域名),申请SSL证书这篇文章不做详细介绍。目前腾讯云、阿里云均提供免费的DV SSL证书,可以参考:

使用自己的SSL证书

磊大使用的是腾讯云免费SSL证书,申请完毕后下载Nginx的格式保存到本地。里面应该有4个文件,不过我们只会用到.crt.key这两个后缀结尾的文件。

然后将.crt后缀的文件命名为cert.pem,将.key后缀的文件命名为key.pem并上传到mailcow目录下的data/assets/ssl目录进行替换。

注意:替换前可以将原来的文件备份,另外不要使用软连接。

然后修改mailcown.conf这个配置文件,将:

SKIP_LETS_ENCRYPT=n

修改为

SKIP_LETS_ENCRYPT=y

最后重启受影响的3个容器:

docker restart $(docker ps -qaf name=postfix-mailcow)
docker restart $(docker ps -qaf name=nginx-mailcow)
docker restart $(docker ps -qaf name=dovecot-mailcow)

验证

输入下面的命令查看和验证SSL证书是否有效:

# 验证SMTP TLS端口
echo "Q" | openssl s_client -starttls smtp -crlf -connect mail.domain.com:587
#验证IMAP端口
echo "Q" | openssl s_client -starttls imap -showcerts -connect mail.domain.com:143
#验证HTTPS
echo "Q" | openssl s_client -connect mail.domain.com:443

注意:请将mail.domain.com改成你自己的域名。

sanradar
sanradar
文章: 104

73 评论

  1. Great read! The depth and clarity of your analysis are impressive. If anyone is interested in diving deeper into this subject, check out this link: DISCOVER MORE. Looking forward to everyone’s thoughts!

  2. You really make it seem really easy along with your presentation however I find this topic to be actually
    one thing that I think I would by no means understand. It sort
    of feels too complex and very large for me. I am looking ahead for your
    subsequent post, I will try to get the dangle of it!

    Najlepsze escape roomy

  3. Having read this I thought it was really enlightening. I appreciate you spending some time and effort to put this short article together. I once again find myself spending way too much time both reading and posting comments. But so what, it was still worthwhile!

  4. An outstanding share! I’ve just forwarded this onto a colleague who had been conducting a little homework on this. And he actually bought me lunch because I discovered it for him… lol. So allow me to reword this…. Thanks for the meal!! But yeah, thanks for spending the time to talk about this matter here on your website.

  5. Nice post. I learn something totally new and challenging on websites I stumbleupon every day. It’s always interesting to read content from other authors and practice a little something from their sites.

  6. I would like to thank you for the efforts you’ve put in writing this blog. I am hoping to view the same high-grade content by you later on as well. In truth, your creative writing abilities has inspired me to get my own website now 😉

  7. Aw, this was an exceptionally good post. Taking a few minutes and actual effort to produce a very good article… but what can I say… I put things off a whole lot and don’t manage to get nearly anything done.

  8. That is a great tip especially to those new to the blogosphere. Simple but very precise information… Thank you for sharing this one. A must read article.

  9. This is the perfect site for everyone who really wants to find out about this topic. You know a whole lot its almost tough to argue with you (not that I really will need to…HaHa). You certainly put a brand new spin on a subject that has been written about for decades. Excellent stuff, just excellent.

  10. Having read this I believed it was very informative. I appreciate you spending some time and effort to put this article together. I once again find myself personally spending a lot of time both reading and leaving comments. But so what, it was still worthwhile!

  11. I’m extremely pleased to uncover this web site. I wanted to thank you for your time just for this fantastic read!! I definitely loved every little bit of it and I have you book marked to check out new information in your web site.

  12. I have to thank you for the efforts you’ve put in writing this website. I am hoping to check out the same high-grade blog posts by you later on as well. In fact, your creative writing abilities has inspired me to get my own, personal website now 😉

  13. After looking at a handful of the blog posts on your web site, I truly like your way of writing a blog. I book-marked it to my bookmark website list and will be checking back in the near future. Please check out my web site as well and tell me your opinion.

  14. Hi, I do think this is a great site. I stumbledupon it 😉 I’m going to come back once again since i have book marked it. Money and freedom is the best way to change, may you be rich and continue to guide other people.

  15. This is a great tip particularly to those fresh to the blogosphere. Simple but very precise information… Appreciate your sharing this one. A must read post.

  16. Hello, There’s no doubt that your site could possibly be having internet browser compatibility issues. Whenever I look at your website in Safari, it looks fine however, when opening in Internet Explorer, it’s got some overlapping issues. I merely wanted to give you a quick heads up! Aside from that, excellent website.

  17. Hello there! I just want to offer you a huge thumbs up for your great information you have got here on this post. I’ll be coming back to your site for more soon.

  18. After looking at a number of the articles on your web site, I honestly appreciate your way of blogging. I added it to my bookmark webpage list and will be checking back soon. Please check out my website too and tell me what you think.

  19. Hi, I do think this is a great blog. I stumbledupon it 😉 I am going to return once again since I bookmarked it. Money and freedom is the best way to change, may you be rich and continue to help others.

  20. Your style is really unique in comparison to other folks I have read stuff from. Thank you for posting when you have the opportunity, Guess I’ll just book mark this site.

  21. Your style is unique in comparison to other folks I have read stuff from. Many thanks for posting when you’ve got the opportunity, Guess I’ll just book mark this web site.

  22. May I simply say what a relief to discover somebody that actually knows what they are discussing on the internet. You actually know how to bring an issue to light and make it important. More people ought to look at this and understand this side of the story. I was surprised that you aren’t more popular because you most certainly have the gift.

  23. Hi! Do you know if they make any plugins to assist with SEO?
    I’m trying to get my site to rank for some targeted keywords but I’m not seeing very good results.
    If you know of any please share. Many thanks! I saw similar
    blog here: Bij nl

  24. May I just say what a comfort to uncover somebody who genuinely understands what they’re talking about on the net. You actually understand how to bring an issue to light and make it important. More people should look at this and understand this side of your story. It’s surprising you are not more popular since you most certainly have the gift.

  25. You made some decent points there. I checked on the web to learn more about the issue and found most individuals will go along with your views on this site.

  26. I’m impressed, I have to admit. Seldom do I come across a blog that’s both educative and engaging, and without a doubt, you’ve hit the nail on the head. The problem is an issue that not enough folks are speaking intelligently about. Now i’m very happy that I came across this in my search for something concerning this.

  27. You need to take part in a contest for one of the most useful websites online. I most certainly will highly recommend this website!

  28. I seriously love your blog.. Very nice colors & theme. Did you build this site yourself? Please reply back as I’m hoping to create my own site and would love to learn where you got this from or what the theme is called. Thank you!

  29. Having read this I believed it was really informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way too much time both reading and posting comments. But so what, it was still worthwhile.

  30. An interesting discussion is worth comment. There’s no doubt that that you should write more on this subject matter, it might not be a taboo subject but typically people don’t discuss these subjects. To the next! Cheers!

  31. Having read this I believed it was extremely enlightening. I appreciate you spending some time and effort to put this short article together. I once again find myself spending a significant amount of time both reading and commenting. But so what, it was still worthwhile!

  32. Hi there! This post could not be written any better! Going through this post reminds me of my previous roommate! He continually kept preaching about this. I’ll send this post to him. Pretty sure he’ll have a good read. Thanks for sharing!

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注