Fix creating wrong cert type when trying dns

This commit is contained in:
Jamie Curnow
2025-10-27 18:04:29 +10:00
parent 2893ffb1e4
commit e4d9f48870
2 changed files with 23 additions and 14 deletions

View File

@@ -20,6 +20,8 @@ import internalNginx from "./nginx.js";
const letsencryptConfig = "/etc/letsencrypt.ini"; const letsencryptConfig = "/etc/letsencrypt.ini";
const certbotCommand = "certbot"; const certbotCommand = "certbot";
const certbotLogsDir = "/data/logs";
const certbotWorkDir = "/tmp/letsencrypt-lib";
const omissions = () => { const omissions = () => {
return ["is_deleted", "owner.is_deleted"]; return ["is_deleted", "owner.is_deleted"];
@@ -830,18 +832,18 @@ const internalCertificate = {
"--config", "--config",
letsencryptConfig, letsencryptConfig,
"--work-dir", "--work-dir",
"/tmp/letsencrypt-lib", certbotWorkDir,
"--logs-dir", "--logs-dir",
"/tmp/letsencrypt-log", certbotLogsDir,
"--cert-name", "--cert-name",
`npm-${certificate.id}`, `npm-${certificate.id}`,
"--agree-tos", "--agree-tos",
"--authenticator", "--authenticator",
"webroot", "webroot",
"--email", "-m",
email, email,
"--preferred-challenges", "--preferred-challenges",
"dns,http", "http",
"--domains", "--domains",
certificate.domain_names.join(","), certificate.domain_names.join(","),
]; ];
@@ -884,14 +886,16 @@ const internalCertificate = {
"--config", "--config",
letsencryptConfig, letsencryptConfig,
"--work-dir", "--work-dir",
"/tmp/letsencrypt-lib", certbotWorkDir,
"--logs-dir", "--logs-dir",
"/tmp/letsencrypt-log", certbotLogsDir,
"--cert-name", "--cert-name",
`npm-${certificate.id}`, `npm-${certificate.id}`,
"--agree-tos", "--agree-tos",
"--email", "-m",
email, email,
"--preferred-challenges",
"dns",
"--domains", "--domains",
certificate.domain_names.join(","), certificate.domain_names.join(","),
"--authenticator", "--authenticator",
@@ -987,13 +991,13 @@ const internalCertificate = {
"--config", "--config",
letsencryptConfig, letsencryptConfig,
"--work-dir", "--work-dir",
"/tmp/letsencrypt-lib", certbotWorkDir,
"--logs-dir", "--logs-dir",
"/tmp/letsencrypt-log", certbotLogsDir,
"--cert-name", "--cert-name",
`npm-${certificate.id}`, `npm-${certificate.id}`,
"--preferred-challenges", "--preferred-challenges",
"dns,http", "http",
"--no-random-sleep-on-renew", "--no-random-sleep-on-renew",
"--disable-hook-validation", "--disable-hook-validation",
]; ];
@@ -1031,11 +1035,13 @@ const internalCertificate = {
"--config", "--config",
letsencryptConfig, letsencryptConfig,
"--work-dir", "--work-dir",
"/tmp/letsencrypt-lib", certbotWorkDir,
"--logs-dir", "--logs-dir",
"/tmp/letsencrypt-log", certbotLogsDir,
"--cert-name", "--cert-name",
`npm-${certificate.id}`, `npm-${certificate.id}`,
"--preferred-challenges",
"dns",
"--disable-hook-validation", "--disable-hook-validation",
"--no-random-sleep-on-renew", "--no-random-sleep-on-renew",
]; ];
@@ -1068,9 +1074,9 @@ const internalCertificate = {
"--config", "--config",
letsencryptConfig, letsencryptConfig,
"--work-dir", "--work-dir",
"/tmp/letsencrypt-lib", certbotWorkDir,
"--logs-dir", "--logs-dir",
"/tmp/letsencrypt-log", certbotLogsDir,
"--cert-path", "--cert-path",
`${internalCertificate.getLiveCertPath(certificate.id)}/fullchain.pem`, `${internalCertificate.getLiveCertPath(certificate.id)}/fullchain.pem`,
"--delete-after-revoke", "--delete-after-revoke",

View File

@@ -42,6 +42,9 @@ const DNSCertificateModal = EasyModal.create(({ visible, remove }: InnerModalPro
{ {
domainNames: [], domainNames: [],
provider: "letsencrypt", provider: "letsencrypt",
meta: {
dnsChallenge: true,
},
} as any } as any
} }
onSubmit={onSubmit} onSubmit={onSubmit}