pmcf 1.64.6 → 1.65.1
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 +1 -1
- package/src/dns.mjs +36 -26
package/package.json
CHANGED
package/src/dns.mjs
CHANGED
|
@@ -172,22 +172,33 @@ async function generateNamedDefs(dns, targetDir) {
|
|
|
172
172
|
|
|
173
173
|
const NSRecord = createRecord("@", "NS", fullName(nameService.rawAddress));
|
|
174
174
|
|
|
175
|
+
const zone = {
|
|
176
|
+
id: domain,
|
|
177
|
+
type: "plain",
|
|
178
|
+
file: `${domain}.zone`,
|
|
179
|
+
records: new Set([SOARecord, NSRecord, ...records])
|
|
180
|
+
};
|
|
181
|
+
zones.push(zone);
|
|
182
|
+
|
|
175
183
|
const catalogZone = {
|
|
176
184
|
id: `catalog.${domain}`,
|
|
185
|
+
type: "catalog",
|
|
177
186
|
file: `catalog.${domain}.zone`,
|
|
178
187
|
records: new Set([
|
|
179
188
|
SOARecord,
|
|
180
189
|
NSRecord,
|
|
181
|
-
createRecord(fullName(`version.${domain}`), "TXT", '"
|
|
190
|
+
createRecord(fullName(`version.catalog.${domain}`), "TXT", '"1"')
|
|
182
191
|
])
|
|
183
192
|
};
|
|
184
193
|
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
file: `${domain}.zone`,
|
|
188
|
-
records: new Set([SOARecord, NSRecord, ...records])
|
|
194
|
+
const configs = {
|
|
195
|
+
plain: { name: `${domain}.zone.conf`, content: [] }
|
|
189
196
|
};
|
|
190
|
-
|
|
197
|
+
|
|
198
|
+
if (dns.hasCatalog) {
|
|
199
|
+
zones.push(catalogZone);
|
|
200
|
+
configs.catalog = { name: `catalog.${domain}.zone.conf`, content: [] };
|
|
201
|
+
}
|
|
191
202
|
|
|
192
203
|
const hosts = new Set();
|
|
193
204
|
const addresses = new Set();
|
|
@@ -217,6 +228,7 @@ async function generateNamedDefs(dns, targetDir) {
|
|
|
217
228
|
const reverseArpa = reverseArpaAddress(subnet.prefix);
|
|
218
229
|
reverseZone = {
|
|
219
230
|
id: reverseArpa,
|
|
231
|
+
type: "plain",
|
|
220
232
|
file: `${reverseArpa}.zone`,
|
|
221
233
|
records: new Set([SOARecord, NSRecord])
|
|
222
234
|
};
|
|
@@ -258,32 +270,28 @@ async function generateNamedDefs(dns, targetDir) {
|
|
|
258
270
|
}
|
|
259
271
|
}
|
|
260
272
|
|
|
261
|
-
const zoneConfig = [];
|
|
262
|
-
|
|
263
|
-
if (dns.hasCatalog) {
|
|
264
|
-
zones.push(catalogZone);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
273
|
for (const zone of zones) {
|
|
268
|
-
|
|
274
|
+
const content = configs[zone.type].content;
|
|
275
|
+
|
|
276
|
+
if (zone.type !== "catalog") {
|
|
269
277
|
const hash = createHmac("md5", zone.id).digest("hex");
|
|
270
278
|
catalogZone.records.add(
|
|
271
|
-
createRecord(`${hash}.zones.${domain}.`, "PTR",
|
|
279
|
+
createRecord(`${hash}.zones.${domain}.`, "PTR", fullName(zone.id))
|
|
272
280
|
);
|
|
273
281
|
}
|
|
274
282
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
283
|
+
content.push(`zone \"${zone.id}\" {`);
|
|
284
|
+
content.push(` type master;`);
|
|
285
|
+
content.push(` file \"${zone.file}\";`);
|
|
278
286
|
|
|
279
|
-
|
|
287
|
+
content.push(
|
|
280
288
|
` allow-update { ${
|
|
281
289
|
dns.allowedUpdates.length ? dns.allowedUpdates.join(";") : "none"
|
|
282
290
|
}; };`
|
|
283
291
|
);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
292
|
+
content.push(` notify ${dns.notify ? "yes" : "no"};`);
|
|
293
|
+
content.push(`};`);
|
|
294
|
+
content.push("");
|
|
287
295
|
|
|
288
296
|
maxKeyLength = 0;
|
|
289
297
|
for (const r of zone.records) {
|
|
@@ -299,11 +307,13 @@ async function generateNamedDefs(dns, targetDir) {
|
|
|
299
307
|
);
|
|
300
308
|
}
|
|
301
309
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
310
|
+
for (const cfg of Object.values(configs)) {
|
|
311
|
+
await writeLines(
|
|
312
|
+
join(targetDir, "etc/named.d/zones"),
|
|
313
|
+
cfg.name,
|
|
314
|
+
cfg.content
|
|
315
|
+
);
|
|
316
|
+
}
|
|
307
317
|
}
|
|
308
318
|
}
|
|
309
319
|
|