From e197c7205d93e4efecd38cb0b9d771809f962603 Mon Sep 17 00:00:00 2001 From: Zicklag Date: Tue, 5 Nov 2024 17:10:21 -0600 Subject: [PATCH] fix: make DNS resolution case insensitive. --- src/lib/dns/server.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/dns/server.ts b/src/lib/dns/server.ts index f7f051cf..121eae9b 100644 --- a/src/lib/dns/server.ts +++ b/src/lib/dns/server.ts @@ -42,12 +42,13 @@ const DNS_MASTER = env.DNS_SOA_MASTER; const soaSplit = env.DNS_SOA_EMAIL.split('@'); const DNS_EMAIL = soaSplit[0].replace('.', '\\.') + '.' + soaSplit[1]; const DNS_NAMESERVERS = env.DNS_NAMESERVERS.split(','); -const ALLOWED_DOMAINS = env.DNS_ALLOWED_DOMAINS.split(','); +const ALLOWED_DOMAINS = env.DNS_ALLOWED_DOMAINS.toLowerCase().split(','); const DNS_LOG_VERBOSE = !!env.DNS_LOG_VERBOSE && env.DNS_LOG_VERBOSE != '0' && env.DNS_LOG_VERBOSE != 'false'; const matchesAllowedDomains = (name: string): boolean => { + const n = name.toLowerCase(); for (const domain of ALLOWED_DOMAINS) { - if (name == domain || name.endsWith(`.${domain}`)) return true; + if (n == domain || n.endsWith(`.${domain}`)) return true; } return false;