all repos — dns @ ee65fd1640b90815954d260979a7116c8f15260c

DNS records for my domains, managed via dnscontrol

use TS Record type to store host data

Alin
commit

ee65fd1640b90815954d260979a7116c8f15260c

parent

002833547c73fe8c0e88954a305b01dd0617e775

3 files changed, 50 insertions(+), 6 deletions(-)

changed files
M dnsconfig.jsdnsconfig.js
@@ -7,6 +7,36 @@ /// <reference path="helpers.js" />
require_glob("./helpers.js") /** + * @typedef {Object} SSHFPConfig + * @property {0 | 1 | 2 | 3 | 4} algo + * @property {0 | 1 | 2} type + * @property {string} fingerprint + */ + +/** + * @typedef {Object} HostConfig + * @property {string} v4 - IPv4 address for the host + * @property {string} v6 - IPv6 address for the host + * @property {SSHFPConfig[]} [sshfp] - SSH fingerprints (use `just get-ssh-host-key $hostname`) + */ + +/** + * @type {Record<string, HostConfig>} + */ +var hosts = { + hasel: { + v4: '185.55.243.110', + v6: '2a00:1913:682b::', + sshfp: [ + { algo: 1, type: 1, fingerprint: "4ab581a1f0d115678e6724e2d865208ab195ccd6" }, + { algo: 1, type: 2, fingerprint: "f50a2082a18b4bcf96c3f94c9554312468e67c65ef44a936c8d12933dc2416a8" }, + { algo: 4, type: 1, fingerprint: "664e7f23544b9c758ee66d5f8164db7a6d5970e8" }, + { algo: 4, type: 2, fingerprint: "27a1dbd525c0efe21f56dba96dfcd7c7bdb07756e510ca15e2626e23ef2483b6" }, + ] + }, +} + +/** * @param {string} name * @param {RecordModifier[]} [modifiers] */
@@ -168,12 +198,7 @@ IGNORE('home', 'A,AAAA'),
IGNORE('_acme-challenge', 'TXT'), IGNORE('_acme-challenge.**', 'TXT'), - A('hasel', '185.55.243.110'), - AAAA('hasel', '2a00:1913:682b::'), - SSHFP('hasel', 1, 1, '4ab581a1f0d115678e6724e2d865208ab195ccd6'), - SSHFP('hasel', 1, 2, 'f50a2082a18b4bcf96c3f94c9554312468e67c65ef44a936c8d12933dc2416a8'), - SSHFP('hasel', 4, 1, '664e7f23544b9c758ee66d5f8164db7a6d5970e8'), - SSHFP('hasel', 4, 2, '27a1dbd525c0efe21f56dba96dfcd7c7bdb07756e510ca15e2626e23ef2483b6'), + mkHostRecords('hasel', hosts.hasel), iCloudMail('alin.ovh', 'VgiTkEni66SwcRxU', ['a:hasel.alin.ovh']), DMARC_BUILDER({
M helpers.jshelpers.js
@@ -70,3 +70,17 @@ }),
CNAME('sig1._domainkey', 'sig1.dkim.' + domain + '.at.icloudmailadmin.com.'), ] } + +/** + * @param {string} name + * @param {HostConfig} host + */ +function mkHostRecords(name, host) { + return [A(name, host.v4), AAAA(name, host.v6)].concat( + host.sshfp + ? host.sshfp.map(function (sshfp) { + return SSHFP(name, sshfp.algo, sshfp.type, sshfp.fingerprint) + }) + : [] + ) +}
M justfilejustfile
@@ -20,3 +20,8 @@ lon update
update-types: update-types + +@get-ssh-host-key hostname: + # echo -n {{ hostname }} IN SSHFP 1 1 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa |\ + ssh-keyscan -q -D "{{ hostname }}" | \ + awk '{ printf "{ algo: %d, type: %d, fingerprint: \"%s\" },\n", $4, $5, $6 }'