From 5b6f6295c51cea2acd169e5b571bdc9d485bcb7a Mon Sep 17 00:00:00 2001 From: Peter Lehmann Date: Mon, 6 May 2024 01:08:45 +0200 Subject: [PATCH] Add trailing dot to cnames This makes the behavior consistent between NS, MX, SRV and CNAME records --- CHANGELOG.md | 10 ++++++++++ modules/records.nix | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..43f771e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# 2024-05-06 +If you use CNAMEs a trailing dot will now be added automatically. +This behavior is in line with other record types that use dns names. + +This breaks using subdomain paths in CNAMEs and if you are using full domain names +in CNAMEs you will need to remove the trailing dot in your config. + +`zones."example.org"."example".cname.data = "example2"`-> `example.example.org IN CNAME example2.` +You will now have to write it as: +`zones."example.org"."example".cname.data = "example2.example.org"`-> `example.example.org IN CNAME example2.example.org.` diff --git a/modules/records.nix b/modules/records.nix index a8c8334..32e7fb3 100644 --- a/modules/records.nix +++ b/modules/records.nix @@ -84,7 +84,7 @@ lib.mapAttrs ''; example = "foo.example.com"; type = with lib.types; nullOr str; # change str to lib.types.domain once it exists - apply = x: if x != null then lib.toList x else x; + apply = x: if x != null then lib.toList "${x}." else x; }; sub = { apply = lib.toList;