pmcf 1.23.4 → 1.23.5
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/bin/pmcf-named-defs +11 -4
- package/package.json +1 -1
- package/src/model.mjs +1 -1
package/bin/pmcf-named-defs
CHANGED
|
@@ -16,8 +16,6 @@ const updates = [
|
|
|
16
16
|
60000
|
|
17
17
|
].join(" ");
|
|
18
18
|
|
|
19
|
-
const NAME_LEN = 35;
|
|
20
|
-
|
|
21
19
|
await generateNamedDefs(owner, options.output);
|
|
22
20
|
|
|
23
21
|
console.log("depends", "mf-named");
|
|
@@ -35,13 +33,15 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
35
33
|
const nameserver = (await owner.service({ type: "dns" }))?.owner;
|
|
36
34
|
const rname = dns.administratorEmail.replace(/@/, ".");
|
|
37
35
|
|
|
36
|
+
let maxKeyLength;
|
|
37
|
+
|
|
38
38
|
const createRecord = (key, type, value) => {
|
|
39
39
|
return {
|
|
40
40
|
key,
|
|
41
41
|
type,
|
|
42
42
|
value,
|
|
43
43
|
toString: () =>
|
|
44
|
-
`${key.padEnd(
|
|
44
|
+
`${key.padEnd(maxKeyLength, " ")} ${ttl} IN ${type.padEnd(5, " ")} ${value}`
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
|
|
@@ -148,7 +148,7 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
148
148
|
if (zone !== catalogZone) {
|
|
149
149
|
const hash = createHmac("md5", zone.id).digest("hex");
|
|
150
150
|
catalogZone.records.add(
|
|
151
|
-
`${hash}.zones.${domain}
|
|
151
|
+
createRecord(`${hash}.zones.${domain}.`, "PTR", `${zone.id}.`)
|
|
152
152
|
);
|
|
153
153
|
}
|
|
154
154
|
|
|
@@ -165,6 +165,13 @@ async function generateNamedDefs(owner, targetDir) {
|
|
|
165
165
|
zoneConfig.push(`};`);
|
|
166
166
|
zoneConfig.push("");
|
|
167
167
|
|
|
168
|
+
maxKeyLength = 0;
|
|
169
|
+
for (const r of zone.records) {
|
|
170
|
+
if (r.key.length > maxKeyLength) {
|
|
171
|
+
maxKeyLength = r.key.length;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
168
175
|
writeLines(join(targetDir, "var/lib/named"), zone.file, zone.records);
|
|
169
176
|
}
|
|
170
177
|
|
package/package.json
CHANGED