diff --git a/src/cloudron.js b/src/cloudron.js index 0a654f9e0..1cb6a7ed2 100644 --- a/src/cloudron.js +++ b/src/cloudron.js @@ -318,7 +318,7 @@ async function setupDnsAndCert(subdomain, domain, auditSource, progressCallback) if (ipv6) await dns.waitForDnsRecord(subdomain, domain, 'AAAA', ipv6, { interval: 30000, times: 50000 }); progressCallback({ percent: 60, message: `Getting certificate of ${dashboardFqdn}` }); const location = { subdomain, domain, fqdn: dashboardFqdn, type: apps.LOCATION_TYPE_DASHBOARD, certificate: null }; - await reverseProxy.ensureCertificate(location, auditSource); + await reverseProxy.ensureCertificate(location, {}, auditSource); } async function syncDnsRecords(options) { diff --git a/src/reverseproxy.js b/src/reverseproxy.js index 4d8df22bf..b710c17b9 100644 --- a/src/reverseproxy.js +++ b/src/reverseproxy.js @@ -378,8 +378,9 @@ async function writeCertificate(location) { return { certFilePath, keyFilePath }; } -async function ensureCertificate(location, auditSource) { +async function ensureCertificate(location, options, auditSource) { assert.strictEqual(typeof location, 'object'); + assert.strictEqual(typeof options, 'object'); assert.strictEqual(typeof auditSource, 'object'); const domainObject = await domains.get(location.domain); @@ -402,7 +403,7 @@ async function ensureCertificate(location, auditSource) { const cert = await blobs.getString(`${blobs.CERT_PREFIX}-${certName}.cert`); if (key && cert) { - if (providerMatchesSync(domainObject, cert) && !needsRenewalSync(cert)) { + if (!options.forceRenewal && providerMatchesSync(domainObject, cert) && !needsRenewalSync(cert)) { // force is for e2e debug(`ensureCertificate: ${fqdn} acme cert exists and is up to date`); return; } @@ -547,7 +548,7 @@ async function configureApp(app, auditSource) { const locations = getAppLocationsSync(app); for (const location of locations) { - await ensureCertificate(location, auditSource); + await ensureCertificate(location, {}, auditSource); } await writeAppConfigs(app); @@ -625,7 +626,7 @@ async function checkCerts(options, auditSource, progressCallback) { for (const location of locations) { percent += Math.round(100/locations.length); progressCallback({ percent, message: `Ensuring certs of ${location.fqdn}` }); - await ensureCertificate(location, auditSource); + await ensureCertificate(location, options, auditSource); } if (options.rebuild || fs.existsSync(paths.REVERSE_PROXY_REBUILD_FILE)) {