pmcf 6.20.1 → 6.20.3
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 +5 -5
- package/src/services/bind.mjs +63 -73
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "6.20.
|
|
3
|
+
"version": "6.20.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -50,11 +50,11 @@
|
|
|
50
50
|
"lint:docs": "documentation lint ./src**/*.mjs"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"aggregated-map": "^1.0.
|
|
53
|
+
"aggregated-map": "^1.0.10",
|
|
54
54
|
"content-entry-transform": "^1.7.0",
|
|
55
|
-
"ip-utilties": "^3.10.
|
|
56
|
-
"npm-pkgbuild": "^20.8.
|
|
57
|
-
"pacc": "^11.0.
|
|
55
|
+
"ip-utilties": "^3.10.1",
|
|
56
|
+
"npm-pkgbuild": "^20.8.13",
|
|
57
|
+
"pacc": "^11.0.3",
|
|
58
58
|
"package-directory": "^8.2.0",
|
|
59
59
|
"yaml": "^2.9.0"
|
|
60
60
|
},
|
package/src/services/bind.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { join
|
|
1
|
+
import { join } from "node:path";
|
|
2
2
|
import { createHmac } from "node:crypto";
|
|
3
3
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
4
|
import { reverseArpa, FAMILY_IPV4, FAMILY_IPV6 } from "ip-utilties";
|
|
@@ -196,6 +196,10 @@ class bind_group extends Base {
|
|
|
196
196
|
...string_set_attribute,
|
|
197
197
|
name: "domains"
|
|
198
198
|
},
|
|
199
|
+
foreignDomains: {
|
|
200
|
+
...string_set_attribute,
|
|
201
|
+
name: "foreignDomains"
|
|
202
|
+
},
|
|
199
203
|
zones: {
|
|
200
204
|
...default_collection_attribute,
|
|
201
205
|
type: bind_zone,
|
|
@@ -258,6 +262,7 @@ class bind_group extends Base {
|
|
|
258
262
|
addType(this);
|
|
259
263
|
}
|
|
260
264
|
|
|
265
|
+
foreignDomains = new Set();
|
|
261
266
|
access = [];
|
|
262
267
|
allowedUpdates = [];
|
|
263
268
|
notify = true;
|
|
@@ -356,6 +361,7 @@ class bind_group extends Base {
|
|
|
356
361
|
get zones() {
|
|
357
362
|
const entries = [...this.entries];
|
|
358
363
|
|
|
364
|
+
|
|
359
365
|
if (!this._zones && entries.length > 0) {
|
|
360
366
|
this._zoneConfigs = new Map();
|
|
361
367
|
this._zones = new Map();
|
|
@@ -398,10 +404,54 @@ class bind_group extends Base {
|
|
|
398
404
|
|
|
399
405
|
if (host && !hosts.has(host)) {
|
|
400
406
|
hosts.add(host);
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
407
|
+
|
|
408
|
+
for (let foreignDomain of host.foreignDomainNames) {
|
|
409
|
+
const wildcard = foreignDomain.startsWith("*.");
|
|
410
|
+
if (wildcard) {
|
|
411
|
+
foreignDomain = foreignDomain.substring(2);
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
this.foreignDomains.add(foreignDomain);
|
|
415
|
+
|
|
416
|
+
const config = this.zoneConfigs.getOrInsertComputed(
|
|
417
|
+
foreignDomain,
|
|
418
|
+
domain => new bind_zone_config(this, `${domain}.zone.conf`)
|
|
404
419
|
);
|
|
420
|
+
|
|
421
|
+
const zone = this._zones.getOrInsertComputed(
|
|
422
|
+
foreignDomain,
|
|
423
|
+
domain =>
|
|
424
|
+
this.intoCatalog(
|
|
425
|
+
new bind_zone(this, domain, config, locationName),
|
|
426
|
+
locationName
|
|
427
|
+
)
|
|
428
|
+
);
|
|
429
|
+
|
|
430
|
+
for (const na of host.networkAddresses(
|
|
431
|
+
na => na.networkInterface.kind !== "loopback"
|
|
432
|
+
)) {
|
|
433
|
+
zone.records.add(
|
|
434
|
+
DNSRecord(
|
|
435
|
+
"@",
|
|
436
|
+
dnsRecordTypeForAddressFamily(na.family),
|
|
437
|
+
na.address
|
|
438
|
+
)
|
|
439
|
+
);
|
|
440
|
+
|
|
441
|
+
if (wildcard) {
|
|
442
|
+
zone.records.add(
|
|
443
|
+
DNSRecord(
|
|
444
|
+
"*",
|
|
445
|
+
dnsRecordTypeForAddressFamily(na.family),
|
|
446
|
+
na.address
|
|
447
|
+
)
|
|
448
|
+
);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/*zone.records.add(
|
|
453
|
+
DNSRecord("outfacing", "PTR", dnsFullName(foreignDomain))
|
|
454
|
+
);*/
|
|
405
455
|
}
|
|
406
456
|
|
|
407
457
|
const sm = new Map();
|
|
@@ -487,6 +537,14 @@ class bind_group extends Base {
|
|
|
487
537
|
await config.write(outputControl, this);
|
|
488
538
|
}
|
|
489
539
|
|
|
540
|
+
if (this.foreignDomains.size) {
|
|
541
|
+
addHook(
|
|
542
|
+
outputControl.packageData,
|
|
543
|
+
"post_upgrade",
|
|
544
|
+
`/usr/bin/named-hostname-update ${[...this.foreignDomains].join(" ")}`
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
|
|
490
548
|
return outputControl.packageData;
|
|
491
549
|
}
|
|
492
550
|
}
|
|
@@ -619,76 +677,8 @@ export class bind extends ExtraSourceService {
|
|
|
619
677
|
yield packageData;
|
|
620
678
|
}
|
|
621
679
|
}
|
|
622
|
-
|
|
623
|
-
async *generateOutfacingDefs(outputControl, sources) {
|
|
624
|
-
for (const source of sources) {
|
|
625
|
-
for (const host of source.hosts.values()) {
|
|
626
|
-
this.outfacingZones(
|
|
627
|
-
outputControl,
|
|
628
|
-
host,
|
|
629
|
-
this.groups.get("internal"),
|
|
630
|
-
this.defaultRecords
|
|
631
|
-
);
|
|
632
|
-
}
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
if (outputControl.configs.length) {
|
|
636
|
-
addHook(
|
|
637
|
-
outputControl.packageData,
|
|
638
|
-
"post_upgrade",
|
|
639
|
-
`/usr/bin/named-hostname-update ${outputControl.configs
|
|
640
|
-
.map(config => config.zones.map(zone => zone.id))
|
|
641
|
-
.flat()
|
|
642
|
-
.join(" ")}`
|
|
643
|
-
);
|
|
644
|
-
|
|
645
|
-
await this.writeZones(outputControl);
|
|
646
|
-
|
|
647
|
-
yield outputControl.packageData;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
outfacingZones(outputControl, host, group, records) {
|
|
652
|
-
host.foreignDomainNames.map(domain => {
|
|
653
|
-
const wildcard = domain.startsWith("*.");
|
|
654
|
-
if (wildcard) {
|
|
655
|
-
domain = domain.substring(2);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
const zone = {
|
|
659
|
-
id: domain,
|
|
660
|
-
file: `${host.owner.name}/outfacing/${domain}.zone`,
|
|
661
|
-
records: new Set(records)
|
|
662
|
-
};
|
|
663
|
-
const config = {
|
|
664
|
-
group,
|
|
665
|
-
name: `${domain}.zone.conf`,
|
|
666
|
-
type: this.serverType,
|
|
667
|
-
zones: [zone]
|
|
668
|
-
};
|
|
669
|
-
zone.config = config;
|
|
670
|
-
outputControl.configs.push(config);
|
|
671
|
-
|
|
672
|
-
if (this.hasLocationRecord) {
|
|
673
|
-
zone.records.add(DNSRecord("location", "TXT", host.owner.name));
|
|
674
|
-
}
|
|
675
|
-
for (const na of host.networkAddresses(
|
|
676
|
-
na => na.networkInterface.kind !== "loopback"
|
|
677
|
-
)) {
|
|
678
|
-
zone.records.add(
|
|
679
|
-
DNSRecord("@", dnsRecordTypeForAddressFamily(na.family), na.address)
|
|
680
|
-
);
|
|
681
|
-
|
|
682
|
-
if (wildcard) {
|
|
683
|
-
zone.records.add(
|
|
684
|
-
DNSRecord("*", dnsRecordTypeForAddressFamily(na.family), na.address)
|
|
685
|
-
);
|
|
686
|
-
}
|
|
687
|
-
}
|
|
688
|
-
});
|
|
689
|
-
}
|
|
690
680
|
}
|
|
691
681
|
|
|
692
682
|
function newOutputControl(packageData, dir, permissions) {
|
|
693
|
-
return {
|
|
683
|
+
return { packageData, dir, permissions };
|
|
694
684
|
}
|