pmcf 6.20.0 → 6.20.2

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": "pmcf",
3
- "version": "6.20.0",
3
+ "version": "6.20.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -50,10 +50,10 @@
50
50
  "lint:docs": "documentation lint ./src**/*.mjs"
51
51
  },
52
52
  "dependencies": {
53
- "aggregated-map": "^1.0.8",
53
+ "aggregated-map": "^1.0.10",
54
54
  "content-entry-transform": "^1.7.0",
55
- "ip-utilties": "^3.10.0",
56
- "npm-pkgbuild": "^20.8.9",
55
+ "ip-utilties": "^3.10.1",
56
+ "npm-pkgbuild": "^20.8.11",
57
57
  "pacc": "^11.0.2",
58
58
  "package-directory": "^8.2.0",
59
59
  "yaml": "^2.9.0"
@@ -63,7 +63,7 @@
63
63
  "ava": "^8.0.1",
64
64
  "c8": "^12.0.0",
65
65
  "documentation": "^14.0.3",
66
- "semantic-release": "^25.0.8"
66
+ "semantic-release": "^25.0.9"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=26.5.1"
@@ -1,4 +1,4 @@
1
- import { join, dirname } from "node:path";
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;
@@ -335,13 +340,13 @@ class bind_group extends Base {
335
340
  intoCatalog(zone, locationName) {
336
341
  if (this.hasCatalog) {
337
342
  const catalogConfig = this.zoneConfigs.getOrInsertComputed(
338
- `catalog.${zone.id}`,
339
- domain => new bind_zone_config(this, `${domain}.zone.conf`)
343
+ `catalog.${locationName}`,
344
+ id => new bind_zone_config(this, `${id}.zone.conf`)
340
345
  );
341
346
 
342
347
  const catalogZone = this._zones.getOrInsertComputed(
343
- `catalog.${zone.id}`,
344
- domain => new catalog_zone(this, domain, catalogConfig, locationName)
348
+ `catalog.${locationName}`,
349
+ id => new catalog_zone(this, id, catalogConfig, locationName)
345
350
  );
346
351
 
347
352
  const hash = createHmac("sha1", zone.id).digest("hex");
@@ -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
- for (const foreignDomainName of host.foreignDomainNames) {
402
- zone.records.add(
403
- DNSRecord("outfacing", "PTR", dnsFullName(foreignDomainName))
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
  }
@@ -616,82 +674,11 @@ export class bind extends ExtraSourceService {
616
674
  const present = await this.writeForwarders(outputControl);
617
675
 
618
676
  if (hasContent || present) {
619
- //console.log(packageData);
620
677
  yield packageData;
621
678
  }
622
679
  }
623
-
624
- async *generateOutfacingDefs(outputControl, sources) {
625
- for (const source of sources) {
626
- for (const host of source.hosts.values()) {
627
- this.outfacingZones(
628
- outputControl,
629
- host,
630
- this.groups.get("internal"),
631
- this.defaultRecords
632
- );
633
- }
634
- }
635
-
636
- if (outputControl.configs.length) {
637
- addHook(
638
- outputControl.packageData,
639
- "post_upgrade",
640
- `/usr/bin/named-hostname-update ${outputControl.configs
641
- .map(config => config.zones.map(zone => zone.id))
642
- .flat()
643
- .join(" ")}`
644
- );
645
-
646
- await this.writeZones(outputControl);
647
-
648
- yield outputControl.packageData;
649
- }
650
- }
651
-
652
- outfacingZones(outputControl, host, group, records) {
653
- host.foreignDomainNames.map(domain => {
654
- const wildcard = domain.startsWith("*.");
655
- if (wildcard) {
656
- domain = domain.substring(2);
657
- }
658
-
659
- const zone = {
660
- id: domain,
661
- file: `${host.owner.name}/outfacing/${domain}.zone`,
662
- records: new Set(records)
663
- };
664
- const config = {
665
- group,
666
- name: `${domain}.zone.conf`,
667
- type: this.serverType,
668
- zones: [zone]
669
- };
670
- zone.config = config;
671
- outputControl.configs.push(config);
672
-
673
- if (this.hasLocationRecord) {
674
- zone.records.add(DNSRecord("location", "TXT", host.owner.name));
675
- }
676
- for (const na of host.networkAddresses(
677
- na => na.networkInterface.kind !== "loopback"
678
- )) {
679
- zone.records.add(
680
- DNSRecord("@", dnsRecordTypeForAddressFamily(na.family), na.address)
681
- );
682
-
683
- if (wildcard) {
684
- zone.records.add(
685
- DNSRecord("*", dnsRecordTypeForAddressFamily(na.family), na.address)
686
- );
687
- }
688
- }
689
-
690
- //this.assignCatalog(outputControl, zone, `outfacting.${host.owner.name}`);
691
- });
692
- }
693
680
  }
694
681
 
695
682
  function newOutputControl(packageData, dir, permissions) {
696
- return { configs: [], catalogs: new Map(), packageData, dir, permissions };
683
+ return { packageData, dir, permissions };
697
684
  }