roster-server 2.1.24 → 2.1.26
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/index.js +26 -6
- package/package.json +1 -1
- package/vendor/acme-dns-01-cli-wrapper.js +6 -13
package/index.js
CHANGED
|
@@ -777,14 +777,34 @@ class Roster {
|
|
|
777
777
|
|
|
778
778
|
const isBunRuntime = typeof Bun !== 'undefined' || process.release?.name === 'bun';
|
|
779
779
|
if (isBunRuntime && this.wildcardZones.size > 0) {
|
|
780
|
+
const retryDelayMs = Number.isFinite(Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_RETRY_MS))
|
|
781
|
+
? Math.max(1000, Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_RETRY_MS))
|
|
782
|
+
: 30000;
|
|
783
|
+
const maxAttempts = Number.isFinite(Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_MAX_ATTEMPTS))
|
|
784
|
+
? Math.max(0, Number(process.env.ROSTER_BUN_WILDCARD_PREWARM_MAX_ATTEMPTS))
|
|
785
|
+
: 0; // 0 = retry forever
|
|
786
|
+
|
|
780
787
|
for (const zone of this.wildcardZones) {
|
|
781
788
|
const bootstrapHost = `bun-bootstrap.${zone}`;
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
789
|
+
const attemptPrewarm = async (attempt = 1) => {
|
|
790
|
+
try {
|
|
791
|
+
log.warn(`⚠️ Bun runtime detected: prewarming wildcard certificate via ${bootstrapHost} (attempt ${attempt})`);
|
|
792
|
+
await greenlockRuntime.get({ servername: bootstrapHost });
|
|
793
|
+
log.info(`✅ Bun wildcard prewarm succeeded for ${zone} on attempt ${attempt}`);
|
|
794
|
+
} catch (error) {
|
|
795
|
+
log.warn(`⚠️ Bun wildcard prewarm failed for ${zone} (attempt ${attempt}): ${error?.message || error}`);
|
|
796
|
+
if (maxAttempts > 0 && attempt >= maxAttempts) {
|
|
797
|
+
log.warn(`⚠️ Bun wildcard prewarm stopped for ${zone} after ${attempt} attempts`);
|
|
798
|
+
return;
|
|
799
|
+
}
|
|
800
|
+
setTimeout(() => {
|
|
801
|
+
attemptPrewarm(attempt + 1).catch(() => {});
|
|
802
|
+
}, retryDelayMs);
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
// Background prewarm + retries so HTTPS startup is not blocked by DNS propagation timing.
|
|
807
|
+
attemptPrewarm().catch(() => {});
|
|
788
808
|
}
|
|
789
809
|
}
|
|
790
810
|
|
package/package.json
CHANGED
|
@@ -126,16 +126,15 @@ module.exports.create = function create(config = {}) {
|
|
|
126
126
|
|
|
127
127
|
async function setChallenge(opts) {
|
|
128
128
|
const ch = opts?.challenge || {};
|
|
129
|
-
|
|
130
|
-
log.info("[ACME dns-01 '" + (ch.altname || opts?.altname || 'unknown') + "' CHALLENGE]");
|
|
131
|
-
log.info("You're about to receive the following DNS query:");
|
|
132
|
-
log.info('');
|
|
129
|
+
const altname = ch.altname || opts?.altname || 'unknown';
|
|
133
130
|
const dnsHost = String(ch.dnsHost || '');
|
|
134
131
|
const dnsAuth = ch.dnsAuthorization || opts?.dnsAuthorization || null;
|
|
132
|
+
const token = ch.dnsAuthorization || '<dns-authorization-token>';
|
|
133
|
+
const host = ch.dnsHost || '_acme-challenge.<domain>';
|
|
134
|
+
|
|
135
135
|
if (dnsHost && dnsAuth) {
|
|
136
136
|
presentedByHost.set(dnsHost, dnsAuth);
|
|
137
137
|
}
|
|
138
|
-
const altname = String(ch.altname || opts?.altname || '');
|
|
139
138
|
if (altname && dnsAuth) {
|
|
140
139
|
presentedByAltname.set(altname, { dnsHost, dnsAuthorization: dnsAuth });
|
|
141
140
|
}
|
|
@@ -146,14 +145,8 @@ module.exports.create = function create(config = {}) {
|
|
|
146
145
|
const effectiveTimeoutMs = dnsPollTimeoutMs === null ? effectiveDelay : dnsPollTimeoutMs;
|
|
147
146
|
const expectedToken = resolveExpectedToken(opts, ch);
|
|
148
147
|
|
|
149
|
-
log.info(
|
|
150
|
-
|
|
151
|
-
(ch.dnsHost || '_acme-challenge.<domain>') +
|
|
152
|
-
'\t' +
|
|
153
|
-
(ch.dnsAuthorization || '<dns-authorization-token>') +
|
|
154
|
-
'\tTTL 60'
|
|
155
|
-
);
|
|
156
|
-
log.info('');
|
|
148
|
+
log.info('DNS-01 ' + altname);
|
|
149
|
+
log.info('TXT ' + host + ' ' + token + ' (TTL 60)');
|
|
157
150
|
if (verifyDnsBeforeContinue && dnsHost && expectedToken) {
|
|
158
151
|
log.info(
|
|
159
152
|
'DNS verification enabled. Continuing automatically when TXT appears at ' +
|