Merge pull request #1477 from unraid/remove-legacy-certs

remove support for legacy unraid.net certs
This commit is contained in:
tom mortensen
2023-10-26 12:41:02 -07:00
committed by GitHub
3 changed files with 20 additions and 39 deletions

View File

@@ -47,9 +47,8 @@ $certPresent = file_exists($certPath);
if ($certPresent) {
// renew existing cert
$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) {
if ($isWildcardCert) {
exec("/usr/bin/openssl x509 -checkend 2592000 -noout -in ".escapeshellarg($certPath), $arrout, $retval_expired);
if ($retval_expired === 0) {
// not within 30 days of cert expire date
@@ -60,7 +59,6 @@ if ($certPresent) {
response_complete(406, '{"error":"'._('Cannot renew a custom cert at').' '.$certPath.'"}');
}
}
$endpoint = ($certPresent && $isLegacyCert) ? "provisioncert" : "provisionwildcard";
$keyfile = empty($var['regFILE']) ? false : @file_get_contents($var['regFILE']);
if ($keyfile === false) {
@@ -68,7 +66,7 @@ if ($keyfile === false) {
}
$keyfile = @base64_encode($keyfile);
$ch = curl_init("https://keys.lime-technology.com/account/ssl/$endpoint");
$ch = curl_init("https://keys.lime-technology.com/account/ssl/provisionwildcard");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, [