acme: fix http challenge

This commit is contained in:
Girish Ramakrishnan
2021-06-04 17:51:26 -07:00
parent cdbc51b208
commit ee7cddfbbc
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -347,7 +347,7 @@ Acme2.prototype.prepareHttpChallenge = async function (hostname, domain, authori
debug('prepareHttpChallenge: writing %s to %s', keyAuthorization, path.join(acmeChallengesDir, challenge.token));
if (!fs.writeFileSync(path.join(acmeChallengesDir, challenge.token), keyAuthorization)) throw new BoxError(BoxError.FS_ERROR, safe.error);
if (!safe.fs.writeFileSync(path.join(acmeChallengesDir, challenge.token), keyAuthorization)) throw new BoxError(BoxError.FS_ERROR, `Error writing challenge: ${safe.error.message}`);
return challenge;
};
@@ -360,7 +360,7 @@ Acme2.prototype.cleanupHttpChallenge = async function (hostname, domain, challen
debug('cleanupHttpChallenge: unlinking %s', path.join(acmeChallengesDir, challenge.token));
await fs.promises.unlink(path.join(acmeChallengesDir, challenge.token));
if (!safe.fs.unlinkSync(path.join(acmeChallengesDir, challenge.token))) throw new BoxError(BoxError.FS_ERROR, `Error unlinking challenge: ${safe.error.message}`);
};
function getChallengeSubdomain(hostname, domain) {
+1 -1
View File
@@ -101,7 +101,7 @@ function getExpiryDate(certFilePath) {
if (!fs.existsSync(certFilePath)) return null; // not found
const result = safe.child_process.spawnSync('/usr/bin/openssl', [ 'x509', '-enddate', '-noout', certFilePath ]);
const result = safe.child_process.spawnSync('/usr/bin/openssl', [ 'x509', '-enddate', '-noout', '-in', certFilePath ]);
if (!result) return null; // some error
const notAfter = result.stdout.toString('utf8').trim().split('=')[1];