I am creating a script that includes a function to update several rrsets:
domain='krokinole.de'
curl_opts='-GsS -m 5 --retry 5 --retry-max-time 60'
auth_opts='Authorization: Token [redacted]'
function dns_update ()
{
curl -X PATCH ${curl_opts} \
"https://desec.io/api/v1/domains/${domain}/rrsets/" \
--header "Content-Type: application/json" --header "${auth_opts}" \
-d @- <<EOF
[
{"subname": "sarkovy, "type": "CNAME", "ttl": 3600, "records": ["${1}"]},
{"subname": "mail", "type": "CNAME", "ttl": 3600, "records": ["${1}"]},
{"subname": "", "type": "MX", "records": ["10 ${1}"]}
]
EOF
}
The function argument is a valid domain string. I copied the code from here, slightly modified. Executing the function always produces an error from curl:
curl: (3) URL rejected: Malformed input to a URL function
I just can’t figure out the reason.