do string compare in certs

This commit is contained in:
Girish Ramakrishnan
2022-11-30 09:54:35 +01:00
parent 7e1c56161d
commit 15cc624fa5
2 changed files with 4 additions and 2 deletions

View File

@@ -813,7 +813,7 @@ async function restartMailIfActivated() {
async function handleCertChanged() {
debug('handleCertChanged: will restart if activated');
const certificate = await reverseProxy.getMailCertificate();
const cert = safe.fs.readFileSync(`${paths.MAIL_CONFIG_DIR}/tls_cert.pem`);
const cert = safe.fs.readFileSync(`${paths.MAIL_CONFIG_DIR}/tls_cert.pem`, { encoding: 'utf8' });
if (cert === certificate.cert) {
debug('handleCertChanged: certificate has not changed');
return;
@@ -1009,6 +1009,7 @@ async function onDomainAdded(domain) {
if (!settings.mailFqdn()) return; // mail domain is not set yet (when provisioning)
debug('onDomainAdded: configuring mail for added domain');
await upsertDnsRecords(domain, settings.mailFqdn());
await restartMailIfActivated();
}
@@ -1016,6 +1017,7 @@ async function onDomainAdded(domain) {
async function onDomainRemoved(domain) {
assert.strictEqual(typeof domain, 'string');
debug('onDomainRemoved: configuring mail for removed domain');
await restartMail();
}