Skip to content

Commit e4d9f48

Browse files
committed
Fix creating wrong cert type when trying dns
1 parent 2893ffb commit e4d9f48

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

backend/internal/certificate.js

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import internalNginx from "./nginx.js";
2020

2121
const letsencryptConfig = "/etc/letsencrypt.ini";
2222
const certbotCommand = "certbot";
23+
const certbotLogsDir = "/data/logs";
24+
const certbotWorkDir = "/tmp/letsencrypt-lib";
2325

2426
const omissions = () => {
2527
return ["is_deleted", "owner.is_deleted"];
@@ -830,18 +832,18 @@ const internalCertificate = {
830832
"--config",
831833
letsencryptConfig,
832834
"--work-dir",
833-
"/tmp/letsencrypt-lib",
835+
certbotWorkDir,
834836
"--logs-dir",
835-
"/tmp/letsencrypt-log",
837+
certbotLogsDir,
836838
"--cert-name",
837839
`npm-${certificate.id}`,
838840
"--agree-tos",
839841
"--authenticator",
840842
"webroot",
841-
"--email",
843+
"-m",
842844
email,
843845
"--preferred-challenges",
844-
"dns,http",
846+
"http",
845847
"--domains",
846848
certificate.domain_names.join(","),
847849
];
@@ -884,14 +886,16 @@ const internalCertificate = {
884886
"--config",
885887
letsencryptConfig,
886888
"--work-dir",
887-
"/tmp/letsencrypt-lib",
889+
certbotWorkDir,
888890
"--logs-dir",
889-
"/tmp/letsencrypt-log",
891+
certbotLogsDir,
890892
"--cert-name",
891893
`npm-${certificate.id}`,
892894
"--agree-tos",
893-
"--email",
895+
"-m",
894896
email,
897+
"--preferred-challenges",
898+
"dns",
895899
"--domains",
896900
certificate.domain_names.join(","),
897901
"--authenticator",
@@ -987,13 +991,13 @@ const internalCertificate = {
987991
"--config",
988992
letsencryptConfig,
989993
"--work-dir",
990-
"/tmp/letsencrypt-lib",
994+
certbotWorkDir,
991995
"--logs-dir",
992-
"/tmp/letsencrypt-log",
996+
certbotLogsDir,
993997
"--cert-name",
994998
`npm-${certificate.id}`,
995999
"--preferred-challenges",
996-
"dns,http",
1000+
"http",
9971001
"--no-random-sleep-on-renew",
9981002
"--disable-hook-validation",
9991003
];
@@ -1031,11 +1035,13 @@ const internalCertificate = {
10311035
"--config",
10321036
letsencryptConfig,
10331037
"--work-dir",
1034-
"/tmp/letsencrypt-lib",
1038+
certbotWorkDir,
10351039
"--logs-dir",
1036-
"/tmp/letsencrypt-log",
1040+
certbotLogsDir,
10371041
"--cert-name",
10381042
`npm-${certificate.id}`,
1043+
"--preferred-challenges",
1044+
"dns",
10391045
"--disable-hook-validation",
10401046
"--no-random-sleep-on-renew",
10411047
];
@@ -1068,9 +1074,9 @@ const internalCertificate = {
10681074
"--config",
10691075
letsencryptConfig,
10701076
"--work-dir",
1071-
"/tmp/letsencrypt-lib",
1077+
certbotWorkDir,
10721078
"--logs-dir",
1073-
"/tmp/letsencrypt-log",
1079+
certbotLogsDir,
10741080
"--cert-path",
10751081
`${internalCertificate.getLiveCertPath(certificate.id)}/fullchain.pem`,
10761082
"--delete-after-revoke",

frontend/src/modals/DNSCertificateModal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ const DNSCertificateModal = EasyModal.create(({ visible, remove }: InnerModalPro
4242
{
4343
domainNames: [],
4444
provider: "letsencrypt",
45+
meta: {
46+
dnsChallenge: true,
47+
},
4548
} as any
4649
}
4750
onSubmit={onSubmit}

0 commit comments

Comments
 (0)