Add cert tests

This commit is contained in:
Girish Ramakrishnan
2018-02-09 10:21:06 -08:00
parent 5140dee81d
commit 5263ea860d
4 changed files with 133 additions and 100 deletions

View File

@@ -137,7 +137,8 @@ function validateCertificate(domain, cert, key) {
if (!cert && key) return new ReverseProxyError(ReverseProxyError.INVALID_CERT, 'missing cert');
if (cert && !key) return new ReverseProxyError(ReverseProxyError.INVALID_CERT, 'missing key');
var result = safe.child_process.execSync('openssl x509 -noout -checkhost "' + domain + '"', { encoding: 'utf8', input: cert });
console.log(`openssl x509 -noout -checkhost "${domain}"`);
var result = safe.child_process.execSync(`openssl x509 -noout -checkhost "${domain}"`, { encoding: 'utf8', input: cert });
if (!result) return new ReverseProxyError(ReverseProxyError.INVALID_CERT, 'Unable to get certificate subject.');
// if no match, check alt names