@@ -107,9 +107,13 @@ function getExpiryDate(certFilePath) {
|
||||
return notAfterDate;
|
||||
}
|
||||
|
||||
// We used to check for the must-staple in the cert using openssl x509 -text -noout -in ${certFilePath} | grep -q status_request
|
||||
// however, we cannot set the must-staple because first request to nginx fails because of it's OCSP caching behavior
|
||||
function hasOCSPUriSync(certFilePath) {
|
||||
async function isOcspEnabled(certFilePath) {
|
||||
// on some servers, OCSP does not work. see #796
|
||||
const config = await settings.getReverseProxyConfig();
|
||||
if (!config.ocsp) return false;
|
||||
|
||||
// We used to check for the must-staple in the cert using openssl x509 -text -noout -in ${certFilePath} | grep -q status_request
|
||||
// however, we cannot set the must-staple because first request to nginx fails because of it's OCSP caching behavior
|
||||
const result = safe.child_process.execSync(`openssl x509 -in ${certFilePath} -noout -ocsp_uri`, { encoding: 'utf8' });
|
||||
return result && result.length > 0; // no error and has uri
|
||||
}
|
||||
@@ -444,7 +448,7 @@ async function writeDashboardNginxConfig(bundle, configFileName, vhost) {
|
||||
keyFilePath: bundle.keyFilePath,
|
||||
robotsTxtQuoted: JSON.stringify('User-agent: *\nDisallow: /\n'),
|
||||
proxyAuth: { enabled: false, id: null, location: nginxLocation('/') },
|
||||
ocsp: hasOCSPUriSync(bundle.certFilePath)
|
||||
ocsp: await isOcspEnabled(bundle.certFilePath)
|
||||
};
|
||||
const nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data);
|
||||
const nginxConfigFilename = path.join(paths.NGINX_APPCONFIG_DIR, configFileName);
|
||||
@@ -503,7 +507,7 @@ async function writeAppNginxConfig(app, fqdn, bundle) {
|
||||
location: nginxLocation(safe.query(app.manifest, 'addons.proxyAuth.path') || '/')
|
||||
},
|
||||
httpPaths: app.manifest.httpPaths || {},
|
||||
ocsp: hasOCSPUriSync(bundle.certFilePath)
|
||||
ocsp: await isOcspEnabled(bundle.certFilePath)
|
||||
};
|
||||
const nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data);
|
||||
|
||||
@@ -536,7 +540,7 @@ async function writeAppRedirectNginxConfig(app, fqdn, bundle) {
|
||||
cspQuoted: null,
|
||||
hideHeaders: [],
|
||||
proxyAuth: { enabled: false, id: app.id, location: nginxLocation('/') },
|
||||
ocsp: hasOCSPUriSync(bundle.certFilePath)
|
||||
ocsp: await isOcspEnabled(bundle.certFilePath)
|
||||
};
|
||||
const nginxConf = ejs.render(NGINX_APPCONFIG_EJS, data);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user