roster-server 2.2.5 → 2.2.6
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
|
@@ -130,6 +130,51 @@ describe('acme-dns-01-cli-wrapper automatic Linode DNS', () => {
|
|
|
130
130
|
assert.strictEqual(payload.name, '_acme-challenge.sub');
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
+
it('prefers apex zone over www zone for www challenges', async () => {
|
|
134
|
+
const calls = [];
|
|
135
|
+
global.fetch = async (url, options = {}) => {
|
|
136
|
+
calls.push({ url, options });
|
|
137
|
+
if (url.endsWith('/domains?page_size=500')) {
|
|
138
|
+
return {
|
|
139
|
+
ok: true,
|
|
140
|
+
status: 200,
|
|
141
|
+
json: async () => ({
|
|
142
|
+
data: [
|
|
143
|
+
{ id: 777, domain: 'www.tagnu.com' },
|
|
144
|
+
{ id: 888, domain: 'tagnu.com' }
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
if (url.endsWith('/domains/888/records?page_size=500')) {
|
|
150
|
+
return { ok: true, status: 200, json: async () => ({ data: [] }) };
|
|
151
|
+
}
|
|
152
|
+
if (url.endsWith('/domains/888/records') && options.method === 'POST') {
|
|
153
|
+
return { ok: true, status: 200, json: async () => ({ id: 333 }) };
|
|
154
|
+
}
|
|
155
|
+
return { ok: true, status: 204, json: async () => ({}) };
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const challenger = wrapper.create({
|
|
159
|
+
provider: 'linode',
|
|
160
|
+
linodeApiKey: 'fake-token',
|
|
161
|
+
verifyDnsBeforeContinue: false,
|
|
162
|
+
propagationDelay: 0,
|
|
163
|
+
dryRunDelay: 0
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
await challenger.set({
|
|
167
|
+
challenge: {
|
|
168
|
+
altname: 'www.tagnu.com',
|
|
169
|
+
dnsHost: '_greenlock-dryrun-abc.www.tagnu.com',
|
|
170
|
+
dnsAuthorization: 'www-token'
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
assert.ok(calls.some((c) => c.url.endsWith('/domains/888/records') && c.options.method === 'POST'));
|
|
175
|
+
assert.ok(!calls.some((c) => c.url.endsWith('/domains/777/records') && c.options.method === 'POST'));
|
|
176
|
+
});
|
|
177
|
+
|
|
133
178
|
it('falls back to manual when provider mode has no API key (default)', async () => {
|
|
134
179
|
const prevLinode = process.env.LINODE_API_KEY;
|
|
135
180
|
delete process.env.LINODE_API_KEY;
|
|
@@ -212,6 +212,14 @@ module.exports.create = function create(config = {}) {
|
|
|
212
212
|
}
|
|
213
213
|
};
|
|
214
214
|
|
|
215
|
+
// Prefer apex zone when validating www.<domain> challenges so records are
|
|
216
|
+
// created in the commonly delegated parent zone (e.g. tagnu.com).
|
|
217
|
+
if (altname) {
|
|
218
|
+
const normalizedAltname = String(altname).replace(/^\*\./, '').replace(/\.$/, '').toLowerCase();
|
|
219
|
+
if (normalizedAltname.startsWith('www.')) {
|
|
220
|
+
add(normalizedAltname.slice(4));
|
|
221
|
+
}
|
|
222
|
+
}
|
|
215
223
|
if (dnsHost) {
|
|
216
224
|
const normalizedDnsHost = String(dnsHost).replace(/^_acme-challenge\./, '').replace(/^_greenlock-[^.]+\./, '');
|
|
217
225
|
add(normalizedDnsHost);
|