修复
This commit is contained in:
+12
-4
@@ -310,15 +310,23 @@ class AcmeService:
|
||||
|
||||
try:
|
||||
cert = x509.load_pem_x509_certificate(cert_path.read_bytes())
|
||||
# 兼容新旧版本 cryptography 库
|
||||
not_before = getattr(cert, "not_valid_before_utc", None) or cert.not_valid_before
|
||||
not_after = getattr(cert, "not_valid_after_utc", None) or cert.not_valid_after
|
||||
try:
|
||||
san = [name.value for name in cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value]
|
||||
except Exception:
|
||||
san = []
|
||||
return {
|
||||
"subject": cert.subject.rfc4514_string(),
|
||||
"issuer": cert.issuer.rfc4514_string(),
|
||||
"not_before": cert.not_valid_before_utc.isoformat(),
|
||||
"not_after": cert.not_valid_after_utc.isoformat(),
|
||||
"not_before": not_before.isoformat(),
|
||||
"not_after": not_after.isoformat(),
|
||||
"serial_number": str(cert.serial_number),
|
||||
"san": [name.value for name in cert.extensions.get_extension_for_class(x509.SubjectAlternativeName).value],
|
||||
"san": san,
|
||||
}
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
logger.error(f"解析证书失败 {cert_path}: {e}")
|
||||
return None
|
||||
|
||||
def auto_renew_all(self, domains: list[Domain]) -> list[dict]:
|
||||
|
||||
Reference in New Issue
Block a user