]> git.openstreetmap.org Git - dns.git/blob - dnsconfig.js
Add fastly domain verification records
[dns.git] / dnsconfig.js
1 var REG_NONE = NewRegistrar("none");
2 var REG_GANDI = NewRegistrar("gandi_v5");
3 var PROVIDER = NewDnsProvider("cloudflare");
4
5 var DOMAIN;
6 var REGISTRAR;
7 var DYNAMIC_RECORDS;
8
9 var QUALIFY = function (name) {
10   return name + "." + DOMAIN + ".";
11 };
12
13 function loadTemplate(template) {
14   return function (domain, registrar) {
15     DOMAIN = domain;
16     REGISTRAR = registrar;
17
18     require("src/" + template + ".js");
19   };
20 }
21
22 /**
23  * Create A, optional AAAA, and optional HTTPS (SVCB) records for an OSM web service,
24  * with optional Cloudflare proxy support.
25  *
26  * @param {string} name                - Hostname (e.g. "www").
27  * @param {string[]} servers           - Required array of servers.
28  * @param {Object} [options]           - Optional settings for HTTPS and Cloudflare.
29  * @param {boolean} [options.h1=false]  - If true, sets HTTPS apn=http1.1
30  * @param {boolean} [options.h2=true]  - If true, sets HTTPS apn=h2
31  * @param {boolean} [options.h3=false]  - If true, sets HTTPS apn=h3
32  * @param {boolean} [options.cfproxy=false] - If true, enables Cloudflare proxy on A/AAAA.
33  *
34  */
35 function osm_web_service(
36   name,
37   servers,
38   options
39 ) {
40
41   // If servers is a string, convert to a single-element array
42   if (typeof servers === "string") {
43     servers = [servers];
44   }
45
46   if (options === undefined) {
47     options = {};
48   }
49
50   // Set default values for options.h1, options.h2, and options.h3
51   options.h1 = options.h1 !== undefined ? options.h1 : false;
52   options.h2 = options.h2 !== undefined ? options.h2 : true;
53   options.h3 = options.h3 !== undefined ? options.h3 : false;
54
55   var records = [];
56   var ipv4s = [];
57   var ipv6s = [];
58
59   servers.forEach(function(serverName) {
60     if (IPV4[serverName]) {
61       ipv4s.push(IPV4[serverName]);
62       if (!options.cfproxy) {
63         records.push(A(name, IPV4[serverName]));
64       } else {
65         records.push(A(name, IPV4[serverName], CF_PROXY_ON));
66       }
67     }
68     if (IPV6[serverName]) {
69       ipv6s.push(IPV6[serverName]);
70       if (!options.cfproxy) {
71         records.push(AAAA(name, IPV6[serverName]));
72       } else {
73         records.push(AAAA(name, IPV6[serverName], CF_PROXY_ON));
74       }
75     }
76   });
77
78   if (ipv4s.length === 0 && ipv6s.length === 0) {
79     throw new Error("An IPv4 or IPv6 address is required for " + name + " service");
80   }
81
82   //
83   // Build a parameter string for DNSControl HTTPS() syntax.
84   // Example: "ipv4hint=1.2.3.4,1.2.3.5 ipv6hint=2001:db8::1,2001:db8::2 alpn=h2"
85   //
86   var paramParts = [];
87   if (ipv4s.length > 0) {
88     // Join IPv4 addresses with comma+space
89     paramParts.push("ipv4hint=" + ipv4s.join(","));
90   }
91   if (ipv6s.length > 0) {
92     // Join IPv6 addresses with comma+space
93     paramParts.push("ipv6hint=" + ipv6s.join(","));
94   }
95
96   if (options.h1 || options.h2 || options.h3) {
97     var paramPartsALPN = [];
98     if (options.h3) {
99       paramPartsALPN.push("h3");
100     }
101     if (options.h2) {
102       paramPartsALPN.push("h2");
103     }
104     if (options.h1) {
105       paramPartsALPN.push("http/1.1");
106     }
107     paramParts.push("alpn=" + paramPartsALPN.join(","));
108   }
109
110   // Join the parts with a space
111   var paramString = paramParts.join(" ");
112
113   // Create the HTTPS record with 4 arguments
114   records.push(HTTPS(name, 1, ".", paramString));
115
116
117   return records;
118 }
119
120 // Ensure that the reverse DNS records are in RFC 4183 notation
121 REVCOMPAT("rfc4183");
122
123 var IPV4 = require("src/ipv4.json");
124 var IPV6 = require("src/ipv6.json");
125
126 var HOST_RECORDS = [];
127
128 for (var name in IPV4) {
129   HOST_RECORDS.push(A(name, IPV4[name]));
130 }
131
132 for (var name in IPV6) {
133   HOST_RECORDS.push(AAAA(name, IPV6[name]));
134 }
135
136 var OPENSTREETMAP = loadTemplate("openstreetmap");
137 var OPENSTREETMAP_MINIMAL = loadTemplate("openstreetmap-minimal");
138
139 require("include/sshfp.js");
140 require("include/nominatim.js");
141
142 try {
143   require("include/geo.js");
144 } catch (e) {
145   var GEO_NS_RECORDS = [];
146 }
147
148 // Publish CAA records indicating that only letsencrypt and globalsign (Fastly) should issue certificates
149 var OSM_CAA = [
150   CAA_BUILDER({
151     label: "@",
152     ttl: "1h",
153     iodef: "mailto:hostmaster@openstreetmap.org",
154     issue: [
155       "letsencrypt.org",
156       "globalsign.com",   // Used by Fastly for CDN certificates
157     ],
158     issuewild: [
159       "letsencrypt.org",
160       "globalsign.com",   // Used by Fastly for CDN certificates
161     ],
162   }),
163 ];
164
165 OPENSTREETMAP("openstreetmap.org", REG_GANDI);
166 OPENSTREETMAP("openstreetmap.com", REG_GANDI);
167 OPENSTREETMAP("openstreetmap.net", REG_GANDI);
168 OPENSTREETMAP_MINIMAL("openstreetmap.ca", REG_GANDI); // Richard Weait managed the registration
169 OPENSTREETMAP("openstreetmap.eu", REG_NONE); // fossgis.de manages the registration
170 OPENSTREETMAP("openstreetmap.pro", REG_GANDI);
171 OPENSTREETMAP_MINIMAL("openstreetmap.gay", REG_GANDI);
172 OPENSTREETMAP("openstreetmaps.org", REG_GANDI);
173 OPENSTREETMAP("osm.org", REG_GANDI);
174 OPENSTREETMAP("openmaps.org", REG_GANDI);
175 OPENSTREETMAP("openstreetmap.io", REG_GANDI);
176 OPENSTREETMAP("osm.io", REG_GANDI);
177 OPENSTREETMAP_MINIMAL("openstreetmap.li", REG_GANDI);
178 OPENSTREETMAP("openworldmap.org", REG_GANDI);
179 OPENSTREETMAP("freeosm.org", REG_GANDI);
180 OPENSTREETMAP("open-maps.org", REG_GANDI);
181 OPENSTREETMAP("open-maps.com", REG_GANDI);
182 OPENSTREETMAP("osmbugs.org", REG_GANDI);
183 OPENSTREETMAP_MINIMAL("openstreetmap.ai", REG_GANDI);
184 OPENSTREETMAP_MINIMAL("openstreetmap.am", REG_GANDI);
185 OPENSTREETMAP_MINIMAL("openstreetmap.fi", REG_GANDI);
186 OPENSTREETMAP_MINIMAL("openstreetmap.gr", REG_GANDI);
187 OPENSTREETMAP_MINIMAL("openstreetmap.me", REG_GANDI);
188 OPENSTREETMAP_MINIMAL("openstreetmap.mx", REG_GANDI);
189 OPENSTREETMAP_MINIMAL("openstreetmap.pe", REG_GANDI);
190 OPENSTREETMAP_MINIMAL("openstreetmap.ph", REG_GANDI);
191 OPENSTREETMAP_MINIMAL("openstreetmap.se", REG_GANDI); // Transfer to OSMF care 23 Sept 2025
192 OPENSTREETMAP_MINIMAL("openstreetmap.sg", REG_GANDI);
193 OPENSTREETMAP_MINIMAL("openstreetmap.tv", REG_GANDI);
194 OPENSTREETMAP_MINIMAL("openstreetmap.wales", REG_GANDI);
195 OPENSTREETMAP("openstreetmapdata.org", REG_GANDI);
196
197 // Disable due to registration issue
198 // OPENSTREETMAP("openstreetmap.al", REG_NONE);
199
200 D_EXTEND("openstreetmap.org",
201   CNAME("_acme-challenge.tile", "bxve5ryiwwv7woiraq.fastly-validations.com.", TTL("10m")),
202
203   // Uptime site at StatusCake
204   CNAME("uptime", "uptimessl-new.statuscake.com."),
205
206   HOST_RECORDS,
207   SSHFP_RECORDS,
208   GEO_NS_RECORDS,
209   NOMINATIM_RECORDS
210 );
211
212 D_EXTEND("osm.org",
213   CNAME("_acme-challenge.tile", "21gvdfyyxjoc4lmsem.fastly-validations.com.", TTL("10m")),
214
215   HOST_RECORDS,
216   SSHFP_RECORDS
217 );
218
219 // Add TXT records for Fastly domain verification
220 D_EXTEND("openstreetmap.com",
221     TXT("@", "fastly-domain-delegation-fddelt00562353-11-27-25")
222 );
223
224 // Add TXT records for Fastly domain verification
225 D_EXTEND("openstreetmaps.org",
226     TXT("@", "fastly-domain-delegation-fddelt00562353-11-27-25")
227 );
228
229 // Mastodon redirects to en.osm.town
230 var OPENSTREETMAP_TOWN = loadTemplate("openstreetmap-town");
231 OPENSTREETMAP_TOWN("openstreetmap.town", REG_GANDI);
232
233 // Domain owned by Amanda McCann
234 // osm.town
235
236 // Managed independently by Guillaume Rischard
237 // openstreetmap.lu
238 // osm.lu
239
240 var OSM_LI = loadTemplate("osm-li");
241
242 OSM_LI("osm.li", REG_GANDI);
243
244 var OPENSTREETMAP_NZ = loadTemplate("openstreetmap-nz");
245
246 OPENSTREETMAP_NZ("openstreetmap.nz", REG_GANDI);
247 OPENSTREETMAP_NZ("openstreetmap.org.nz", REG_GANDI);
248
249 var OPENSTREETMAP_UK = loadTemplate("openstreetmap-uk");
250
251 OPENSTREETMAP_UK("openstreetmap.uk", REG_GANDI);
252 OPENSTREETMAP_UK("openstreetmap.org.uk", REG_GANDI);
253 OPENSTREETMAP_UK("openstreetmap.co.uk", REG_GANDI);
254
255 var OPENSTREETMAP_ZA = loadTemplate("openstreetmap-za");
256
257 OPENSTREETMAP_ZA("openstreetmap.org.za", REG_NONE); // Registration managed by Grant Slater via https://www.vweb.co.za/
258 OPENSTREETMAP_ZA("osm.org.za", REG_NONE); // Registration managed by Grant Slater via https://www.vweb.co.za/
259
260 var OSMFOUNDATION = loadTemplate("osmfoundation");
261
262 OSMFOUNDATION("osmfoundation.org", REG_GANDI);
263
264 var STATEOFTHEMAP = loadTemplate("stateofthemap");
265
266 STATEOFTHEMAP("stateofthemap.org", REG_GANDI);
267 STATEOFTHEMAP("stateofthemap.com", REG_GANDI);
268 STATEOFTHEMAP("sotm.org", REG_GANDI);
269
270 // The domain is registation is managed by FOSSGIS.de
271 var STATEOFTHEMAP_EU = loadTemplate("stateofthemap-eu");
272 STATEOFTHEMAP_EU("stateofthemap.eu", REG_NONE);
273
274 // State of the Map Madagascar
275 var OPENSTREETMAP_MG = loadTemplate("openstreetmap-mg");
276 OPENSTREETMAP_MG("openstreetmap.mg", REG_GANDI);
277
278 var OPENGEODATA = loadTemplate("opengeodata");
279 OPENGEODATA("opengeodata.org", REG_GANDI);
280
281 var SWITCH2OSM = loadTemplate("switch2osm");
282
283 SWITCH2OSM("switch2osm.org", REG_GANDI);
284 SWITCH2OSM("switch2osm.com", REG_GANDI);
285
286 var OSM2PGSQL = loadTemplate("osm2pgsql");
287
288 OSM2PGSQL("osm2pgsql.org", REG_GANDI);
289 OSM2PGSQL("osm2pgsql.com", REG_GANDI);
290
291 var IDEDITOR = loadTemplate("ideditor");
292
293 IDEDITOR("ideditor.com", REG_GANDI);
294
295 var OSMWIKI = loadTemplate("osm-wiki");
296 OSMWIKI("osm.wiki", REG_GANDI);
297
298 var PTR_HE_AMS_IPV4 = loadTemplate("ptr_he_ams_ipv4");
299
300 PTR_HE_AMS_IPV4(REV("184.104.179.128/27"), REG_NONE);
301
302 var PTR_HE_AMS_IPV6 = loadTemplate("ptr_he_ams_ipv6");
303
304 PTR_HE_AMS_IPV6(REV("2001:470:1:fa1::/64"), REG_NONE);
305
306 var PTR_HE_DUB_IPV4 = loadTemplate("ptr_he_dub_ipv4");
307
308 PTR_HE_DUB_IPV4(REV("184.104.226.96/27"), REG_NONE);
309
310 var PTR_HE_DUB_IPV6 = loadTemplate("ptr_he_dub_ipv6");
311
312 PTR_HE_DUB_IPV6(REV("2001:470:1:b3b::/64"), REG_NONE);
313
314 var PTR_EQUINIX_AMS_IPV4 = loadTemplate("ptr_equinix_ams_ipv4");
315
316 PTR_EQUINIX_AMS_IPV4(REV("82.199.86.96/27"), REG_NONE);
317
318 var PTR_EQUINIX_AMS_IPV6 = loadTemplate("ptr_equinix_ams_ipv6");
319
320 PTR_EQUINIX_AMS_IPV6(REV("2001:4d78:500:5e3::/64"), REG_NONE);
321
322 var PTR_EQUINIX_DUB_IPV4 = loadTemplate("ptr_equinix_dub_ipv4");
323
324 PTR_EQUINIX_DUB_IPV4(REV("87.252.214.96/27"), REG_NONE);
325
326 var PTR_EQUINIX_DUB_IPV6 = loadTemplate("ptr_equinix_dub_ipv6");
327
328 PTR_EQUINIX_DUB_IPV6(REV("2001:4d78:fe03:1c::/64"), REG_NONE);
329
330 // No immediate plans
331 // External DNS and hosting still up
332 // freethepostcode.org
333
334 // External DNS and hosting
335 // openstreetmap.cymru