fix: activation to acm issue

Raikhelkar committed Jun 13, 2023 at 16:17 UTC 43c16d02f9c5538c1dbc9459eaeff5a4a250d8bd
1 file changed +4 -3
certoperations.js
+4 -3
@@ -85,8 +85,8 @@ module.exports.CertificateOperations = function (parent) {
85 var signkey = null, certChain = null, hashAlgo = null, certIndex = null;
86 for (var i in domain.amtacmactivation.certs) {
87 const certEntry = domain.amtacmactivation.certs[i];
88 - if ((certEntry.sha256 == request.hash) && ((certEntry.cn == '*') || checkAcmActivationCertName(certEntry.cn, request.fqdn))) { hashAlgo = 'sha256'; signkey = certEntry.key; certChain = certEntry.certs; certIndex = i; break; }
89 - if ((certEntry.sha1 == request.hash) && ((certEntry.cn == '*') || checkAcmActivationCertName(certEntry.cn, request.fqdn))) { hashAlgo = 'sha1'; signkey = certEntry.key; certChain = certEntry.certs; certIndex = i; break; }
88 + if ((certEntry.sha256 == request.hash) && ((certEntry.cn == '*') || checkAcmActivationCertName(certEntry.cn, request.fqdn))) { hashAlgo = certEntry.hashAlgorithm; signkey = certEntry.key; certChain = certEntry.certs; certIndex = i; break; }
89 + if ((certEntry.sha1 == request.hash) && ((certEntry.cn == '*') || checkAcmActivationCertName(certEntry.cn, request.fqdn))) { hashAlgo = certEntry.hashAlgorithm; signkey = certEntry.key; certChain = certEntry.certs; certIndex = i; break; }
90 }
91 if (signkey == null) return { 'action': 'acmactivate', 'error': 2, 'errorText': "Can't sign ACM request, no signing certificate found." }; // Did not find a match.
92
@@ -262,7 +262,8 @@ module.exports.CertificateOperations = function (parent) {
262 acmconfig.cn = certCommonName.value;
263 }
264 }
265 -
265 + acmconfig.hashAlgorithm = r.certs[0].md.algorithm;
266 +
267 delete acmconfig.cert;
268 delete acmconfig.certpass;
269 acmconfig.certs = orderedCerts;