From 0d1d0092b8b534093adc506aa9931d9b4af2c6e3 Mon Sep 17 00:00:00 2001 From: Ilya Vassyutovich Date: Sun, 18 Oct 2026 09:34:17 +0300 Subject: [PATCH] dns_yc: use absolute record names (#7338) Record names were sent relative to the zone, derived from _sub_domain. That has no valid form when the TXT name is the zone apex, which happens with --domain-alias pointing at a dedicated zone: - YC_Zone_ID: _sub_domain ends up empty and the API rejects the request ("Length must be in the range of 1 to 254"). - YC_Folder_ID: _get_root returns the first label as _sub_domain, so the record lands at .. and validation never succeeds. The API accepts absolute names (trailing dot) everywhere a relative one is accepted, so send $fulldomain, which is already lowercased and dot-terminated. Ordinary _acme-challenge. names keep working. Supersedes #6862. --- dnsapi/dns_yc.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dnsapi/dns_yc.sh b/dnsapi/dns_yc.sh index 3af89d1b..0d7217db 100644 --- a/dnsapi/dns_yc.sh +++ b/dnsapi/dns_yc.sh @@ -106,13 +106,16 @@ dns_yc_add() { _debug _domain "$_domain" _debug "Getting txt records" - if ! _yc_rest GET "zones/${_domain_id}:getRecordSet?type=TXT&name=$_sub_domain"; then + if ! _yc_rest GET "zones/${_domain_id}:getRecordSet?type=TXT&name=$fulldomain"; then _err "Error: $response" return 1 fi _info "Adding record" - if _yc_rest POST "zones/$_domain_id:upsertRecordSets" "{\"merges\": [ { \"name\":\"$_sub_domain\",\"type\":\"TXT\",\"ttl\":\"120\",\"data\":[\"$txtvalue\"]}]}"; then + # The absolute name (trailing dot) also covers a record at the zone apex, + # e.g. with --domain-alias, which has no relative form: an empty name is + # rejected by the API. + if _yc_rest POST "zones/$_domain_id:upsertRecordSets" "{\"merges\": [ { \"name\":\"$fulldomain\",\"type\":\"TXT\",\"ttl\":\"120\",\"data\":[\"$txtvalue\"]}]}"; then if _contains "$response" "\"done\": *true"; then _info "Added, OK" return 0 @@ -167,7 +170,7 @@ dns_yc_rm() { # upsertRecordSets.deletions removes only the given value from the rrset, # leaving any other values at the same name (e.g. base + wildcard domain) # intact -- no need to read the current data set and recompute it. - if _yc_rest POST "zones/$_domain_id:upsertRecordSets" "{\"deletions\": [ { \"name\":\"$_sub_domain\",\"type\":\"TXT\",\"ttl\":\"120\",\"data\":[\"$txtvalue\"]}]}"; then + if _yc_rest POST "zones/$_domain_id:upsertRecordSets" "{\"deletions\": [ { \"name\":\"$fulldomain\",\"type\":\"TXT\",\"ttl\":\"120\",\"data\":[\"$txtvalue\"]}]}"; then if _contains "$response" "\"done\": *true"; then _info "Delete, OK" return 0