reverseproxy: notify cert change only in cron job
notifying this in ensureCertificate does not work if provider changed in the middle anyway. might as well get them to be in sync in the cronjob. this change also resulted in tls addon getting restarted non-stop if you change from wildcard to non-wildcard since ensureCertificate notifies the change.
This commit is contained in:
+4
-5
@@ -32,7 +32,7 @@ exports = module.exports = {
|
||||
|
||||
startMail,
|
||||
restartMail,
|
||||
handleCertChanged,
|
||||
checkCertificate,
|
||||
getMailAuth,
|
||||
|
||||
sendTestMail,
|
||||
@@ -812,15 +812,14 @@ async function restartMailIfActivated() {
|
||||
await restartMail();
|
||||
}
|
||||
|
||||
async function handleCertChanged() {
|
||||
debug('handleCertChanged: will restart if activated');
|
||||
async function checkCertificate() {
|
||||
const certificate = await reverseProxy.getMailCertificate();
|
||||
const cert = safe.fs.readFileSync(`${paths.MAIL_CONFIG_DIR}/tls_cert.pem`, { encoding: 'utf8' });
|
||||
if (cert === certificate.cert) {
|
||||
debug('handleCertChanged: certificate has not changed');
|
||||
debug('checkCertificate: certificate has not changed');
|
||||
return;
|
||||
}
|
||||
debug('handleCertChanged: certificate has changed');
|
||||
debug('checkCertificate: certificate has changed');
|
||||
|
||||
await restartMailIfActivated();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user