Merge pull request #1021 from limetech/fix/provisioncert

fix: provision cert issues
This commit is contained in:
tom mortensen
2022-02-16 16:14:24 -08:00
committed by GitHub

View File

@@ -46,7 +46,7 @@ $isRegistered = !empty($remote) && !empty($remote['username']);
$certPresent = file_exists($certPath);
if ($certPresent) {
// renew existing cert
$subject = exec("/usr/bin/openssl x509 -subject -noout -in ".escapeshellarg($certPath));
$certSubject = exec("/usr/bin/openssl x509 -subject -noout -in ".escapeshellarg($certPath));
$isLegacyCert = preg_match('/.*\.unraid\.net$/', $certSubject);
$isWildcardCert = preg_match('/.*\.myunraid\.net$/', $certSubject);
if ($isLegacyCert || $isWildcardCert) {
@@ -57,7 +57,7 @@ if ($certPresent) {
}
} else {
// assume custom cert
response_complete(406, '{"error":"'._('Cannot renew a custom cert at').' $certPath"}');
response_complete(406, '{"error":"'._('Cannot renew a custom cert at').' '.$certPath.'"}');
}
} else {
// provision new cert
@@ -69,7 +69,7 @@ $endpoint = ($certPresent && $isLegacyCert) ? "provisioncert" : "provisionwildca
$keyfile = @file_get_contents($var['regFILE']);
if ($keyfile === false) {
response_complete(406, '{"error":"'.('License key required').'"}');
response_complete(406, '{"error":"'._('License key required').'"}');
}
$keyfile = @base64_encode($keyfile);
$ethX = 'eth0';