fix: 修复飞牛证书部署后无法生效的bug

v2
xiaojunnuo 2025-10-07 21:01:19 +08:00
parent 53d276a8fc
commit bf156a13bd
1 changed files with 9 additions and 2 deletions

View File

@ -6,7 +6,6 @@ import {
SshAccess,
SshClient
} from "@certd/plugin-lib";
import path from "node:path";
@IsTaskPlugin({
//命名规范,插件类型+功能就是目录plugin-demo中的demo大写字母开头驼峰命名
@ -87,7 +86,9 @@ export class FnOSDeployToNAS extends AbstractTaskPlugin {
this.logger.info(`----------- 找到证书,开始部署:${item.sum},${item.domain}`)
const certPath = item.certificate;
const keyPath = item.privateKey;
const certDir = path.dirname(keyPath)
const certDir = keyPath.substring(0, keyPath.lastIndexOf("/"));
const fullchainPath = certDir+ "/fullchain.crt"
const caPath = certDir+ "/issuer_certificate.crt"
const cmd = `
sudo tee ${certPath} > /dev/null <<'EOF'
${this.cert.crt}
@ -95,6 +96,12 @@ EOF
sudo tee ${keyPath} > /dev/null <<'EOF'
${this.cert.key}
EOF
sudo tee ${fullchainPath} > /dev/null <<'EOF'
${this.cert.crt}
EOF
sudo tee ${caPath} > /dev/null <<'EOF'
${this.cert.ic}
EOF
sudo chmod 0755 "${certDir}/" -R