pmcf 6.0.0 → 6.0.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/README.md +20 -20
- package/package.json +2 -2
- package/src/cluster.mjs +19 -8
- package/src/network-interfaces/wlan.mjs +1 -1
- package/src/network-support.mjs +62 -0
package/README.md
CHANGED
|
@@ -75,26 +75,26 @@ generates config packages for:
|
|
|
75
75
|
* [domainNames](#domainnames)
|
|
76
76
|
* [InitializationContext](#initializationcontext)
|
|
77
77
|
* [Parameters](#parameters-12)
|
|
78
|
-
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
79
|
-
* [networkAddresses](#networkaddresses)
|
|
80
|
-
* [Parameters](#parameters-13)
|
|
81
78
|
* [SystemdJournalRemoteService](#systemdjournalremoteservice)
|
|
82
79
|
* [Properties](#properties)
|
|
83
80
|
* [systemdConfigs](#systemdconfigs)
|
|
84
|
-
* [Parameters](#parameters-
|
|
81
|
+
* [Parameters](#parameters-13)
|
|
85
82
|
* [SystemdJournalUploadService](#systemdjournaluploadservice)
|
|
86
83
|
* [Properties](#properties-1)
|
|
87
84
|
* [systemdConfigs](#systemdconfigs-1)
|
|
88
|
-
* [Parameters](#parameters-
|
|
85
|
+
* [Parameters](#parameters-14)
|
|
89
86
|
* [NetworkAddress](#networkaddress)
|
|
90
|
-
* [Parameters](#parameters-
|
|
87
|
+
* [Parameters](#parameters-15)
|
|
91
88
|
* [subnet](#subnet)
|
|
92
89
|
* [networkInterface](#networkinterface)
|
|
93
90
|
* [address](#address)
|
|
94
91
|
* [addresses](#addresses)
|
|
95
|
-
* [Parameters](#parameters-
|
|
92
|
+
* [Parameters](#parameters-16)
|
|
96
93
|
* [cidrAddresses](#cidraddresses)
|
|
97
|
-
* [Parameters](#parameters-
|
|
94
|
+
* [Parameters](#parameters-17)
|
|
95
|
+
* [SkeletonNetworkInterface](#skeletonnetworkinterface)
|
|
96
|
+
* [networkAddresses](#networkaddresses)
|
|
97
|
+
* [Parameters](#parameters-18)
|
|
98
98
|
* [secretName](#secretname)
|
|
99
99
|
* [directHosts](#directhosts)
|
|
100
100
|
* [subnetForAddress](#subnetforaddress)
|
|
@@ -270,18 +270,6 @@ Keeps track of all in flight object creations and loose ends during config initi
|
|
|
270
270
|
|
|
271
271
|
* `directory` (optional, default `"/"`)
|
|
272
272
|
|
|
273
|
-
## SkeletonNetworkInterface
|
|
274
|
-
|
|
275
|
-
**Extends ServiceOwner**
|
|
276
|
-
|
|
277
|
-
### networkAddresses
|
|
278
|
-
|
|
279
|
-
#### Parameters
|
|
280
|
-
|
|
281
|
-
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
282
|
-
|
|
283
|
-
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
284
|
-
|
|
285
273
|
## SystemdJournalRemoteService
|
|
286
274
|
|
|
287
275
|
**Extends Service**
|
|
@@ -357,6 +345,18 @@ Returns **Iterable<[string](https://developer.mozilla.org/docs/Web/JavaScript/Re
|
|
|
357
345
|
|
|
358
346
|
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)>** 
|
|
359
347
|
|
|
348
|
+
## SkeletonNetworkInterface
|
|
349
|
+
|
|
350
|
+
**Extends ServiceOwner**
|
|
351
|
+
|
|
352
|
+
### networkAddresses
|
|
353
|
+
|
|
354
|
+
#### Parameters
|
|
355
|
+
|
|
356
|
+
* `filter` **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** (optional, default `n=>true`)
|
|
357
|
+
|
|
358
|
+
Returns **Iterable<[NetworkAddress](#networkaddress)>** 
|
|
359
|
+
|
|
360
360
|
## secretName
|
|
361
361
|
|
|
362
362
|
Returns **[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.0.
|
|
3
|
+
"version": "6.0.1",
|
|
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.
|
|
55
|
+
"ip-utilties": "^3.2.0",
|
|
56
56
|
"npm-pkgbuild": "^20.7.12",
|
|
57
57
|
"pacc": "^10.4.0",
|
|
58
58
|
"package-directory": "^8.2.0"
|
package/src/cluster.mjs
CHANGED
|
@@ -56,19 +56,15 @@ export class Cluster extends Host {
|
|
|
56
56
|
)) {
|
|
57
57
|
const host = ni.host;
|
|
58
58
|
const packageStagingDir = join(stagingDir, host.name);
|
|
59
|
-
const
|
|
59
|
+
const name = `${this.owner.name}-${host.name}`;
|
|
60
60
|
|
|
61
61
|
const packageData = host.packageData;
|
|
62
62
|
packageData.sources.push(
|
|
63
63
|
new FileContentProvider(packageStagingDir + "/")
|
|
64
64
|
);
|
|
65
|
-
packageData.properties.name = `keepalived-${
|
|
65
|
+
packageData.properties.name = `keepalived-${name}`;
|
|
66
66
|
packageData.properties.description = `${this.typeName} definitions for ${this.fullName}`;
|
|
67
|
-
packageData.properties.groups.push(
|
|
68
|
-
"service-config",
|
|
69
|
-
location,
|
|
70
|
-
"keepalived"
|
|
71
|
-
);
|
|
67
|
+
packageData.properties.groups.push("service-config", name, "keepalived");
|
|
72
68
|
|
|
73
69
|
const extra = [];
|
|
74
70
|
|
|
@@ -91,6 +87,7 @@ export class Cluster extends Host {
|
|
|
91
87
|
""
|
|
92
88
|
];
|
|
93
89
|
|
|
90
|
+
const credentials = [];
|
|
94
91
|
for (const cluster of [...this.owner.clusters].sort((a, b) =>
|
|
95
92
|
a.name.localeCompare(b.name)
|
|
96
93
|
)) {
|
|
@@ -123,12 +120,14 @@ export class Cluster extends Host {
|
|
|
123
120
|
reducedPrio = cluster.backups.indexOf(ni) + 5;
|
|
124
121
|
}
|
|
125
122
|
|
|
123
|
+
const credential = cluster.name.toUpperCase() + "_PASSWORD";
|
|
124
|
+
credentials.push(credential);
|
|
126
125
|
cfg.push(` priority ${host.priority - reducedPrio}`);
|
|
127
126
|
cfg.push(" smtp_alert");
|
|
128
127
|
cfg.push(" advert_int 5");
|
|
129
128
|
cfg.push(" authentication {");
|
|
130
129
|
cfg.push(" auth_type PASS");
|
|
131
|
-
cfg.push(" auth_pass
|
|
130
|
+
cfg.push(" auth_pass ${" + credential + "}");
|
|
132
131
|
cfg.push(" }");
|
|
133
132
|
|
|
134
133
|
cfg.push(
|
|
@@ -218,6 +217,18 @@ export class Cluster extends Host {
|
|
|
218
217
|
`Conflicts=${cluster.name}-master.target ${cluster.name}-backup.target`
|
|
219
218
|
]
|
|
220
219
|
);
|
|
220
|
+
|
|
221
|
+
await writeLines(
|
|
222
|
+
join(packageStagingDir, "/usr/lib/systemd/system/keepalived.d"),
|
|
223
|
+
`use-credentials.conf`,
|
|
224
|
+
[
|
|
225
|
+
"[Service]",
|
|
226
|
+
...credentials.map(
|
|
227
|
+
c =>
|
|
228
|
+
`LoadCredentialEncrypted=${c}:/etc/credstore.encrypted/keepalived.password`
|
|
229
|
+
)
|
|
230
|
+
]
|
|
231
|
+
);
|
|
221
232
|
}
|
|
222
233
|
|
|
223
234
|
await writeLines(
|
|
@@ -64,7 +64,7 @@ export class wlan extends ethernet {
|
|
|
64
64
|
|
|
65
65
|
await writeLines(
|
|
66
66
|
join(dir, "usr/lib/systemd/system/iwd.service.d/"),
|
|
67
|
-
"
|
|
67
|
+
"credentials.conf",
|
|
68
68
|
[
|
|
69
69
|
sectionLines("Service", {
|
|
70
70
|
LoadCredentialEncrypted: `${secretName}:/etc/credstore.encrypted/${secretName}`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import {
|
|
2
|
+
default_attribute_writable,
|
|
3
|
+
string_collection_attribute_writable,
|
|
4
|
+
string_attribute_writable,
|
|
5
|
+
integer_attribute_writable,
|
|
6
|
+
hostname_attribute as hostname_attribute_base,
|
|
7
|
+
boolean_attribute_writable
|
|
8
|
+
} from "pacc";
|
|
9
|
+
|
|
10
|
+
export const networkAddressType = "network|host|network_interface";
|
|
11
|
+
|
|
12
|
+
export const networks_attribute = {
|
|
13
|
+
...default_attribute_writable,
|
|
14
|
+
name: "networks",
|
|
15
|
+
type: "network",
|
|
16
|
+
collection: true
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const psk_attribute = { ...string_attribute_writable, name: "psk" };
|
|
20
|
+
export const ssid_attribute = { ...string_attribute_writable, name: "ssid" };
|
|
21
|
+
export const hostname_attribute = {
|
|
22
|
+
...hostname_attribute_base,
|
|
23
|
+
name: "hostName",
|
|
24
|
+
writable: true
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export const networkAttributes = {
|
|
28
|
+
scope: {
|
|
29
|
+
...string_attribute_writable,
|
|
30
|
+
name: "scope",
|
|
31
|
+
values: ["global", "site", "link", "host"]
|
|
32
|
+
// default: "global"
|
|
33
|
+
},
|
|
34
|
+
class: {
|
|
35
|
+
...string_attribute_writable,
|
|
36
|
+
name: "class",
|
|
37
|
+
values: ["10GBASE-T", "1000BASE-T", "100BASE-T", "10BASE-T"]
|
|
38
|
+
},
|
|
39
|
+
kind: {
|
|
40
|
+
...string_attribute_writable,
|
|
41
|
+
name: "kind",
|
|
42
|
+
values: ["loopback", "ethernet", "wlan", "wireguard", "fiber", "dsl"]
|
|
43
|
+
},
|
|
44
|
+
ssid: ssid_attribute,
|
|
45
|
+
psk: psk_attribute,
|
|
46
|
+
secretName: { ...string_attribute_writable, name: "secretName" },
|
|
47
|
+
metric: { ...integer_attribute_writable, name: "metric" /*default: 1004*/ },
|
|
48
|
+
mtu: { ...integer_attribute_writable, name: "mtu", default: 1500 },
|
|
49
|
+
gateway: { ...default_attribute_writable, name: "gateway", type: "host" },
|
|
50
|
+
multicastDNS: { ...boolean_attribute_writable, name: "multicastDNS" }
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const networkAddressAttributes = {
|
|
54
|
+
hostName: hostname_attribute,
|
|
55
|
+
cidrAddresses: {
|
|
56
|
+
...string_collection_attribute_writable,
|
|
57
|
+
name: "cidrAddresses"
|
|
58
|
+
},
|
|
59
|
+
cidrAddress: { ...string_attribute_writable, name: "cidrAddress" },
|
|
60
|
+
addresses: { ...string_collection_attribute_writable, name: "addresses" },
|
|
61
|
+
address: { ...string_attribute_writable, name: "address" }
|
|
62
|
+
};
|