pmcf 6.10.3 → 6.11.0
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/README.md +20 -20
- package/package.json +2 -2
- package/src/core-service.mjs +24 -16
- package/src/network-address.mjs +1 -1
- package/src/services/bind.mjs +44 -71
package/README.md
CHANGED
|
@@ -77,26 +77,26 @@ generates config packages for:
|
|
|
77
77
|
* [domainNames](#domainnames)
|
|
78
78
|
* [InitializationContext](#initializationcontext)
|
|
79
79
|
* [Parameters](#parameters-13)
|
|
80
|
+
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
81
|
+
* [networkAddresses](#networkaddresses)
|
|
82
|
+
* [Parameters](#parameters-14)
|
|
80
83
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
81
84
|
* [Properties](#properties)
|
|
82
85
|
* [systemdConfigs](#systemdconfigs)
|
|
83
|
-
* [Parameters](#parameters-
|
|
86
|
+
* [Parameters](#parameters-15)
|
|
84
87
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
85
88
|
* [Properties](#properties-1)
|
|
86
89
|
* [systemdConfigs](#systemdconfigs-1)
|
|
87
|
-
* [Parameters](#parameters-
|
|
90
|
+
* [Parameters](#parameters-16)
|
|
88
91
|
* [NetworkAddress](#networkaddress)
|
|
89
|
-
* [Parameters](#parameters-
|
|
92
|
+
* [Parameters](#parameters-17)
|
|
90
93
|
* [subnet](#subnet)
|
|
91
94
|
* [networkInterface](#networkinterface)
|
|
92
95
|
* [address](#address)
|
|
93
96
|
* [addresses](#addresses)
|
|
94
|
-
* [Parameters](#parameters-17)
|
|
95
|
-
* [cidrAddresses](#cidraddresses)
|
|
96
97
|
* [Parameters](#parameters-18)
|
|
97
|
-
* [
|
|
98
|
-
* [
|
|
99
|
-
* [Parameters](#parameters-19)
|
|
98
|
+
* [cidrAddresses](#cidraddresses)
|
|
99
|
+
* [Parameters](#parameters-19)
|
|
100
100
|
* [families](#families)
|
|
101
101
|
* [secretName](#secretname)
|
|
102
102
|
* [directHosts](#directhosts)
|
|
@@ -286,6 +286,18 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
286
286
|
|
|
287
287
|
* `directory` (optional, default `"/"`)
|
|
288
288
|
|
|
289
|
+
## SkeletonNetworkInterface
|
|
290
|
+
|
|
291
|
+
**Extends ServiceOwner**
|
|
292
|
+
|
|
293
|
+
### networkAddresses
|
|
294
|
+
|
|
295
|
+
#### Parameters
|
|
296
|
+
|
|
297
|
+
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
298
|
+
|
|
299
|
+
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
300
|
+
|
|
289
301
|
## SystemdJournalRemoteService
|
|
290
302
|
|
|
291
303
|
**Extends CoreService**
|
|
@@ -361,18 +373,6 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
|
|
|
361
373
|
|
|
362
374
|
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
|
363
375
|
|
|
364
|
-
## SkeletonNetworkInterface
|
|
365
|
-
|
|
366
|
-
**Extends ServiceOwner**
|
|
367
|
-
|
|
368
|
-
### networkAddresses
|
|
369
|
-
|
|
370
|
-
#### Parameters
|
|
371
|
-
|
|
372
|
-
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
373
|
-
|
|
374
|
-
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
375
|
-
|
|
376
376
|
## families
|
|
377
377
|
|
|
378
378
|
Returns **[Set](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Set)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** 
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmcf",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.11.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"dependencies": {
|
|
53
53
|
"aggregated-map": "^1.0.7",
|
|
54
54
|
"content-entry-transform": "^1.6.9",
|
|
55
|
-
"ip-utilties": "^3.7.
|
|
55
|
+
"ip-utilties": "^3.7.5",
|
|
56
56
|
"npm-pkgbuild": "^20.8.2",
|
|
57
57
|
"pacc": "^10.4.1",
|
|
58
58
|
"package-directory": "^8.2.0",
|
package/src/core-service.mjs
CHANGED
|
@@ -93,22 +93,6 @@ export class CoreService extends Base {
|
|
|
93
93
|
return `${this.fullName}(${this.type})`;
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
set systemUserName(value) {
|
|
97
|
-
this._systemUserName = value;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
get systemUserName() {
|
|
101
|
-
return this.attribute("_systemUserName") ?? super.systemUserName;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
set systemGroupName(value) {
|
|
105
|
-
this._systemGroupName = value;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
get systemGroupName() {
|
|
109
|
-
return this.attribute("_systemGroupName") ?? super.systemGroupName;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
96
|
get network() {
|
|
113
97
|
return this.host.network;
|
|
114
98
|
}
|
|
@@ -275,6 +259,30 @@ export class CoreService extends Base {
|
|
|
275
259
|
);
|
|
276
260
|
}
|
|
277
261
|
|
|
262
|
+
set systemUserName(value) {
|
|
263
|
+
this._systemUserName = value;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
get systemUserName() {
|
|
267
|
+
return (
|
|
268
|
+
this.attribute("_systemUserName") ??
|
|
269
|
+
ServiceTypes[this.type]?.systemUserName ??
|
|
270
|
+
super.systemUserName
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
set systemGroupName(value) {
|
|
275
|
+
this._systemGroupName = value;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
get systemGroupName() {
|
|
279
|
+
return (
|
|
280
|
+
this.attribute("_systemGroupName") ??
|
|
281
|
+
ServiceTypes[this.type]?.systemGroupName ??
|
|
282
|
+
super.systemGroupName
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
|
|
278
286
|
get packageData() {
|
|
279
287
|
const packageData = super.packageData;
|
|
280
288
|
const name = `${this.owner.owner.name}-${this.owner.name}`;
|
package/src/network-address.mjs
CHANGED
package/src/services/bind.mjs
CHANGED
|
@@ -122,9 +122,16 @@ class bind_group extends Base {
|
|
|
122
122
|
hasCatalog = true;
|
|
123
123
|
hasSVRRecords = true;
|
|
124
124
|
hasLinkLocalAdresses = bind_group.attributes.hasLinkLocalAdresses.default;
|
|
125
|
-
|
|
126
125
|
recordTTL = "1W";
|
|
127
126
|
|
|
127
|
+
get type() {
|
|
128
|
+
if (this.entries.length > 0 || this.sharedWith) {
|
|
129
|
+
return "view";
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
return "unknown";
|
|
133
|
+
}
|
|
134
|
+
|
|
128
135
|
get service() {
|
|
129
136
|
return this.owner;
|
|
130
137
|
}
|
|
@@ -134,7 +141,7 @@ class bind_group extends Base {
|
|
|
134
141
|
}
|
|
135
142
|
|
|
136
143
|
get defaultRecords() {
|
|
137
|
-
const nameService = this.owner;
|
|
144
|
+
const nameService = this.owner;
|
|
138
145
|
|
|
139
146
|
console.log(
|
|
140
147
|
"nameService",
|
|
@@ -157,9 +164,28 @@ class bind_group extends Base {
|
|
|
157
164
|
|
|
158
165
|
async packageContent(outputControl) {
|
|
159
166
|
return (
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
await Promise.all([
|
|
168
|
+
this.generateACLs(outputControl),
|
|
169
|
+
this.generateTypeDefinition(outputControl),
|
|
170
|
+
this.generateZoneDefs(outputControl, this.entries)
|
|
171
|
+
])
|
|
172
|
+
).find(r => r)
|
|
173
|
+
? true
|
|
174
|
+
: false;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
async generateTypeDefinition(outputControl) {
|
|
178
|
+
if (this.type === "view") {
|
|
179
|
+
await writeLines(
|
|
180
|
+
join(outputControl.dir, "etc/named/views"),
|
|
181
|
+
`gen-${this.name}.conf`,
|
|
182
|
+
[
|
|
183
|
+
`view ${this.name} {`,
|
|
184
|
+
`include "/etc/named/views/${this.name}/*.conf";`,
|
|
185
|
+
"};"
|
|
186
|
+
]
|
|
187
|
+
);
|
|
188
|
+
}
|
|
163
189
|
}
|
|
164
190
|
|
|
165
191
|
async generateACLs(outputControl) {
|
|
@@ -372,7 +398,12 @@ class bind_group extends Base {
|
|
|
372
398
|
content.push(` type ${config.type};`);
|
|
373
399
|
content.push(` file \"${zone.file}\";`);
|
|
374
400
|
content.push(
|
|
375
|
-
addressesStatement(
|
|
401
|
+
addressesStatement(
|
|
402
|
+
"allow-update",
|
|
403
|
+
this.allowedUpdates,
|
|
404
|
+
"none;",
|
|
405
|
+
" "
|
|
406
|
+
)
|
|
376
407
|
);
|
|
377
408
|
content.push(` notify ${yesno(this.notify)};`);
|
|
378
409
|
}
|
|
@@ -403,17 +434,17 @@ class bind_group extends Base {
|
|
|
403
434
|
}
|
|
404
435
|
}
|
|
405
436
|
|
|
406
|
-
function addressesStatement(prefix, objects, empty = false) {
|
|
437
|
+
function addressesStatement(prefix, objects, empty = false, indent = "") {
|
|
407
438
|
const body = asArray(objects).map(
|
|
408
|
-
value =>
|
|
439
|
+
value => `${indent} ${typeof value === "string" ? value : value.name};`
|
|
409
440
|
);
|
|
410
441
|
|
|
411
442
|
if (body.length) {
|
|
412
|
-
return [`${prefix} {`, body,
|
|
443
|
+
return [`${indent}${prefix} {`, body, `${indent}};`];
|
|
413
444
|
}
|
|
414
445
|
|
|
415
446
|
if (empty) {
|
|
416
|
-
return [`${prefix} {`, empty,
|
|
447
|
+
return [`${indent}${prefix} {`, indent + " " + empty, `${indent}};`];
|
|
417
448
|
}
|
|
418
449
|
|
|
419
450
|
return [];
|
|
@@ -434,8 +465,10 @@ export class bind extends ExtraSourceService {
|
|
|
434
465
|
}
|
|
435
466
|
};
|
|
436
467
|
static service = {
|
|
437
|
-
systemdService: "bind.service",
|
|
438
468
|
extends: ["dns"],
|
|
469
|
+
systemdService: "named.service",
|
|
470
|
+
systemUserName: "named",
|
|
471
|
+
systemGroupName: "named",
|
|
439
472
|
services: {
|
|
440
473
|
"bind-statistics": {
|
|
441
474
|
endpoints: [
|
|
@@ -481,14 +514,6 @@ export class bind extends ExtraSourceService {
|
|
|
481
514
|
return this.primaries ? "secondary" : "primary";
|
|
482
515
|
}
|
|
483
516
|
|
|
484
|
-
get systemUserName() {
|
|
485
|
-
return "named";
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
get systemGroupName() {
|
|
489
|
-
return "named";
|
|
490
|
-
}
|
|
491
|
-
|
|
492
517
|
async writeForwarders(outputControl) {
|
|
493
518
|
const forwarders = serviceEndpoints(this.source, {
|
|
494
519
|
services: "services[types[dns] && priority>=100 && priority<200]",
|
|
@@ -537,58 +562,6 @@ export class bind extends ExtraSourceService {
|
|
|
537
562
|
console.log(packageData);
|
|
538
563
|
yield packageData;
|
|
539
564
|
}
|
|
540
|
-
|
|
541
|
-
/*
|
|
542
|
-
const sources = this.zones.length ? this.zones : [this.owner];
|
|
543
|
-
const names = sources.map(a => a.fullName).join(" ");
|
|
544
|
-
const name = this.owner.owner.name || this.owner.name;
|
|
545
|
-
|
|
546
|
-
Object.assign(packageData.properties, {
|
|
547
|
-
name: `named-${name}`,
|
|
548
|
-
description: `named definitions for ${names}`
|
|
549
|
-
});
|
|
550
|
-
|
|
551
|
-
const ownerAndGroup = { owner: "named", group: "named" };
|
|
552
|
-
const filePermissions = [
|
|
553
|
-
{ ...ownerAndGroup, mode: 0o644 },
|
|
554
|
-
{ ...ownerAndGroup, mode: 0o755 }
|
|
555
|
-
];
|
|
556
|
-
|
|
557
|
-
const zonesPackageDir = join(dir, "zones") + "/";
|
|
558
|
-
|
|
559
|
-
packageData.sources = [
|
|
560
|
-
new FileContentProvider(zonesPackageDir, ...filePermissions)
|
|
561
|
-
];
|
|
562
|
-
packageData.properties = {
|
|
563
|
-
name: `named-zones-${name}`,
|
|
564
|
-
description: `zone definitions for ${names}`,
|
|
565
|
-
dependencies: ["mf-named"],
|
|
566
|
-
access: "private"
|
|
567
|
-
};
|
|
568
|
-
|
|
569
|
-
yield this.generateZoneDefs(
|
|
570
|
-
newOutputControl(packageData, zonesPackageDir),
|
|
571
|
-
sources
|
|
572
|
-
);
|
|
573
|
-
|
|
574
|
-
const location = "outfacing";
|
|
575
|
-
|
|
576
|
-
const outfacingZonesPackageDir = join(dir, location) + "/";
|
|
577
|
-
|
|
578
|
-
packageData.sources = [
|
|
579
|
-
new FileContentProvider(outfacingZonesPackageDir, ...filePermissions)
|
|
580
|
-
];
|
|
581
|
-
packageData.properties = {
|
|
582
|
-
name: `named-zones-${name}-${location}`,
|
|
583
|
-
description: `${location} zone definitions for ${names}`,
|
|
584
|
-
access: "private"
|
|
585
|
-
};
|
|
586
|
-
|
|
587
|
-
yield* this.generateOutfacingDefs(
|
|
588
|
-
newOutputControl(packageData, outfacingZonesPackageDir),
|
|
589
|
-
sources
|
|
590
|
-
);
|
|
591
|
-
*/
|
|
592
565
|
}
|
|
593
566
|
|
|
594
567
|
async *generateOutfacingDefs(outputControl, sources) {
|