Add SIGHUP handler to reload certs

we have to reload directory server certs out of process
This commit is contained in:
Girish Ramakrishnan
2022-11-16 08:10:57 +01:00
parent 15d5dfd406
commit f82f533f36
3 changed files with 8 additions and 3 deletions

View File

@@ -37,7 +37,6 @@ const acme2 = require('./acme2.js'),
constants = require('./constants.js'),
crypto = require('crypto'),
debug = require('debug')('box:reverseproxy'),
directoryServer = require('./directoryserver.js'),
dns = require('./dns.js'),
domains = require('./domains.js'),
ejs = require('ejs'),
@@ -408,8 +407,8 @@ async function renewCert(fqdn, domainObject) {
// FIXME: this doesn't work across processes. maybe directory server has to become a process of it's own
if (domainObject.domain === settings.dashboardDomain() && getAcmeCertificatePathSync(settings.dashboardFqdn(), domainObject).certFilePath === acmePaths.certFilePath) {
debug('renewCert: directory server certificate changed');
const [restartError] = await safe(directoryServer.handleCertChanged());
if (restartError) debug(`renewCert: error updating directory server on cert change: ${restartError.message}`);
const [reloadError] = await safe(shell.promises.exec('renewCert', 'systemctl reload --no-block box'));
if (reloadError) debug(`renewCert: error updating directory server on cert change: ${reloadError.message}`);
}
}