大网数据广告活动
服务器运维问答

How to get dovecot to reload an SSL certificate with minimal impact

· 52CE 我爱测

I have been unable to find any documentation on how to force Dovecot to reread a certificate when its updated. At the moment I'm doing /bin/systemctl restart dovecot Does anyone know if this causes an outage during the restart, o…

问题原文

原帖链接 · davidgo · CC BY-SA 4.0

I have been unable to find any documentation on how to force Dovecot to reread a certificate when its updated.

At the moment I'm doing

 /bin/systemctl restart dovecot

Does anyone know if this causes an outage during the restart, or if dovecot cleanly terminates old sessions and allows new ones to launch with the new config? Can anyone advise the best practice for forcing dovecot to reload its SSL certificate with minimal impact?

社区高分解答

原帖链接 · z0lo · CC BY-SA 4.0

If you're using letsencrypt, you can add a deploy hook to do this automatically when certbot renews your certs. Deploy hooks live in:

/etc/letsencrypt/renewal-hooks/deploy/

Create a file (name doesn't matter - I named mine reload-dovecot) with the following contents:

#!/bin/sh
do
if [ "$domain" = mail.example.com ]
then
systemctl reload dovecot
fi
done

Replace mail.example.com with the actual name of your mail server. Make sure the file is set to be executable.

You may want to create a similar script to reload postfix.

Answer for dovecot taken from here: https://www.xhalford.com/using-hook-scripts-with-certbot/#:~:text=Luckily%2C%20Certbot%20comes%20with%20the,renewal%2Dhooks%2Fdeploy%2F%20.

You can also use certbot itself to create the hooks:

sudo certbot renew --force-renewal --deploy-hook "postfix reload; service dovecot reload"

See thread here: https://community.letsencrypt.org/t/certbot-dovecot-postfix-certificate-renewal-issue/72226/11

Note: the example in the thread uses service postfix reload - this didn't work for me on Ubuntu 20.x.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2021-02-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。