roster-server 2.1.20 → 2.1.22

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roster-server",
3
- "version": "2.1.20",
3
+ "version": "2.1.22",
4
4
  "description": "👾 RosterServer - A domain host router to host multiple HTTPS.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -66,6 +66,7 @@ module.exports.create = function create(config = {}) {
66
66
  }
67
67
 
68
68
  const presentedByHost = new Map();
69
+ const presentedByAltname = new Map();
69
70
 
70
71
  async function setChallenge(opts) {
71
72
  const isInteractive = Boolean(process.stdin && process.stdin.isTTY);
@@ -83,6 +84,10 @@ module.exports.create = function create(config = {}) {
83
84
  if (dnsHost && dnsAuth) {
84
85
  presentedByHost.set(dnsHost, dnsAuth);
85
86
  }
87
+ const altname = String(ch.altname || opts?.altname || '');
88
+ if (altname && dnsAuth) {
89
+ presentedByAltname.set(altname, { dnsHost, dnsAuthorization: dnsAuth });
90
+ }
86
91
  const isDryRunChallenge = dnsHost.includes('_greenlock-dryrun-');
87
92
  const effectiveDelay = isDryRunChallenge
88
93
  ? Math.max(0, dryRunDelay)
@@ -108,11 +113,18 @@ module.exports.create = function create(config = {}) {
108
113
 
109
114
  async function getChallenge(opts) {
110
115
  const ch = opts?.challenge || {};
111
- const dnsHost = String(ch.dnsHost || opts?.dnsHost || '');
116
+ const altname = String(ch.altname || opts?.altname || '');
117
+ const wildcardZone = altname.startsWith('*.') ? altname.slice(2) : '';
118
+ const dnsHostFromAltname = wildcardZone ? `_acme-challenge.${wildcardZone}` : '';
119
+ const dnsHost = String(ch.dnsHost || opts?.dnsHost || dnsHostFromAltname || '');
120
+
121
+ const byAltname = altname ? presentedByAltname.get(altname) : null;
112
122
  const dnsAuthorization =
113
123
  ch.dnsAuthorization ||
114
124
  opts?.dnsAuthorization ||
115
- (dnsHost ? presentedByHost.get(dnsHost) : null);
125
+ (dnsHost ? presentedByHost.get(dnsHost) : null) ||
126
+ byAltname?.dnsAuthorization ||
127
+ null;
116
128
 
117
129
  if (!dnsAuthorization) {
118
130
  return null;
@@ -120,6 +132,8 @@ module.exports.create = function create(config = {}) {
120
132
 
121
133
  return {
122
134
  ...(typeof ch === 'object' ? ch : {}),
135
+ ...(altname ? { altname } : {}),
136
+ ...(dnsHost ? { dnsHost } : {}),
123
137
  dnsAuthorization
124
138
  };
125
139
  }