这是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
改成你自己的域名。
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!
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
I like this web site very much, Its a rattling nice place to read and
obtain info.?
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!
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.
Very good post! We will be linking to this particularly great content on our website. Keep up the good writing.
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.
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 😉
This is a topic which is close to my heart… Cheers! Exactly where can I find the contact details for questions?
It’s nearly impossible to find educated people about this subject, but you sound like you know what you’re talking about! Thanks
Spot on with this write-up, I really feel this amazing site needs a lot more attention. I’ll probably be returning to read through more, thanks for the advice.
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.
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.
Pretty! This was an extremely wonderful article. Many thanks for supplying this info.
Pretty! This has been an incredibly wonderful article. Thanks for supplying this info.
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.
I love looking through a post that can make people think. Also, many thanks for allowing for me to comment.
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!
Very good article. I will be going through a few of these issues as well..
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.
I was able to find good advice from your articles.
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 😉
Excellent write-up. I absolutely appreciate this site. Continue the good work!
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.
Everyone loves it when folks come together and share views. Great website, stick with it!
This is a topic which is near to my heart… Best wishes! Exactly where are your contact details though?
This site definitely has all the info I needed about this subject and didn’t know who to ask.
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.
You ought to be a part of a contest for one of the best blogs on the web. I will recommend this website!
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.
I couldn’t refrain from commenting. Very well written.
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.
I like looking through an article that will make men and women think. Also, thanks for allowing me to comment.
Good web site you’ve got here.. It’s difficult to find quality writing like yours these days. I seriously appreciate people like you! Take care!!
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.
I needed to thank you for this great read!! I absolutely enjoyed every little bit of it. I’ve got you saved as a favorite to check out new stuff you post…
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.
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.
Way cool! Some very valid points! I appreciate you penning this write-up and also the rest of the website is also really good.
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.
I love it when people come together and share opinions. Great blog, stick with it.
I love reading a post that will make people think. Also, many thanks for permitting me to comment.
This blog was… how do you say it? Relevant!! Finally I have found something which helped me. Thanks.
Excellent article. I will be facing some of these issues as well..
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.
Good article. I certainly love this website. Keep it up!
Great post. I will be experiencing many of these issues as well..
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.