From 6d9013e9fd80b81394302523e7f1e8368111ed44 Mon Sep 17 00:00:00 2001 From: sans Date: Mon, 20 Jul 2026 10:47:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=97=E5=AE=BD=E5=BA=A6/?= =?UTF-8?q?=E4=B8=8D=E6=98=BE=E7=A4=BA=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/acme_service.py | 18 ++++++++++++++++++ frontend/src/views/AcmeSettings.vue | 8 ++++---- frontend/src/views/Domains.vue | 19 ++++++++++++++----- frontend/src/views/Servers.vue | 8 ++++---- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/backend/acme_service.py b/backend/acme_service.py index 196c5dc..09aa519 100644 --- a/backend/acme_service.py +++ b/backend/acme_service.py @@ -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 diff --git a/frontend/src/views/AcmeSettings.vue b/frontend/src/views/AcmeSettings.vue index 3f13d9f..2e59836 100644 --- a/frontend/src/views/AcmeSettings.vue +++ b/frontend/src/views/AcmeSettings.vue @@ -7,17 +7,17 @@ - + - + - +