pmcf 2.33.2 → 2.33.4
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 +1 -1
- package/src/location.mjs +12 -19
- package/src/module.mjs +1 -0
- package/src/service.mjs +6 -1
- package/src/services/dns.mjs +28 -20
- package/src/services/ntp.mjs +19 -16
- package/src/services/systemd-journald.mjs +48 -0
- package/types/module.d.mts +1 -0
- package/types/services/dns.d.mts +11 -8
- package/types/services/ntp.d.mts +6 -3
- package/types/services/systemd-journald.d.mts +267 -0
package/package.json
CHANGED
package/src/location.mjs
CHANGED
|
@@ -70,27 +70,20 @@ export class Location extends Owner {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
const configs = [
|
|
74
|
+
{ type: "dns" },
|
|
75
|
+
{ type: "ntp" },
|
|
76
|
+
{ type: "systemd-journald" }
|
|
77
|
+
];
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
`${this.name}.conf`,
|
|
82
|
-
sectionLines("Journal", {
|
|
83
|
-
Compress: "yes",
|
|
84
|
-
SystemMaxUse: "500M",
|
|
85
|
-
SyncIntervalSec: "15m"
|
|
86
|
-
})
|
|
87
|
-
);
|
|
79
|
+
for (const cfg of configs) {
|
|
80
|
+
const service = this.findService(cfg);
|
|
88
81
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
82
|
+
if (service) {
|
|
83
|
+
const { name, content } = service.systemdConfig(this.name);
|
|
84
|
+
await writeLines(dir, name, sectionLines(...content));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
94
87
|
|
|
95
88
|
yield packageData;
|
|
96
89
|
}
|
package/src/module.mjs
CHANGED
package/src/service.mjs
CHANGED
|
@@ -11,6 +11,11 @@ import {
|
|
|
11
11
|
} from "./dns-utils.mjs";
|
|
12
12
|
|
|
13
13
|
const ServiceTypes = {
|
|
14
|
+
"systemd-resolved": { endpoints: [] },
|
|
15
|
+
"systemd-timesyncd": { endpoints: [] },
|
|
16
|
+
"systemd-journald": { endpoints: [] },
|
|
17
|
+
"systemd-journal-remote": { endpoints: [] },
|
|
18
|
+
"systemd-journal-upload": { endpoints: [] },
|
|
14
19
|
ntp: { endpoints: [{ protocol: "udp", port: 123, tls: false }] },
|
|
15
20
|
dns: { endpoints: [{ protocol: "udp", port: 53, tls: false }] },
|
|
16
21
|
ldap: { endpoints: [{ protocol: "tcp", port: 389, tls: false }] },
|
|
@@ -149,7 +154,7 @@ export class Service extends Base {
|
|
|
149
154
|
}
|
|
150
155
|
|
|
151
156
|
get host() {
|
|
152
|
-
if(this.owner instanceof Host) {
|
|
157
|
+
if (this.owner instanceof Host) {
|
|
153
158
|
return this.owner;
|
|
154
159
|
}
|
|
155
160
|
}
|
package/src/services/dns.mjs
CHANGED
|
@@ -210,24 +210,27 @@ export class DNSService extends ExtraSourceService {
|
|
|
210
210
|
return this._excludeInterfaceKinds;
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
|
|
214
|
-
return
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
213
|
+
systemdConfig(name) {
|
|
214
|
+
return {
|
|
215
|
+
name: `etc/systemd/resolved.conf.d/${name}.conf`,
|
|
216
|
+
content: [
|
|
217
|
+
"Resolve",
|
|
218
|
+
{
|
|
219
|
+
DNS: serviceAddresses(this, {
|
|
220
|
+
...DNS_SERVICE_FILTER,
|
|
221
|
+
priority: "<10"
|
|
222
|
+
}).join(" "),
|
|
223
|
+
FallbackDNS: serviceAddresses(this, {
|
|
224
|
+
...DNS_SERVICE_FILTER,
|
|
225
|
+
priority: ">=10"
|
|
226
|
+
}).join(" "),
|
|
227
|
+
Domains: [...this.localDomains].join(" "),
|
|
228
|
+
DNSSEC: "no",
|
|
229
|
+
MulticastDNS: this.network.multicastDNS ? "yes" : "no",
|
|
230
|
+
LLMNR: "no"
|
|
231
|
+
}
|
|
232
|
+
]
|
|
233
|
+
};
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
async *preparePackages(dir) {
|
|
@@ -367,7 +370,12 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
367
370
|
);
|
|
368
371
|
}
|
|
369
372
|
|
|
370
|
-
console.log(
|
|
373
|
+
console.log(
|
|
374
|
+
"LOCAL DOMAINS",
|
|
375
|
+
location.localDomains,
|
|
376
|
+
location.domain,
|
|
377
|
+
location.toString()
|
|
378
|
+
);
|
|
371
379
|
|
|
372
380
|
for (const domain of location.localDomains) {
|
|
373
381
|
const locationName = location.name;
|
|
@@ -418,7 +426,7 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
418
426
|
domainNames,
|
|
419
427
|
family
|
|
420
428
|
} of location.networkAddresses()) {
|
|
421
|
-
console.log("ADDRESS",address);
|
|
429
|
+
console.log("ADDRESS", address);
|
|
422
430
|
|
|
423
431
|
if (
|
|
424
432
|
!dns.exclude.has(networkInterface.network) &&
|
package/src/services/ntp.mjs
CHANGED
|
@@ -48,21 +48,24 @@ export class NTPService extends ExtraSourceService {
|
|
|
48
48
|
return NTPServiceTypeDefinition.name;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
return
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
systemdConfig(name) {
|
|
52
|
+
return {
|
|
53
|
+
name: `etc/systemd/timesyncd.conf.d/${name}.conf`,
|
|
54
|
+
content: [
|
|
55
|
+
"Time",
|
|
56
|
+
{
|
|
57
|
+
NTP: serviceAddresses(
|
|
58
|
+
this,
|
|
59
|
+
{
|
|
60
|
+
...NTP_SERVICE_FILTER,
|
|
61
|
+
priority: "<20"
|
|
62
|
+
},
|
|
63
|
+
"domainName",
|
|
64
|
+
() => true
|
|
65
|
+
).join(" ")
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
};
|
|
66
69
|
}
|
|
67
70
|
|
|
68
71
|
async *preparePackages(dir) {
|
|
@@ -91,7 +94,7 @@ export class NTPService extends ExtraSourceService {
|
|
|
91
94
|
...NTP_SERVICE_FILTER,
|
|
92
95
|
priority: ">=10"
|
|
93
96
|
},
|
|
94
|
-
e => e.family ===
|
|
97
|
+
e => e.family === "IPv4" && e.networkInterface.kind !== "loopback"
|
|
95
98
|
).map(
|
|
96
99
|
endpoint =>
|
|
97
100
|
`${endpoint.service.isPool ? "pool" : "server"} ${
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Service, ServiceTypeDefinition } from "pmcf";
|
|
2
|
+
import { addType } from "../types.mjs";
|
|
3
|
+
|
|
4
|
+
const SystemdJournaldServiceTypeDefinition = {
|
|
5
|
+
name: "systemd-journald",
|
|
6
|
+
specializationOf: ServiceTypeDefinition,
|
|
7
|
+
owners: ServiceTypeDefinition.owners,
|
|
8
|
+
extends: ServiceTypeDefinition,
|
|
9
|
+
priority: 0.1,
|
|
10
|
+
properties: {}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export class SystemdJournaldService extends Service {
|
|
14
|
+
static {
|
|
15
|
+
addType(this);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
static get typeDefinition() {
|
|
19
|
+
return SystemdJournaldServiceTypeDefinition;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
constructor(owner, data) {
|
|
23
|
+
super(owner, data);
|
|
24
|
+
this.read(data, SystemdJournaldServiceTypeDefinition);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get type() {
|
|
28
|
+
return SystemdJournaldServiceTypeDefinition.name;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get systemdServices() {
|
|
32
|
+
return SystemdJournaldServiceTypeDefinition.name;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
systemdConfig(name) {
|
|
36
|
+
return {
|
|
37
|
+
name: `etc/systemd/journal.conf.d/${name}.conf`,
|
|
38
|
+
content: [
|
|
39
|
+
"Journal",
|
|
40
|
+
{
|
|
41
|
+
Compress: "yes",
|
|
42
|
+
SystemMaxUse: "500M",
|
|
43
|
+
SyncIntervalSec: "15m"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
package/types/module.d.mts
CHANGED
package/types/services/dns.d.mts
CHANGED
|
@@ -377,14 +377,17 @@ export class DNSService extends ExtraSourceService {
|
|
|
377
377
|
get exclude(): Set<any>;
|
|
378
378
|
set excludeInterfaceKinds(value: Set<any>);
|
|
379
379
|
get excludeInterfaceKinds(): Set<any>;
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
380
|
+
systemdConfig(name: any): {
|
|
381
|
+
name: string;
|
|
382
|
+
content: (string | {
|
|
383
|
+
DNS: string;
|
|
384
|
+
FallbackDNS: string;
|
|
385
|
+
Domains: string;
|
|
386
|
+
DNSSEC: string;
|
|
387
|
+
MulticastDNS: string;
|
|
388
|
+
LLMNR: string;
|
|
389
|
+
})[];
|
|
390
|
+
};
|
|
388
391
|
preparePackages(dir: any): AsyncGenerator<{
|
|
389
392
|
dir: string;
|
|
390
393
|
sources: FileContentProvider[];
|
package/types/services/ntp.d.mts
CHANGED
|
@@ -272,9 +272,12 @@ export class NTPService extends ExtraSourceService {
|
|
|
272
272
|
};
|
|
273
273
|
};
|
|
274
274
|
};
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
systemdConfig(name: any): {
|
|
276
|
+
name: string;
|
|
277
|
+
content: (string | {
|
|
278
|
+
NTP: string;
|
|
279
|
+
})[];
|
|
280
|
+
};
|
|
278
281
|
preparePackages(dir: any): AsyncGenerator<{
|
|
279
282
|
dir: any;
|
|
280
283
|
sources: FileContentProvider[];
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
export class SystemdJournaldService extends Service {
|
|
2
|
+
static get typeDefinition(): {
|
|
3
|
+
name: string;
|
|
4
|
+
specializationOf: {
|
|
5
|
+
name: string;
|
|
6
|
+
owners: string[];
|
|
7
|
+
priority: number;
|
|
8
|
+
extends: {
|
|
9
|
+
name: string;
|
|
10
|
+
owners: any[];
|
|
11
|
+
properties: {
|
|
12
|
+
owner: {
|
|
13
|
+
type: string;
|
|
14
|
+
collection: boolean;
|
|
15
|
+
writeable: boolean;
|
|
16
|
+
};
|
|
17
|
+
type: {
|
|
18
|
+
type: string;
|
|
19
|
+
collection: boolean;
|
|
20
|
+
writeable: boolean;
|
|
21
|
+
};
|
|
22
|
+
name: {
|
|
23
|
+
type: string;
|
|
24
|
+
collection: boolean;
|
|
25
|
+
identifier: boolean;
|
|
26
|
+
writeable: boolean;
|
|
27
|
+
};
|
|
28
|
+
description: {
|
|
29
|
+
type: string;
|
|
30
|
+
collection: boolean;
|
|
31
|
+
writeable: boolean;
|
|
32
|
+
};
|
|
33
|
+
priority: {
|
|
34
|
+
type: string;
|
|
35
|
+
collection: boolean;
|
|
36
|
+
writeable: boolean;
|
|
37
|
+
};
|
|
38
|
+
directory: {
|
|
39
|
+
type: string;
|
|
40
|
+
collection: boolean;
|
|
41
|
+
writeable: boolean;
|
|
42
|
+
};
|
|
43
|
+
packaging: {
|
|
44
|
+
type: string;
|
|
45
|
+
collection: boolean;
|
|
46
|
+
writeable: boolean;
|
|
47
|
+
};
|
|
48
|
+
tags: {
|
|
49
|
+
type: string;
|
|
50
|
+
collection: boolean;
|
|
51
|
+
writeable: boolean;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
specializations: {};
|
|
56
|
+
factoryFor(owner: any, value: any): any;
|
|
57
|
+
properties: {
|
|
58
|
+
ipAddresses: {
|
|
59
|
+
type: string;
|
|
60
|
+
collection: boolean;
|
|
61
|
+
writeable: boolean;
|
|
62
|
+
};
|
|
63
|
+
alias: {
|
|
64
|
+
type: string;
|
|
65
|
+
collection: boolean;
|
|
66
|
+
writeable: boolean;
|
|
67
|
+
};
|
|
68
|
+
weight: {
|
|
69
|
+
type: string;
|
|
70
|
+
collection: boolean;
|
|
71
|
+
writeable: boolean;
|
|
72
|
+
default: number;
|
|
73
|
+
};
|
|
74
|
+
systemd: {
|
|
75
|
+
type: string;
|
|
76
|
+
collection: boolean;
|
|
77
|
+
writeable: boolean;
|
|
78
|
+
};
|
|
79
|
+
port: {
|
|
80
|
+
type: string;
|
|
81
|
+
collection: boolean;
|
|
82
|
+
writeable: boolean;
|
|
83
|
+
};
|
|
84
|
+
protocol: {
|
|
85
|
+
type: string;
|
|
86
|
+
collection: boolean;
|
|
87
|
+
writeable: boolean;
|
|
88
|
+
values: string[];
|
|
89
|
+
};
|
|
90
|
+
type: {
|
|
91
|
+
type: string;
|
|
92
|
+
collection: boolean;
|
|
93
|
+
writeable: boolean;
|
|
94
|
+
};
|
|
95
|
+
tls: {
|
|
96
|
+
type: string;
|
|
97
|
+
collection: boolean;
|
|
98
|
+
writeable: boolean;
|
|
99
|
+
default: boolean;
|
|
100
|
+
};
|
|
101
|
+
hostName: {
|
|
102
|
+
type: string;
|
|
103
|
+
collection: boolean;
|
|
104
|
+
writeable: boolean;
|
|
105
|
+
};
|
|
106
|
+
cidrAddresses: {
|
|
107
|
+
type: string;
|
|
108
|
+
collection: boolean;
|
|
109
|
+
writeable: boolean;
|
|
110
|
+
};
|
|
111
|
+
cidrAddress: {
|
|
112
|
+
type: string;
|
|
113
|
+
collection: boolean;
|
|
114
|
+
writeable: boolean;
|
|
115
|
+
};
|
|
116
|
+
addresses: {
|
|
117
|
+
type: string;
|
|
118
|
+
collection: boolean;
|
|
119
|
+
writeable: boolean;
|
|
120
|
+
};
|
|
121
|
+
address: {
|
|
122
|
+
type: string;
|
|
123
|
+
collection: boolean;
|
|
124
|
+
writeable: boolean;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
owners: string[];
|
|
129
|
+
extends: {
|
|
130
|
+
name: string;
|
|
131
|
+
owners: string[];
|
|
132
|
+
priority: number;
|
|
133
|
+
extends: {
|
|
134
|
+
name: string;
|
|
135
|
+
owners: any[];
|
|
136
|
+
properties: {
|
|
137
|
+
owner: {
|
|
138
|
+
type: string;
|
|
139
|
+
collection: boolean;
|
|
140
|
+
writeable: boolean;
|
|
141
|
+
};
|
|
142
|
+
type: {
|
|
143
|
+
type: string;
|
|
144
|
+
collection: boolean;
|
|
145
|
+
writeable: boolean;
|
|
146
|
+
};
|
|
147
|
+
name: {
|
|
148
|
+
type: string;
|
|
149
|
+
collection: boolean;
|
|
150
|
+
identifier: boolean;
|
|
151
|
+
writeable: boolean;
|
|
152
|
+
};
|
|
153
|
+
description: {
|
|
154
|
+
type: string;
|
|
155
|
+
collection: boolean;
|
|
156
|
+
writeable: boolean;
|
|
157
|
+
};
|
|
158
|
+
priority: {
|
|
159
|
+
type: string;
|
|
160
|
+
collection: boolean;
|
|
161
|
+
writeable: boolean;
|
|
162
|
+
};
|
|
163
|
+
directory: {
|
|
164
|
+
type: string;
|
|
165
|
+
collection: boolean;
|
|
166
|
+
writeable: boolean;
|
|
167
|
+
};
|
|
168
|
+
packaging: {
|
|
169
|
+
type: string;
|
|
170
|
+
collection: boolean;
|
|
171
|
+
writeable: boolean;
|
|
172
|
+
};
|
|
173
|
+
tags: {
|
|
174
|
+
type: string;
|
|
175
|
+
collection: boolean;
|
|
176
|
+
writeable: boolean;
|
|
177
|
+
};
|
|
178
|
+
};
|
|
179
|
+
};
|
|
180
|
+
specializations: {};
|
|
181
|
+
factoryFor(owner: any, value: any): any;
|
|
182
|
+
properties: {
|
|
183
|
+
ipAddresses: {
|
|
184
|
+
type: string;
|
|
185
|
+
collection: boolean;
|
|
186
|
+
writeable: boolean;
|
|
187
|
+
};
|
|
188
|
+
alias: {
|
|
189
|
+
type: string;
|
|
190
|
+
collection: boolean;
|
|
191
|
+
writeable: boolean;
|
|
192
|
+
};
|
|
193
|
+
weight: {
|
|
194
|
+
type: string;
|
|
195
|
+
collection: boolean;
|
|
196
|
+
writeable: boolean;
|
|
197
|
+
default: number;
|
|
198
|
+
};
|
|
199
|
+
systemd: {
|
|
200
|
+
type: string;
|
|
201
|
+
collection: boolean;
|
|
202
|
+
writeable: boolean;
|
|
203
|
+
};
|
|
204
|
+
port: {
|
|
205
|
+
type: string;
|
|
206
|
+
collection: boolean;
|
|
207
|
+
writeable: boolean;
|
|
208
|
+
};
|
|
209
|
+
protocol: {
|
|
210
|
+
type: string;
|
|
211
|
+
collection: boolean;
|
|
212
|
+
writeable: boolean;
|
|
213
|
+
values: string[];
|
|
214
|
+
};
|
|
215
|
+
type: {
|
|
216
|
+
type: string;
|
|
217
|
+
collection: boolean;
|
|
218
|
+
writeable: boolean;
|
|
219
|
+
};
|
|
220
|
+
tls: {
|
|
221
|
+
type: string;
|
|
222
|
+
collection: boolean;
|
|
223
|
+
writeable: boolean;
|
|
224
|
+
default: boolean;
|
|
225
|
+
};
|
|
226
|
+
hostName: {
|
|
227
|
+
type: string;
|
|
228
|
+
collection: boolean;
|
|
229
|
+
writeable: boolean;
|
|
230
|
+
};
|
|
231
|
+
cidrAddresses: {
|
|
232
|
+
type: string;
|
|
233
|
+
collection: boolean;
|
|
234
|
+
writeable: boolean;
|
|
235
|
+
};
|
|
236
|
+
cidrAddress: {
|
|
237
|
+
type: string;
|
|
238
|
+
collection: boolean;
|
|
239
|
+
writeable: boolean;
|
|
240
|
+
};
|
|
241
|
+
addresses: {
|
|
242
|
+
type: string;
|
|
243
|
+
collection: boolean;
|
|
244
|
+
writeable: boolean;
|
|
245
|
+
};
|
|
246
|
+
address: {
|
|
247
|
+
type: string;
|
|
248
|
+
collection: boolean;
|
|
249
|
+
writeable: boolean;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
};
|
|
253
|
+
priority: number;
|
|
254
|
+
properties: {};
|
|
255
|
+
};
|
|
256
|
+
get type(): string;
|
|
257
|
+
get systemdServices(): string;
|
|
258
|
+
systemdConfig(name: any): {
|
|
259
|
+
name: string;
|
|
260
|
+
content: (string | {
|
|
261
|
+
Compress: string;
|
|
262
|
+
SystemMaxUse: string;
|
|
263
|
+
SyncIntervalSec: string;
|
|
264
|
+
})[];
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
import { Service } from "pmcf";
|