pmcf 2.26.0 → 2.27.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/package.json +1 -1
- package/src/services/dns.mjs +35 -7
package/package.json
CHANGED
package/src/services/dns.mjs
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
dnsRecordTypeForAddressFamily,
|
|
10
10
|
sortZoneRecords
|
|
11
11
|
} from "../dns-utils.mjs";
|
|
12
|
+
import { Endpoint, serviceEndpoints } from "pmcf";
|
|
12
13
|
import { addType } from "../types.mjs";
|
|
13
14
|
import { ServiceTypeDefinition, serviceAddresses } from "../service.mjs";
|
|
14
15
|
import {
|
|
@@ -69,6 +70,20 @@ const DNSServiceTypeDefinition = {
|
|
|
69
70
|
}
|
|
70
71
|
};
|
|
71
72
|
|
|
73
|
+
const rdncEndpoint = {
|
|
74
|
+
type: "rdnc",
|
|
75
|
+
port: 953,
|
|
76
|
+
protocol: "tcp",
|
|
77
|
+
tls: false
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const statisticsEndpoint = {
|
|
81
|
+
type: "bind-statistics",
|
|
82
|
+
port: 19521,
|
|
83
|
+
protocol: "tcp",
|
|
84
|
+
tls: false
|
|
85
|
+
};
|
|
86
|
+
|
|
72
87
|
const DNS_SERVICE_FILTER = { type: DNSServiceTypeDefinition.name };
|
|
73
88
|
|
|
74
89
|
function addressList(objects) {
|
|
@@ -123,6 +138,19 @@ export class DNSService extends ExtraSourceService {
|
|
|
123
138
|
return DNSServiceTypeDefinition.name;
|
|
124
139
|
}
|
|
125
140
|
|
|
141
|
+
endpoints(filter) {
|
|
142
|
+
const endpoints = super.endpoints(filter);
|
|
143
|
+
|
|
144
|
+
for (const na of this.server.networkAddresses(
|
|
145
|
+
na => na.networkInterface.kind === "localhost"
|
|
146
|
+
)) {
|
|
147
|
+
endpoints.push(new Endpoint(this, na, rdncEndpoint));
|
|
148
|
+
endpoints.push(new Endpoint(this, na, statisticsEndpoint));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return endpoints;
|
|
152
|
+
}
|
|
153
|
+
|
|
126
154
|
get soaUpdates() {
|
|
127
155
|
return [this.serial, this.refresh, this.retry, this.expire, this.minimum];
|
|
128
156
|
}
|
|
@@ -202,15 +230,15 @@ export class DNSService extends ExtraSourceService {
|
|
|
202
230
|
}
|
|
203
231
|
};
|
|
204
232
|
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
serviceAddresses(this.source, DNS_SERVICE_FILTER)
|
|
233
|
+
const forwarders = new Set(
|
|
234
|
+
serviceEndpoints(this.source, DNS_SERVICE_FILTER).map(e => e.address)
|
|
208
235
|
);
|
|
209
|
-
|
|
236
|
+
|
|
237
|
+
if (forwarders.size) {
|
|
210
238
|
await writeLines(
|
|
211
239
|
join(p1, "etc/named/options"),
|
|
212
240
|
`forwarders.conf`,
|
|
213
|
-
|
|
241
|
+
addressesStatement("forwarders", forwarders)
|
|
214
242
|
);
|
|
215
243
|
}
|
|
216
244
|
|
|
@@ -223,7 +251,7 @@ export class DNSService extends ExtraSourceService {
|
|
|
223
251
|
if (acls.length) {
|
|
224
252
|
await writeLines(join(p1, "etc/named"), `0-acl-${name}.conf`, acls);
|
|
225
253
|
}
|
|
226
|
-
if (
|
|
254
|
+
if (forwarders.size || acls.length) {
|
|
227
255
|
yield packageData;
|
|
228
256
|
}
|
|
229
257
|
|
|
@@ -424,7 +452,7 @@ async function generateZoneDefs(dns, location, packageData) {
|
|
|
424
452
|
|
|
425
453
|
for (const foreignDomainName of host.foreignDomainNames) {
|
|
426
454
|
zone.records.add(
|
|
427
|
-
DNSRecord("
|
|
455
|
+
DNSRecord("outfacing", "PTR", dnsFullName(foreignDomainName))
|
|
428
456
|
);
|
|
429
457
|
}
|
|
430
458
|
|