Alles, was die Weboberfläche kann, geht auch per JSON-API: Zonen anlegen, Einträge pflegen, Zertifikate per DNS-01 holen.
https://fns.20101994.de/api/v1Authorization: Bearer fns_…{"error":{"code","message"}} mit passendem HTTP-Status (401, 403, 404, 422, 423, 429).Eintrag anlegen:
curl -X POST https://fns.20101994.de/api/v1/zones/example.de/records \
-H "Authorization: Bearer $FREENS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"www","type":"A","content":"203.0.113.10","ttl":300}'
Let's-Encrypt-Zertifikat mit acme.sh (DNS-01, auch Wildcards) – Hook-Skript:
# ~/.acme.sh/dnsapi/dns_freens.sh
dns_freens_add() {
curl -fsS -X POST "https://fns.20101994.de/api/v1/acme/challenge" \
-H "Authorization: Bearer $FREENS_TOKEN" -H "Content-Type: application/json" \
-d "{\"fqdn\":\"${1#_acme-challenge.}\",\"value\":\"$2\"}" >/dev/null
}
dns_freens_rm() {
curl -fsS -X DELETE "https://fns.20101994.de/api/v1/acme/challenge" \
-H "Authorization: Bearer $FREENS_TOKEN" -H "Content-Type: application/json" \
-d "{\"fqdn\":\"${1#_acme-challenge.}\",\"value\":\"$2\"}" >/dev/null
}
# Aufruf:
export FREENS_TOKEN=fns_...
acme.sh --issue --dns dns_freens -d example.de -d '*.example.de'
Mit certbot (manual-Hooks):
certbot certonly --manual --preferred-challenges dns \
--manual-auth-hook 'curl -fsS -X POST https://fns.20101994.de/api/v1/acme/challenge -H "Authorization: Bearer $FREENS_TOKEN" -H "Content-Type: application/json" -d "{\"fqdn\":\"$CERTBOT_DOMAIN\",\"value\":\"$CERTBOT_VALIDATION\"}" && sleep 30' \
--manual-cleanup-hook 'curl -fsS -X DELETE https://fns.20101994.de/api/v1/acme/challenge -H "Authorization: Bearer $FREENS_TOKEN" -H "Content-Type: application/json" -d "{\"fqdn\":\"$CERTBOT_DOMAIN\",\"value\":\"$CERTBOT_VALIDATION\"}"' \
-d example.de
Für Router gibt es zusätzlich den dyndns2-kompatiblen Endpunkt /api/dyndns.php mit eigenen DynDNS-Keys (unter DynDNS). Antworten: good, nochg, badauth, nohost, abuse, dnserr, 911.
curl -u "user:$DYNDNS_KEY" "https://fns.20101994.de/api/dyndns.php?hostname=home.example.de&myip=203.0.113.7"