pmcf 2.35.0 → 2.35.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 +1 -1
- package/src/host.mjs +2 -2
- package/src/network-address.mjs +14 -0
- package/src/network-interfaces/network-interface.mjs +1 -2
- package/src/network-interfaces/skeleton.mjs +1 -2
- package/src/network-support.mjs +0 -8
- package/src/service.mjs +0 -5
- package/src/services/dns.mjs +15 -23
- package/src/services/ntp.mjs +1 -1
- package/src/services/systemd-resolved.mjs +1 -1
- package/src/services/systemd-timesyncd.mjs +1 -1
- package/types/network-address.d.mts +2 -0
- package/types/network-support.d.mts +0 -2
package/package.json
CHANGED
package/src/host.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readFile } from "node:fs/promises";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
|
-
import { ServiceOwner, Base } from "pmcf";
|
|
5
|
-
import { networkAddressProperties
|
|
4
|
+
import { ServiceOwner, Base, addresses } from "pmcf";
|
|
5
|
+
import { networkAddressProperties } from "./network-support.mjs";
|
|
6
6
|
import {
|
|
7
7
|
domainFromDominName,
|
|
8
8
|
domainName,
|
package/src/network-address.mjs
CHANGED
|
@@ -31,3 +31,17 @@ export class NetworkAddress {
|
|
|
31
31
|
return `${this.networkInterface.fullName} ${decodeIP(this.address)}`;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
+
|
|
35
|
+
export function addresses(networkAddresses) {
|
|
36
|
+
return [
|
|
37
|
+
...new Set(
|
|
38
|
+
[...networkAddresses].map(object =>
|
|
39
|
+
/*object?.name ||*/ decodeIP(object.address)
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function cidrAddresses(networkAddresses) {
|
|
46
|
+
return [...networkAddresses].map(na => na.cidrAddress);
|
|
47
|
+
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { hasWellKnownSubnet, normalizeIP } from "ip-utilties";
|
|
3
|
-
import { Base } from "pmcf";
|
|
3
|
+
import { Base, cidrAddresses } from "pmcf";
|
|
4
4
|
import {
|
|
5
5
|
networkProperties,
|
|
6
6
|
networkAddressProperties
|
|
7
7
|
} from "../network-support.mjs";
|
|
8
8
|
import { asArray, writeLines, sectionLines } from "../utils.mjs";
|
|
9
9
|
import { addType } from "../types.mjs";
|
|
10
|
-
import { cidrAddresses } from "../network-support.mjs";
|
|
11
10
|
import { SkeletonNetworkInterface } from "./skeleton.mjs";
|
|
12
11
|
|
|
13
12
|
export const NetworkInterfaceTypeDefinition = {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { writeLines, sectionLines } from "../utils.mjs";
|
|
3
|
-
import { NetworkAddress, Host } from "pmcf";
|
|
3
|
+
import { NetworkAddress, Host, cidrAddresses } from "pmcf";
|
|
4
4
|
import { ServiceOwner } from "../service-owner.mjs";
|
|
5
|
-
import { cidrAddresses } from "../network-support.mjs";
|
|
6
5
|
|
|
7
6
|
export class SkeletonNetworkInterface extends ServiceOwner {
|
|
8
7
|
_extends = [];
|
package/src/network-support.mjs
CHANGED
|
@@ -38,11 +38,3 @@ export const networkAddressProperties = {
|
|
|
38
38
|
addresses: { type: "string", collection: true, writeable: false },
|
|
39
39
|
address: { type: "string", collection: false, writeable: false }
|
|
40
40
|
};
|
|
41
|
-
|
|
42
|
-
export function addresses(networkAddresses) {
|
|
43
|
-
return [...networkAddresses].map(na => na.address);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function cidrAddresses(networkAddresses) {
|
|
47
|
-
return [...networkAddresses].map(na => na.cidrAddress);
|
|
48
|
-
}
|
package/src/service.mjs
CHANGED
|
@@ -10,11 +10,6 @@ import {
|
|
|
10
10
|
} from "./dns-utils.mjs";
|
|
11
11
|
|
|
12
12
|
const ServiceTypes = {
|
|
13
|
-
"systemd-resolved": { endpoints: [] },
|
|
14
|
-
"systemd-timesyncd": { endpoints: [] },
|
|
15
|
-
"systemd-journal": { endpoints: [] },
|
|
16
|
-
"systemd-journal-remote": { endpoints: [] },
|
|
17
|
-
"systemd-journal-upload": { endpoints: [] },
|
|
18
13
|
ntp: { endpoints: [{ protocol: "udp", port: 123, tls: false }] },
|
|
19
14
|
dns: { endpoints: [{ protocol: "udp", port: 53, tls: false }] },
|
|
20
15
|
ldap: { endpoints: [{ protocol: "tcp", port: 389, tls: false }] },
|
package/src/services/dns.mjs
CHANGED
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { createHmac } from "node:crypto";
|
|
3
3
|
import { FileContentProvider } from "npm-pkgbuild";
|
|
4
|
-
import { isLinkLocal, reverseArpa
|
|
5
|
-
import { writeLines } from "../utils.mjs";
|
|
4
|
+
import { isLinkLocal, reverseArpa } from "ip-utilties";
|
|
5
|
+
import { writeLines, asArray } from "../utils.mjs";
|
|
6
6
|
import {
|
|
7
7
|
DNSRecord,
|
|
8
8
|
dnsFullName,
|
|
9
9
|
dnsRecordTypeForAddressFamily,
|
|
10
10
|
sortZoneRecords
|
|
11
11
|
} from "../dns-utils.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ExtraSourceService,
|
|
14
|
+
Endpoint,
|
|
15
|
+
serviceEndpoints,
|
|
16
|
+
addresses
|
|
17
|
+
} from "pmcf";
|
|
13
18
|
import { addType } from "../types.mjs";
|
|
14
19
|
import { ServiceTypeDefinition } from "../service.mjs";
|
|
15
20
|
import { ExtraSourceServiceTypeDefinition } from "../extra-source-service.mjs";
|
|
16
|
-
import { addresses } from "../network-support.mjs";
|
|
17
21
|
import { addHook } from "../hooks.mjs";
|
|
18
22
|
|
|
19
23
|
const address_types = ["network", "host", "network_interface"];
|
|
@@ -87,23 +91,8 @@ const statisticsEndpoint = {
|
|
|
87
91
|
tls: false
|
|
88
92
|
};
|
|
89
93
|
|
|
90
|
-
function addressList(objects) {
|
|
91
|
-
return Array.from(objects).map(object => {
|
|
92
|
-
switch (typeof object) {
|
|
93
|
-
case "string":
|
|
94
|
-
return object;
|
|
95
|
-
case "object":
|
|
96
|
-
if (object.name) {
|
|
97
|
-
return object.name;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return decodeIP(object);
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
94
|
function addressesStatement(prefix, objects, generateEmpty = false) {
|
|
106
|
-
const body =
|
|
95
|
+
const body = asArray(objects).map(name => ` ${name};`);
|
|
107
96
|
|
|
108
97
|
if (body.length || generateEmpty) {
|
|
109
98
|
return [`${prefix} {`, body, "};"];
|
|
@@ -221,7 +210,7 @@ export class DNSService extends ExtraSourceService {
|
|
|
221
210
|
};
|
|
222
211
|
|
|
223
212
|
const forwarders = serviceEndpoints(this.source, {
|
|
224
|
-
services: { type: "dns", priority: ">=
|
|
213
|
+
services: { type: "dns", priority: ">=20" },
|
|
225
214
|
select: e => e.address
|
|
226
215
|
});
|
|
227
216
|
|
|
@@ -235,8 +224,11 @@ export class DNSService extends ExtraSourceService {
|
|
|
235
224
|
|
|
236
225
|
const acls = [
|
|
237
226
|
addressesStatement("acl trusted", addresses(this.trusted)),
|
|
238
|
-
addressesStatement("acl
|
|
239
|
-
addressesStatement("acl
|
|
227
|
+
addressesStatement("acl open", addresses(this.open), true),
|
|
228
|
+
addressesStatement("acl protected", [
|
|
229
|
+
...addresses(this.protected),
|
|
230
|
+
"!open"
|
|
231
|
+
])
|
|
240
232
|
].flat();
|
|
241
233
|
|
|
242
234
|
if (acls.length) {
|
package/src/services/ntp.mjs
CHANGED
|
@@ -52,7 +52,7 @@ export class SystemdResolvedService extends ExtraSourceService {
|
|
|
52
52
|
"Resolve",
|
|
53
53
|
{
|
|
54
54
|
DNS: serviceEndpoints(this, options("<10")),
|
|
55
|
-
FallbackDNS: serviceEndpoints(this, options(">=
|
|
55
|
+
FallbackDNS: serviceEndpoints(this, options(">=20")),
|
|
56
56
|
Domains: [...this.localDomains].join(" "),
|
|
57
57
|
DNSSEC: "no",
|
|
58
58
|
MulticastDNS: this.network.multicastDNS ? "yes" : "no",
|