From 901f007cd1be75aa683d11b2e2b383a9b9f9b8a2 Mon Sep 17 00:00:00 2001 From: Rabin Yasharzadehe Date: Thu, 14 Sep 2023 16:08:07 +0300 Subject: [PATCH 1/2] Fix NS line for the zone file There was a missing `@` at the beginning of the NS record, which caused the line to be invalid, and we didn't get any alerts about it on zone re/load. This also broke recourse query for the NS, as the query will be passed to the internal DNS, but the record is missing. Signed-off-by: Rabin Yasharzadehe --- pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go b/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go index af37625..923e401 100644 --- a/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go +++ b/pkg/zonemgr/internal/zone-file-cache/zone_file_cache.go @@ -76,7 +76,7 @@ func (zoneFileCache *ZoneFileCache) generateHeaderSuffix() { zoneFileCache.headerSuf = fmt.Sprintf(" %s %s %s %s)\n", refresh, retry, expire, ttl) if zoneFileCache.nameServerIP != "" { - zoneFileCache.headerSuf += fmt.Sprintf("IN NS %s.\n", zoneFileCache.nameServerName) + zoneFileCache.headerSuf += fmt.Sprintf("@ IN NS %s.\n", zoneFileCache.nameServerName) zoneFileCache.headerSuf += fmt.Sprintf("%s IN A %s\n", nameServerDefault, zoneFileCache.nameServerIP) } } From 5e2942a4d41079a2bad79c56e1ad66c95fc72792 Mon Sep 17 00:00:00 2001 From: Rabin Yasharzadehe Date: Thu, 14 Sep 2023 18:39:23 +0300 Subject: [PATCH 2/2] Update zone_file_cache_test.go to pass unit test Signed-off-by: Rabin Yasharzadehe --- pkg/zonemgr/internal/zone-file-cache/zone_file_cache_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/zonemgr/internal/zone-file-cache/zone_file_cache_test.go b/pkg/zonemgr/internal/zone-file-cache/zone_file_cache_test.go index 7a41002..9b8c991 100644 --- a/pkg/zonemgr/internal/zone-file-cache/zone_file_cache_test.go +++ b/pkg/zonemgr/internal/zone-file-cache/zone_file_cache_test.go @@ -24,7 +24,7 @@ var _ = Describe("cached zone file content maintenance", func() { Describe("cached zone file initialization", func() { const ( headerDefault = "$ORIGIN vm. \n$TTL 3600 \n@ IN SOA ns.vm. email.vm. (0 3600 3600 1209600 3600)\n" - headerCustomFmt = "$ORIGIN vm.%s. \n$TTL 3600 \n@ IN SOA ns.vm.%s. email.vm.%s. (0 3600 3600 1209600 3600)\nIN NS ns.vm.%s.\nns IN A %s\n" + headerCustomFmt = "$ORIGIN vm.%s. \n$TTL 3600 \n@ IN SOA ns.vm.%s. email.vm.%s. (0 3600 3600 1209600 3600)\n@ IN NS ns.vm.%s.\nns IN A %s\n" headerSoaSerial = "$ORIGIN vm. \n$TTL 3600 \n@ IN SOA ns.vm. email.vm. (12345 3600 3600 1209600 3600)\n" )