修复列宽度/不显示过期时间的问题
This commit is contained in:
@@ -267,6 +267,19 @@ class AcmeService:
|
||||
cert_info = {}
|
||||
if success:
|
||||
cert_path = domain_dir / "fullchain.pem"
|
||||
logger.info(f"证书路径: {cert_path}, 存在: {cert_path.exists()}")
|
||||
# 如果自定义路径没有,尝试从 certbot live 目录复制
|
||||
if not cert_path.exists():
|
||||
import shutil
|
||||
certbot_live = self.cert_dir / ".certbot-config" / "live" / store_dir
|
||||
src = certbot_live / "fullchain.pem"
|
||||
logger.info(f"尝试从 certbot live 复制: {src}, 存在: {src.exists()}")
|
||||
if src.exists():
|
||||
shutil.copy2(str(src), str(cert_path))
|
||||
key_src = certbot_live / "privkey.pem"
|
||||
if key_src.exists():
|
||||
shutil.copy2(str(key_src), str(domain_dir / "private.key"))
|
||||
|
||||
if cert_path.exists():
|
||||
try:
|
||||
cert_data = cert_path.read_bytes()
|
||||
@@ -287,9 +300,14 @@ class AcmeService:
|
||||
"issuer": cert.issuer.rfc4514_string(),
|
||||
}
|
||||
msg = f"签发成功,过期时间: {not_after.strftime('%Y-%m-%d %H:%M:%S')}, SAN: {san}"
|
||||
logger.info(msg)
|
||||
return True, msg, cert_info, output
|
||||
except Exception as e:
|
||||
logger.error(f"解析证书失败: {e}")
|
||||
return True, f"签发成功但解析证书失败: {e}", cert_info, output
|
||||
else:
|
||||
logger.error(f"证书文件不存在: {cert_path}")
|
||||
return True, f"certbot 成功但未找到证书文件: {cert_path}", cert_info, output
|
||||
|
||||
return success, output, cert_info, output
|
||||
|
||||
|
||||
Reference in New Issue
Block a user