easy-devops 1.3.5 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/ui/assets/index-Bu7af-Kj.css +1 -0
- package/dist/ui/assets/index-gndgYe3K.js +532 -0
- package/dist/ui/assets/socket-Bv0wCEgi.js +65 -0
- package/dist/ui/index.html +2 -2
- package/package.json +2 -2
- package/src/cli/index.js +8 -0
- package/src/cli/managers/domain-manager.js +37 -6
- package/src/cli/managers/nginx-manager.js +14 -5
- package/src/cli/managers/node-manager.js +19 -13
- package/src/cli/managers/ssl-manager.js +89 -26
- package/src/cli/menu.js +8 -2
- package/src/cli/menus/cleanup.js +4 -2
- package/src/cli/menus/dashboard.js +22 -15
- package/src/cli/menus/hub.js +381 -0
- package/src/cli/menus/runtime.js +12 -0
- package/src/cli/menus/service.js +28 -10
- package/src/cli/menus/settings.js +46 -12
- package/src/cli/menus/uninstall.js +13 -5
- package/src/cli/menus/update.js +24 -14
- package/src/cli/ui/page.js +123 -0
- package/src/core/cert-operations.js +34 -4
- package/src/core/cert-reader.js +67 -22
- package/src/core/cert-renewal.js +65 -9
- package/src/core/cert-suggest.js +120 -0
- package/src/core/cleanup.js +221 -1
- package/src/core/cloudflare-ips.js +161 -0
- package/src/core/daemon/ipc.js +1 -1
- package/src/core/daemon/lock.js +296 -9
- package/src/core/dashboardProcess.js +134 -6
- package/src/core/deploy/apps.js +36 -62
- package/src/core/deploy/deployKey.js +331 -0
- package/src/core/deploy/domainLink.js +280 -23
- package/src/core/deploy/engine.js +382 -63
- package/src/core/deploy/ezfile.js +496 -29
- package/src/core/deploy/githubApi.js +100 -13
- package/src/core/deploy/hubCommands.js +158 -18
- package/src/core/deploy/status.js +28 -1
- package/src/core/domains-db.js +1 -0
- package/src/core/hub/agent.js +238 -32
- package/src/core/hub/deployProgress.js +411 -0
- package/src/core/hubConnect.js +205 -0
- package/src/core/hubPermissions.js +48 -10
- package/src/core/jobs/bus.js +1 -1
- package/src/core/jobs/owner.js +268 -6
- package/src/core/nginx-conf-generator.js +124 -19
- package/src/core/notifications/claim.js +26 -3
- package/src/core/permissions.js +277 -59
- package/src/core/platform.js +48 -2
- package/src/core/runner.js +96 -40
- package/src/core/ssl/preflight.js +548 -0
- package/src/core/ssl/progress.js +196 -0
- package/src/core/ssl-issuer.js +502 -148
- package/src/core/validators.js +24 -0
- package/src/dashboard/controllers/authController.js +12 -5
- package/src/dashboard/controllers/deploymentsController.js +76 -11
- package/src/dashboard/controllers/domainsController.js +35 -1
- package/src/dashboard/controllers/hubController.js +4 -3
- package/src/dashboard/controllers/settingsController.js +73 -68
- package/src/dashboard/controllers/sslController.js +135 -15
- package/src/dashboard/public/js/app.js +42 -7
- package/src/dashboard/routes/deployments.js +2 -0
- package/src/dashboard/routes/domains.js +1 -0
- package/src/dashboard/server.js +73 -8
- package/src/dashboard/socketManager.js +19 -25
- package/src/dashboard/views/partials/settings-panel.ejs +29 -10
- package/dist/ui/assets/index-BUpPxWmp.css +0 -1
- package/dist/ui/assets/index-DD0JjK0Q.js +0 -475
- package/dist/ui/assets/socket-4tfdap-e.js +0 -65
|
@@ -17,8 +17,9 @@ import path from 'path';
|
|
|
17
17
|
|
|
18
18
|
import { loadConfig } from '../config.js';
|
|
19
19
|
import { findDomain, handleHubDomainCommand } from '../domains-db.js';
|
|
20
|
-
import { validateDomainName } from '../validators.js';
|
|
21
|
-
import {
|
|
20
|
+
import { validateDomainName, validateBoolean, validateBehindCloudflare } from '../validators.js';
|
|
21
|
+
import { findCertificateForDomain, normalizeForMatch, wildcardCovers } from '../cert-suggest.js';
|
|
22
|
+
import { issueCertificate, prepareDomainForHttpChallenge, reloadNginx, describeIssuance, verifyServedCertificate } from '../ssl-issuer.js';
|
|
22
23
|
|
|
23
24
|
import { getApp, setAppDomain } from './apps.js';
|
|
24
25
|
import { readState, releaseDir } from './store.js';
|
|
@@ -43,27 +44,120 @@ export function appPort(app) {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
/** The one wording used for a wildcard certificate request, from the API and the Hub. */
|
|
48
|
+
export const WILDCARD_ISSUE_ERROR =
|
|
49
|
+
'A new wildcard certificate needs DNS validation, which linking does not do. '
|
|
50
|
+
+ 'Issue it from the SSL page, then link with an existing certificate.';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Normalises the `ssl` input. The old boolean is kept: true = issue,
|
|
54
|
+
* false = none. Anything else must be `{ mode, certName? }`.
|
|
55
|
+
*
|
|
56
|
+
* @returns {{ mode: 'none'|'issue'|'existing', certName: string|null } | { error: string }}
|
|
57
|
+
*/
|
|
58
|
+
function parseSslInput(input) {
|
|
59
|
+
if (input === undefined || input === null || input === false) return { mode: 'none', certName: null };
|
|
60
|
+
if (input === true) return { mode: 'issue', certName: null };
|
|
61
|
+
|
|
62
|
+
if (typeof input !== 'object' || Array.isArray(input)) {
|
|
63
|
+
return { error: 'Invalid ssl: use { mode: "none" | "issue" | "existing", certName? } or true/false.' };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const mode = input.mode ?? 'none';
|
|
67
|
+
if (!['none', 'issue', 'existing'].includes(mode)) {
|
|
68
|
+
return { error: 'Invalid ssl.mode: must be "none", "issue" or "existing".' };
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const certName = input.certName === undefined || input.certName === null
|
|
72
|
+
? null
|
|
73
|
+
: String(input.certName).trim().toLowerCase();
|
|
74
|
+
if (mode === 'existing' && !certName) {
|
|
75
|
+
return { error: 'ssl.certName is required when ssl.mode is "existing". Choose a certificate from the suggestion list.' };
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return { mode, certName };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** True when a suggested certificate covers `domain`, wildcards included. */
|
|
82
|
+
function certificateCovers(certificate, domain) {
|
|
83
|
+
const wanted = normalizeForMatch(domain);
|
|
84
|
+
const names = [certificate?.domain, ...(certificate?.names ?? [])]
|
|
85
|
+
.map(normalizeForMatch)
|
|
86
|
+
.filter(Boolean);
|
|
87
|
+
return names.includes(wanted) || names.some((name) => wildcardCovers(name, wanted));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Re-runs the server's own certificate suggestion for every name the link must
|
|
92
|
+
* serve. The caller only names a certificate; the paths ALWAYS come from here.
|
|
93
|
+
*
|
|
94
|
+
* @returns {{ certificate: Object } | { error: string }}
|
|
95
|
+
*/
|
|
96
|
+
async function resolveExistingCertificate(name, www, certName, suggest) {
|
|
97
|
+
const wanted = normalizeForMatch(certName);
|
|
98
|
+
const names = www ? [name, `www.${name}`] : [name];
|
|
99
|
+
const found = [];
|
|
100
|
+
|
|
101
|
+
for (const candidate of names) {
|
|
102
|
+
const suggestion = await suggest(candidate);
|
|
103
|
+
const certificate = suggestion?.found ? suggestion.certificate : null;
|
|
104
|
+
if (!certificate?.certPath || !certificate?.keyPath) {
|
|
105
|
+
return {
|
|
106
|
+
error: `No existing certificate covers ${candidate}. Issue a certificate from the SSL page first, or choose "issue" for this link.`,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (normalizeForMatch(certificate.domain) !== wanted || !certificateCovers(certificate, candidate)) {
|
|
110
|
+
const suggested = certificate.domain ? ` The suggestion for ${candidate} is "${certificate.domain}".` : '';
|
|
111
|
+
return {
|
|
112
|
+
error: `Certificate "${certName}" is not a certificate the server suggests for ${candidate}.${suggested} `
|
|
113
|
+
+ 'Choose one from the suggestion list, or issue a new certificate.',
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
found.push(certificate);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return { certificate: found[0] };
|
|
120
|
+
}
|
|
121
|
+
|
|
46
122
|
/**
|
|
47
123
|
* Links an app to a domain.
|
|
48
124
|
*
|
|
49
125
|
* `domain` may name an existing domain — it is re-pointed at the app — or a
|
|
50
|
-
* new one, which is created.
|
|
51
|
-
*
|
|
52
|
-
*
|
|
126
|
+
* new one, which is created. The optional SSL mode either uses a suggested
|
|
127
|
+
* existing certificate or requests a new one over HTTP-01. The domain and its
|
|
128
|
+
* nginx config are applied first: if issuance then fails the link still
|
|
129
|
+
* stands, over HTTP, and the answer says why.
|
|
53
130
|
*
|
|
54
131
|
* @param {string} appId
|
|
55
|
-
* @param {{ domain: string, ssl?: boolean }
|
|
132
|
+
* @param {{ domain: string, www?: boolean, ssl?: boolean|{mode:string, certName?:string},
|
|
133
|
+
* redirect?: boolean, behindCloudflare?: boolean }} input
|
|
56
134
|
* @param {Object} [deps] Injected collaborators (testing only)
|
|
135
|
+
* @param {(step: string, status: string, detail?: string) => void} [deps.onProgress]
|
|
136
|
+
* Live progress for a Hub command. Absent on the dashboard path.
|
|
57
137
|
* @returns {Promise<{ ok: boolean, status: number, error: string|null,
|
|
58
|
-
* domain?: string, created?: boolean, port?: number,
|
|
138
|
+
* domain?: string, created?: boolean, port?: number, www?: boolean,
|
|
139
|
+
* behindCloudflare?: boolean, ssl?: Object|null, redirect?: boolean,
|
|
140
|
+
* nginxReloaded?: boolean }>}
|
|
59
141
|
*/
|
|
60
|
-
export async function linkDomain(appId,
|
|
142
|
+
export async function linkDomain(appId, input = {}, deps = {}) {
|
|
61
143
|
const {
|
|
62
144
|
domainCommand = handleHubDomainCommand,
|
|
63
145
|
reload = reloadNginx,
|
|
64
146
|
issue = issueCertificate,
|
|
65
147
|
prepare = prepareDomainForHttpChallenge,
|
|
148
|
+
suggest = findCertificateForDomain,
|
|
149
|
+
verify = verifyServedCertificate,
|
|
150
|
+
onProgress = null,
|
|
66
151
|
} = deps;
|
|
152
|
+
const progress = typeof onProgress === 'function' ? onProgress : () => {};
|
|
153
|
+
|
|
154
|
+
const {
|
|
155
|
+
domain,
|
|
156
|
+
www: rawWww,
|
|
157
|
+
ssl: rawSsl,
|
|
158
|
+
redirect: rawRedirect,
|
|
159
|
+
behindCloudflare: rawBehindCloudflare,
|
|
160
|
+
} = input ?? {};
|
|
67
161
|
|
|
68
162
|
const app = getApp(appId);
|
|
69
163
|
if (!app) return { ok: false, status: 404, error: `No app named "${appId}".` };
|
|
@@ -72,6 +166,31 @@ export async function linkDomain(appId, { domain, ssl = false } = {}, deps = {})
|
|
|
72
166
|
const nameError = validateDomainName(name);
|
|
73
167
|
if (nameError) return { ok: false, status: 400, error: nameError };
|
|
74
168
|
|
|
169
|
+
const www = rawWww === undefined || rawWww === null ? false : rawWww;
|
|
170
|
+
const wwwError = validateBoolean(www, 'www');
|
|
171
|
+
if (wwwError) return { ok: false, status: 400, error: wwwError };
|
|
172
|
+
|
|
173
|
+
const behindCloudflare = rawBehindCloudflare === undefined || rawBehindCloudflare === null
|
|
174
|
+
? false
|
|
175
|
+
: rawBehindCloudflare;
|
|
176
|
+
const cloudflareError = validateBehindCloudflare(behindCloudflare);
|
|
177
|
+
if (cloudflareError) return { ok: false, status: 400, error: cloudflareError };
|
|
178
|
+
|
|
179
|
+
const sslInput = parseSslInput(rawSsl);
|
|
180
|
+
if (sslInput.error) return { ok: false, status: 400, error: sslInput.error };
|
|
181
|
+
const { mode: sslMode, certName } = sslInput;
|
|
182
|
+
|
|
183
|
+
if (sslMode === 'issue' && name.startsWith('*.')) {
|
|
184
|
+
return { ok: false, status: 400, error: WILDCARD_ISSUE_ERROR };
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
let redirect = false;
|
|
188
|
+
if (sslMode !== 'none') {
|
|
189
|
+
const redirectError = validateBoolean(rawRedirect, 'redirect');
|
|
190
|
+
if (redirectError) return { ok: false, status: 400, error: redirectError };
|
|
191
|
+
redirect = rawRedirect === undefined || rawRedirect === null ? true : rawRedirect;
|
|
192
|
+
}
|
|
193
|
+
|
|
75
194
|
const port = appPort(app);
|
|
76
195
|
if (!port) {
|
|
77
196
|
return {
|
|
@@ -81,21 +200,112 @@ export async function linkDomain(appId, { domain, ssl = false } = {}, deps = {})
|
|
|
81
200
|
};
|
|
82
201
|
}
|
|
83
202
|
|
|
203
|
+
// An existing certificate is resolved BEFORE anything is written, so a
|
|
204
|
+
// forged or non-covering certName cannot leave a half-linked domain behind.
|
|
205
|
+
let existingCertificate = null;
|
|
206
|
+
if (sslMode === 'existing') {
|
|
207
|
+
const resolved = await resolveExistingCertificate(name, www, certName, suggest);
|
|
208
|
+
if (resolved.error) return { ok: false, status: 400, error: resolved.error };
|
|
209
|
+
existingCertificate = resolved.certificate;
|
|
210
|
+
}
|
|
211
|
+
|
|
84
212
|
const existing = findDomain(name);
|
|
213
|
+
const record = {
|
|
214
|
+
port,
|
|
215
|
+
backendHost: '127.0.0.1',
|
|
216
|
+
www,
|
|
217
|
+
behindCloudflare,
|
|
218
|
+
};
|
|
219
|
+
if (existingCertificate) {
|
|
220
|
+
record.ssl = {
|
|
221
|
+
enabled: true,
|
|
222
|
+
certPath: existingCertificate.certPath,
|
|
223
|
+
keyPath: existingCertificate.keyPath,
|
|
224
|
+
redirect,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
progress('domain', 'running');
|
|
85
229
|
const result = existing
|
|
86
|
-
? await domainCommand({ action: 'update', name, domain:
|
|
87
|
-
: await domainCommand({ action: 'create', domain: { name,
|
|
230
|
+
? await domainCommand({ action: 'update', name, domain: record })
|
|
231
|
+
: await domainCommand({ action: 'create', domain: { name, ...record } });
|
|
88
232
|
|
|
89
|
-
if (!result?.ok)
|
|
233
|
+
if (!result?.ok) {
|
|
234
|
+
const error = result?.error ?? 'nginx rejected the configuration.';
|
|
235
|
+
progress('domain', 'failed', error);
|
|
236
|
+
return { ok: false, status: 500, error };
|
|
237
|
+
}
|
|
90
238
|
|
|
91
239
|
setAppDomain(appId, name);
|
|
240
|
+
progress('domain', 'ok');
|
|
92
241
|
|
|
93
|
-
let reloaded =
|
|
242
|
+
let reloaded = null;
|
|
94
243
|
let sslResult = null;
|
|
95
244
|
|
|
96
|
-
if (
|
|
97
|
-
|
|
245
|
+
if (sslMode === 'issue') {
|
|
246
|
+
// The HTTP config must be live before the ACME challenge is attempted.
|
|
247
|
+
// This reload belongs to the certificate step; the final one is reported
|
|
248
|
+
// as its own `nginx reload` stage below.
|
|
249
|
+
reloaded = await reload();
|
|
250
|
+
sslResult = await requestCertificate(name, {
|
|
251
|
+
www, redirect, domainCommand, issue, prepare, onProgress: progress,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
progress('nginx config test', 'running');
|
|
98
255
|
if (sslResult.ok) reloaded = await reload();
|
|
256
|
+
const reloadDetail = reloaded?.ok ? undefined : 'nginx reload failed';
|
|
257
|
+
progress('nginx config test', reloaded?.ok ? 'ok' : 'failed', reloadDetail);
|
|
258
|
+
progress('nginx reload', 'running');
|
|
259
|
+
progress('nginx reload', reloaded?.ok ? 'ok' : 'failed', reloadDetail);
|
|
260
|
+
|
|
261
|
+
if (!sslResult.ok) {
|
|
262
|
+
progress('https verified', 'skipped', 'no new certificate to verify');
|
|
263
|
+
} else if (behindCloudflare || sslResult.preflight?.proxied) {
|
|
264
|
+
progress('https verified', 'skipped', "served by Cloudflare's edge");
|
|
265
|
+
} else {
|
|
266
|
+
progress('https verified', 'running');
|
|
267
|
+
try {
|
|
268
|
+
const checked = await verify(name, sslResult.certPath);
|
|
269
|
+
progress('https verified', checked?.ok ? 'ok' : 'failed', checked?.ok ? undefined : checked?.message);
|
|
270
|
+
} catch (err) {
|
|
271
|
+
progress('https verified', 'failed', String(err.message).split('\n')[0]);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
} else {
|
|
275
|
+
if (existingCertificate) {
|
|
276
|
+
progress('https', 'running');
|
|
277
|
+
sslResult = {
|
|
278
|
+
mode: 'existing',
|
|
279
|
+
ok: true,
|
|
280
|
+
detail: `Using the existing certificate "${existingCertificate.domain}".`,
|
|
281
|
+
certName: existingCertificate.domain,
|
|
282
|
+
certPath: existingCertificate.certPath,
|
|
283
|
+
};
|
|
284
|
+
progress('https', 'ok', sslResult.detail);
|
|
285
|
+
} else {
|
|
286
|
+
progress('https', 'skipped');
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
progress('nginx config test', 'running');
|
|
290
|
+
reloaded = await reload();
|
|
291
|
+
const reloadDetail = reloaded?.ok ? undefined : 'nginx reload failed';
|
|
292
|
+
progress('nginx config test', reloaded?.ok ? 'ok' : 'failed', reloadDetail);
|
|
293
|
+
progress('nginx reload', 'running');
|
|
294
|
+
progress('nginx reload', reloaded?.ok ? 'ok' : 'failed', reloadDetail);
|
|
295
|
+
|
|
296
|
+
if (!existingCertificate) {
|
|
297
|
+
progress('https verified', 'skipped', 'no certificate was requested');
|
|
298
|
+
} else if (behindCloudflare) {
|
|
299
|
+
progress('https verified', 'skipped', "served by Cloudflare's edge");
|
|
300
|
+
} else {
|
|
301
|
+
progress('https verified', 'running');
|
|
302
|
+
try {
|
|
303
|
+
const checked = await verify(name, existingCertificate.certPath);
|
|
304
|
+
progress('https verified', checked?.ok ? 'ok' : 'failed', checked?.ok ? undefined : checked?.message);
|
|
305
|
+
} catch (err) {
|
|
306
|
+
progress('https verified', 'failed', String(err.message).split('\n')[0]);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
99
309
|
}
|
|
100
310
|
|
|
101
311
|
return {
|
|
@@ -105,40 +315,87 @@ export async function linkDomain(appId, { domain, ssl = false } = {}, deps = {})
|
|
|
105
315
|
domain: name,
|
|
106
316
|
created: !existing,
|
|
107
317
|
port,
|
|
318
|
+
www,
|
|
319
|
+
behindCloudflare,
|
|
108
320
|
ssl: sslResult,
|
|
321
|
+
redirect,
|
|
109
322
|
nginxReloaded: Boolean(reloaded?.ok),
|
|
110
323
|
};
|
|
111
324
|
}
|
|
112
325
|
|
|
113
326
|
/** Requests a certificate for a freshly linked domain and switches the domain to HTTPS. */
|
|
114
|
-
async function requestCertificate(name, { domainCommand, issue, prepare }) {
|
|
327
|
+
async function requestCertificate(name, { www, redirect, domainCommand, issue, prepare, onProgress = null }) {
|
|
328
|
+
const progress = typeof onProgress === 'function' ? onProgress : () => {};
|
|
115
329
|
const config = loadConfig();
|
|
116
330
|
if (!config.acmeEmail) {
|
|
117
|
-
|
|
331
|
+
const detail = 'No certificate was requested: set an ACME email in Settings first.';
|
|
332
|
+
progress('account and order', 'failed', detail);
|
|
333
|
+
progress('https', 'skipped');
|
|
334
|
+
return { mode: 'issue', ok: false, detail };
|
|
118
335
|
}
|
|
119
336
|
|
|
337
|
+
let stage = 'challenge ready';
|
|
120
338
|
try {
|
|
121
339
|
const record = findDomain(name);
|
|
122
340
|
const prepared = await prepare(record);
|
|
123
|
-
if (!prepared.ok)
|
|
341
|
+
if (!prepared.ok) {
|
|
342
|
+
progress('challenge ready', 'failed', `Could not prepare nginx for the challenge: ${prepared.error}`);
|
|
343
|
+
progress('https', 'skipped');
|
|
344
|
+
return { mode: 'issue', ok: false, detail: `Could not prepare nginx for the challenge: ${prepared.error}` };
|
|
345
|
+
}
|
|
124
346
|
|
|
125
|
-
const issued = await issue(name, {
|
|
347
|
+
const issued = await issue(name, {
|
|
348
|
+
validationMethod: 'http',
|
|
349
|
+
email: config.acmeEmail,
|
|
350
|
+
www: Boolean(www),
|
|
351
|
+
// The link reports nginx test/reload/verify itself, after the domain
|
|
352
|
+
// record has been switched to the new certificate paths.
|
|
353
|
+
manageNginx: false,
|
|
354
|
+
onProgress: progress,
|
|
355
|
+
});
|
|
126
356
|
if (!issued.success) {
|
|
127
357
|
const cause = String(issued.error?.cause ?? 'The certificate could not be issued.').split('\n')[0];
|
|
128
|
-
|
|
358
|
+
progress('https', 'skipped');
|
|
359
|
+
return {
|
|
360
|
+
mode: 'issue',
|
|
361
|
+
ok: false,
|
|
362
|
+
detail: `${cause} The domain works over HTTP; issue the certificate from the SSL page once its DNS points here.`,
|
|
363
|
+
};
|
|
129
364
|
}
|
|
130
365
|
|
|
366
|
+
stage = 'https';
|
|
367
|
+
progress('https', 'running');
|
|
131
368
|
const updated = await domainCommand({
|
|
132
369
|
action: 'update',
|
|
133
370
|
name,
|
|
134
|
-
domain: { ssl: { enabled: true, certPath: issued.certPath, keyPath: issued.keyPath } },
|
|
371
|
+
domain: { ssl: { enabled: true, certPath: issued.certPath, keyPath: issued.keyPath, redirect } },
|
|
135
372
|
});
|
|
136
373
|
if (!updated?.ok) {
|
|
137
|
-
|
|
374
|
+
progress('https', 'failed', `nginx rejected the HTTPS config: ${updated?.error ?? 'unknown error'}`);
|
|
375
|
+
return {
|
|
376
|
+
mode: 'issue',
|
|
377
|
+
ok: false,
|
|
378
|
+
detail: `The certificate was issued, but nginx rejected the HTTPS config: ${updated?.error ?? 'unknown error'}`,
|
|
379
|
+
};
|
|
138
380
|
}
|
|
139
|
-
|
|
381
|
+
progress('https', 'ok');
|
|
382
|
+
return {
|
|
383
|
+
mode: 'issue',
|
|
384
|
+
ok: true,
|
|
385
|
+
detail: describeIssuance(issued) || 'Certificate issued.',
|
|
386
|
+
certName: name,
|
|
387
|
+
certPath: issued.certPath,
|
|
388
|
+
keyPath: issued.keyPath,
|
|
389
|
+
preflight: issued.preflight,
|
|
390
|
+
};
|
|
140
391
|
} catch (err) {
|
|
141
|
-
|
|
392
|
+
if (stage === 'https') {
|
|
393
|
+
progress('https', 'failed', err.message);
|
|
394
|
+
} else {
|
|
395
|
+
progress('challenge ready', 'failed', err.message);
|
|
396
|
+
progress('https', 'skipped');
|
|
397
|
+
}
|
|
398
|
+
return { mode: 'issue', ok: false, detail: `The certificate could not be issued: ${err.message}` };
|
|
142
399
|
}
|
|
143
400
|
}
|
|
144
401
|
|