From patchwork Tue Feb 28 04:41:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Hund X-Patchwork-Id: 3096 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:2310:b0:9f:bfa4:120f with SMTP id r16csp1652603dye; Mon, 27 Feb 2023 20:42:15 -0800 (PST) X-Google-Smtp-Source: AK7set/TUew02kT8StgO86K9deFJFWcYLis3BE80RUSZBMNxDONqrjC3hpxAgk9Bafdo+S0Ohptl X-Received: by 2002:a17:902:ce8e:b0:19a:eb93:6165 with SMTP id f14-20020a170902ce8e00b0019aeb936165mr1627731plg.22.1677559335514; Mon, 27 Feb 2023 20:42:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677559335; cv=none; d=google.com; s=arc-20160816; b=ATcp81OhuZuvtqCxLUxrMMwQNNCaMAmGcP/iPV29NNZAb2Ai6hZyedq5C9aebUPhEC nFItF4FxpdBOsII56MjW0JsxI7k2d7zwXJte1SbMi8MIhyXn3s+sQdN7w8zqFKuAtaDj x+W8veysUHJEB6suOzHEIZj5S03XHbcsLfVBHlm3PrICIVqnkrN8gOiKV+dzOnB/euAL prD/O8AzEl4gm6k8GvPwm6yYnRgC9BtLLasq1E4Q8smiPG/zPs3/UPuPXWoQxpz/q3NF 8GaSDfIg0+eFtNvAZSfPDDw6TaQhZExLuugJzXeYKOiPKc4qge1AZKWiqnKPzZ0qb9BK 0j/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature; bh=DY1WvgnRJfBible8MRR9pwG4jcJ7h4KmGmTINrOvsgQ=; b=YwN7gvcUphqAiXBJ4Pso6WIlzLe60yQPcVBMbaULbQ1AuhQgYaionaXxy1DDSMO/x/ N7NMQ4DAvErLaMzxkiyihrYS+QddLHvUyNezWMVnh0fv460O8rafNOYHVC79inmHxDBC 1uI0zMKSmvBWJuCJ8CjGnYr5InjSmyB9kpYWz2unmf33UM3vfDMEsUKVfhZKwDNONxZD Tb0FxobTFbtUl+nUm9XV719ool26hXulGImq4niD11AYKE4O39VPQMqf9sifCYiS8Cut h4WnH+aOakhNeTZaxahljKGexwQekiKeRoY+657Pl0Zyrzz+1J6LyiMxhIl/HABjkk4m qXbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=LFcxtxfR; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=nRYY7Dbq; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id lh3-20020a170903290300b0019c91fd0065si8218483plb.297.2023.02.27.20.42.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Feb 2023 20:42:15 -0800 (PST) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=LFcxtxfR; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=nRYY7Dbq; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pWroJ-0003jG-7O; Tue, 28 Feb 2023 04:41:55 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pWroH-0003j9-S9 for openvpn-devel@lists.sourceforge.net; Tue, 28 Feb 2023 04:41:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=8QFdv736wfSZM+3LqDUo8NAfg5alKBgSG09fiHvucuI=; b=LFcxtxfRCC9ywJG3oQ8Fl14HkL L2C0uBg4c+HwmQUWQmupociJqdC9Kcni0R25XDBEIgvq1ySqBbL3QUrjxp9VSSxDAZWl/hV2N0ubS 3tdmaRrPZEGqz/skj1hNdW88QLGmtOz3/Qtg8y/asPNw6TZs0fG2dDw1xU4zLZ2UfYaM=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:To:From: Sender:Reply-To:Cc:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=8QFdv736wfSZM+3LqDUo8NAfg5alKBgSG09fiHvucuI=; b=n RYY7DbqCXiP03P7LnNYygc5ZjxibWtGXIL8oBIeKkVnasNu7rAeEKot2DwaxMmeym0rgSVt2VTNXV k/eSrfdqXzj7ViQeJDCr+3AALNISMm8md9t3gxc4/d+13/9Ut5Mqnq0qYIwFOt0gr+aR0VWQmHIST QIzfveHuoDtxuyVQ=; Received: from exit0.net ([85.25.119.185]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pWroG-005hnh-Vf for openvpn-devel@lists.sourceforge.net; Tue, 28 Feb 2023 04:41:53 +0000 Received: from coruscant.fritz.box (i577BF0F5.versanet.de [87.123.240.245]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by exit0.net (Postfix) with ESMTPSA id 8812B648019C for ; Tue, 28 Feb 2023 05:41:46 +0100 (CET) From: Heiko Hund To: openvpn-devel@lists.sourceforge.net Date: Tue, 28 Feb 2023 05:41:42 +0100 Message-Id: <20230228044142.39803-1-heiko@ist.eigentlich.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Score: 0.2 (/) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: No DNS resolver currently supports this and it is not possible to emulate the behavior without the chance of errors. Finding the effective default system DNS server(s) to specify the exclude DNS route [...] Content analysis details: (0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-Headers-End: 1pWroG-005hnh-Vf Subject: [Openvpn-devel] [PATCH] dns option: remove support for exclude-domains X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1759048457876506118?= X-GMAIL-MSGID: =?utf-8?q?1759048457876506118?= No DNS resolver currently supports this and it is not possible to emulate the behavior without the chance of errors. Finding the effective default system DNS server(s) to specify the exclude DNS routes is not trivial and cannot be verified to be correct without resolver internal knowledge. So, it is better to not support this instead of supporting it, but incorrectly. Signed-off-by: Heiko Hund Acked-By: David Sommerseth --- doc/man-sections/client-options.rst | 14 +++++--------- src/openvpn/dns.c | 13 ++----------- src/openvpn/dns.h | 7 ------- src/openvpn/options.c | 16 ---------------- 4 files changed, 7 insertions(+), 43 deletions(-) diff --git a/doc/man-sections/client-options.rst b/doc/man-sections/client-options.rst index 0b973adf..85d5610f 100644 --- a/doc/man-sections/client-options.rst +++ b/doc/man-sections/client-options.rst @@ -169,7 +169,7 @@ configuration. dns search-domains domain [domain ...] dns server n address addr[:port] [addr[:port]] [addr[:port]] [addr[:port]] - dns server n resolve-domains|exclude-domains domain [domain ...] + dns server n resolve-domains domain [domain ...] dns server n dnssec yes|optional|no dns server n transport DoH|DoT|plain dns server n sni server-name @@ -191,14 +191,10 @@ configuration. Optionally a port can be appended after a colon. IPv6 addresses need to be enclosed in brackets if a port is appended. - The ``resolve-domains`` and ``exclude-domains`` options take one or - more DNS domains which are explicitly resolved or explicitly not resolved - by a server. Only one of the options can be configured for a server. - ``resolve-domains`` is used to define a split-dns setup, where only - given domains are resolved by a server. ``exclude-domains`` is used to - define domains which will never be resolved by a server (e.g. domains - which can only be resolved locally). Systems which do not support fine - grained DNS domain configuration, will ignore these settings. + The ``resolve-domains`` option takes one or more DNS domains used to define + a split-dns or dns-routing setup, where only the given domains are resolved + by the server. Systems which do not support fine grained DNS domain + configuration, will ignore this setting. The ``dnssec`` option is used to configure validation of DNSSEC records. While the exact semantics may differ for resolvers on different systems, diff --git a/src/openvpn/dns.c b/src/openvpn/dns.c index 18f6e58b..b1486c86 100644 --- a/src/openvpn/dns.c +++ b/src/openvpn/dns.c @@ -408,11 +408,9 @@ setenv_dns_options(const struct dns_options *o, struct env_set *es) if (s->domains) { - const char *format = s->domain_type == DNS_RESOLVE_DOMAINS ? - "dns_server_%d_resolve_domain_%d" : "dns_server_%d_exclude_domain_%d"; for (j = 1, d = s->domains; d != NULL; j++, d = d->next) { - setenv_dns_option(es, format, i, j, d->name); + setenv_dns_option(es, "dns_server_%d_resolve_domain_%d", i, j, d->name); } } @@ -491,14 +489,7 @@ show_dns_options(const struct dns_options *o) struct dns_domain *domain = server->domains; if (domain) { - if (server->domain_type == DNS_RESOLVE_DOMAINS) - { - msg(D_SHOW_PARMS, " resolve domains:"); - } - else - { - msg(D_SHOW_PARMS, " exclude domains:"); - } + msg(D_SHOW_PARMS, " resolve domains:"); while (domain) { msg(D_SHOW_PARMS, " %s", domain->name); diff --git a/src/openvpn/dns.h b/src/openvpn/dns.h index 34f864dd..22cb333b 100644 --- a/src/openvpn/dns.h +++ b/src/openvpn/dns.h @@ -27,12 +27,6 @@ #include "buffer.h" #include "env_set.h" -enum dns_domain_type { - DNS_DOMAINS_UNSET, - DNS_RESOLVE_DOMAINS, - DNS_EXCLUDE_DOMAINS -}; - enum dns_security { DNS_SECURITY_UNSET, DNS_SECURITY_NO, @@ -69,7 +63,6 @@ struct dns_server { struct dns_server_addr addr4[2]; struct dns_server_addr addr6[2]; struct dns_domain *domains; - enum dns_domain_type domain_type; enum dns_security dnssec; enum dns_server_transport transport; const char *sni; diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 7ea1994a..19731b53 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -8016,22 +8016,6 @@ add_option(struct options *options, } else if (streq(p[3], "resolve-domains")) { - if (server->domain_type == DNS_EXCLUDE_DOMAINS) - { - msg(msglevel, "--dns server %ld: cannot use resolve-domains and exclude-domains", priority); - goto err; - } - server->domain_type = DNS_RESOLVE_DOMAINS; - dns_domain_list_append(&server->domains, &p[4], &options->dns_options.gc); - } - else if (streq(p[3], "exclude-domains")) - { - if (server->domain_type == DNS_RESOLVE_DOMAINS) - { - msg(msglevel, "--dns server %ld: cannot use exclude-domains and resolve-domains", priority); - goto err; - } - server->domain_type = DNS_EXCLUDE_DOMAINS; dns_domain_list_append(&server->domains, &p[4], &options->dns_options.gc); } else if (streq(p[3], "dnssec") && !p[5])