script all missing HTTPS records
1 file changed, 15 insertions(+), 15 deletions(-)
changed files
M add_https.sh → add_https.sh
@@ -1,29 +1,22 @@ #!/usr/bin/env bash -for dom in alanpearce.{eu,uk} aln.pe; do - xh PATCH $POWERDNS_API_URL/api/v1/servers/localhost/zones/${dom}. \ +add_https() { + zone="$1" + domain="$2" + alpn="${3:-h2}" + echo "zone: ${zone} adding HTTPS record for ${domain} with alpn=${alpn}" + xh --print=b PATCH $POWERDNS_API_URL/api/v1/servers/localhost/zones/${zone}. \ X-API-KEY:$POWERDNS_API_KEY <<JSON { "rrsets": [ { - "name": "${dom}.", - "type": "HTTPS", - "ttl": 86400, - "changetype": "REPLACE", - "records": [ - { - "content": "1 . alpn=h2" - } - ] - }, - { - "name": "www.${dom}.", + "name": "${domain}.", "type": "HTTPS", "ttl": 86400, "changetype": "REPLACE", "records": [ { - "content": "1 . alpn=h2" + "content": "1 . alpn=${alpn}" } ] }@@ -31,4 +24,11 @@ ] } JSON +} + +for domain in alanpearce.{eu,uk}; do + add_https $domain $domain + add_https $domain www.$domain done + +add_https alanpearce.eu linde.alanpearce.eu "h3,h2"