From patchwork Mon Nov 16 19:08:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 5719 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:6022:9292:b0:11a:f58a:e788 with SMTP id dc18csp1656434lab; Mon, 16 Nov 2026 11:09:10 -0800 (PST) X-Forwarded-Encrypted: i=2; AL+hErGf1O1VFgTIPY+w10GseWsCVltsbep4uhfbIDg5PAaKu8BTkEQZrU9sUOaXyTzICjRKWIBy3y/lxxA=@openvpn.net X-Received: by 2002:a05:6820:f00e:b0:71a:e7ba:8aed with SMTP id 006d021491bc7-71ae7ba8f94mr3926640eaf.31.1794856150673; Mon, 16 Nov 2026 11:09:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1794856150; cv=none; d=google.com; s=arc-20260327; b=Usj7NC4lijzTW20pq0kboRGpNsTuh/ZfwH1AA8kM+Y6DwjdU4iki11Mg7db70EKEnL eLU7k/xqzEShMMgx8D+Ha+G82inIrvzrkvM3Mh4d6MCIbUUpii4nJdleZ7/0iYVrVGSh lMa5VqgcVmY/Pj4PslD8pwivVGVv9KoFhwHS1xYWe6vcZmB0P/0k49q1B7GfOmFICnaJ ftKCIiRN3l48Icr09MVT8Gg+ELBZ5PAyqEBS4LRHL86BQLdmY4bEs/HRzeWufpoaFAMZ SAvK+wiI/fE3MJgbLuyl2jI/VQvLVDk/TDMvN3b/RDlskImPeU1JGa6hCp2BM5WwdPgC keWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature:dkim-signature; bh=ZDFlow7SpZm6l9CkdHu2Tm34/pjyLfK8df6JvpQZN7o=; fh=4NbAC/LsuMLI0S0hprUlLSLCiHwg6SCAifhH718Jh0Q=; b=Zn94p2mCU86PbjdkUG/Z9r6D8wanqsKl20vObRKuAiVBFPNAFRZnxnkwi5oZmfghsl ok+PnLNCX7ut3Yq+uWBGzkFTd3oLzpV9lwFc01CgeLw/TJK72JPC2rRdBGqbF1mmC4rP 6Epy94L35cbatx/g2UJivfq8sD7hA9CE4Hm+8yGh02J/AieBxzApYD4E8hKxPpJjDgzS gCglJSu6MGf8EgLcaPUV6lU9Fk5kiQ0U3OYpn2ofnDDYgTzYFl6K8HzfPdNcnmgwDfn1 y4k1TT6DRTSGki4LF4Gl3UOB4UQjyGNCcGywulmTipkPit10JQuRZaGfUPqgWOPFr/Im 3dZQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lists.sourceforge.net header.s=beta header.b=TY8TbGat; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kCIIBtAq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=PAG8HBbS; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id 586e51a60fabf-4b3fc1746d9si1001763fac.362.2026.11.16.11.09.10 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Nov 2026 11:09:10 -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=pass header.i=@lists.sourceforge.net header.s=beta header.b=TY8TbGat; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=kCIIBtAq; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=PAG8HBbS; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=muc.de DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:References:In-Reply-To:Message-ID:Date:To:From:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Unsubscribe-Post: List-Owner; bh=ZDFlow7SpZm6l9CkdHu2Tm34/pjyLfK8df6JvpQZN7o=; b=TY8TbGatJWD/do DBkwUBtfCZ1R8H4VEuEotdvqYUtjwgK2NMs+j+V5dLBGohvSkfyBadIUSAEKuIUPDyKQFreWeEVpI d3TDehQYH7Pf81l4W1Gf+d3EKCgLzcvmx9HT3SGmcamgfa+aSOkL6A+wKk7Jra9niRCC3P3DGL+kM z5M=; Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.100.1) (envelope-from ) id 1xT24j-000000006rM-2sWH; Mon, 16 Nov 2026 19:09:09 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.100.1) (envelope-from ) id 1xT24i-000000006rF-3aiJ for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 19:09:08 +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:References: In-Reply-To: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:List-Id:List-Help:List-Unsubscribe: List-Unsubscribe-Post:List-Subscribe:List-Post:List-Owner:List-Archive; bh=47BxBm/xSozbye/SxnrACQQdnxzgJ1iCetDrAGfdb3g=; b=kCIIBtAqf1VROH329Xjfn6DgUX rc8JRJI41TuSsbscH9Q3EmZ2jTa523Fa6jnJ4AcouT+LMtiwQvoy5AXa7dm+o6MpJZrbQiQNkXMuO h5BJ0RqEqLAVENuB+Ns53B6uPu/gZ+0UWq4qdExCJyZCbsCG5Jv4NT162m3snVIwcnt8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: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:List-Id:List-Help:List-Unsubscribe:List-Unsubscribe-Post: List-Subscribe:List-Post:List-Owner:List-Archive; bh=47BxBm/xSozbye/SxnrACQQdnxzgJ1iCetDrAGfdb3g=; b=PAG8HBbSjAC3oIDfxsGwUxT88H y6z3ffiOTZ3P0GidHls1ez3dB6hlC6GJXBu5i3zFEu+hzuw0PlChjSaw5I5rX4Wjxk+Zy4kRTwa1q fdzfK1cK+sgRl2mSY9i74gZbcM+RWXZ7uwzIM9SkxlkatlNCmmOx3EIx7GvnJrXStgE8=; Received: from [193.149.48.129] (helo=blue.greenie.muc.de) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.100.1) id 1xT24h-000000007CK-2YQ8 for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 19:09:08 +0000 Received: from blue.greenie.muc.de (localhost [127.0.0.1]) by blue.greenie.muc.de (8.18.1/8.18.1) with ESMTP id 6AGJ90OA002495 for ; Mon, 16 Nov 2026 20:09:00 +0100 Received: (from gert@localhost) by blue.greenie.muc.de (8.18.2/8.18.1/Submit) id 6AGJ90Xg002494 for openvpn-devel@lists.sourceforge.net; Mon, 16 Nov 2026 20:09:00 +0100 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Mon, 16 Nov 2026 20:08:55 +0100 Message-ID: <20261116190900.2482-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.55.0 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "sfi-spamd-1.hosts.colo.sdot.me", 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: From: Razvan Cojocaru PROXY_DIGEST_AUTH is unconditionally defined to 1. Remove it and its #if blocks. In the digest branch of establish_http_proxy_passthru(), also drop the re-check of auth_method == HTTP_AUTH_DIGEST, whi [...] Content analysis details: (1.3 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.3 RDNS_NONE Delivered to internal network by a host with no rDNS X-Headers-End: 1xT24h-000000007CK-2YQ8 Subject: [Openvpn-devel] [PATCH v1] proxy: drop always-on PROXY_DIGEST_AUTH guards 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: 1882043082908286595 X-GMAIL-MSGID: 1882043082908286595 From: Razvan Cojocaru PROXY_DIGEST_AUTH is unconditionally defined to 1. Remove it and its #if blocks. In the digest branch of establish_http_proxy_passthru(), also drop the re-check of auth_method == HTTP_AUTH_DIGEST, which the enclosing condition already guarantees, and its dead else. Change-Id: Ice2151259fcaa256d7aee588bc3d68c835ea9eb8 Signed-off-by: Razvan Cojocaru Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2203 --- This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master. Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2203 This mail reflects revision 1 of this Change. Acked-by according to Gerrit (reflected above): Gert Doering diff --git a/src/openvpn/httpdigest.c b/src/openvpn/httpdigest.c index 9bfa074..a6803e9 100644 --- a/src/openvpn/httpdigest.c +++ b/src/openvpn/httpdigest.c @@ -26,8 +26,6 @@ #include "syshead.h" -#if PROXY_DIGEST_AUTH - #include "crypto.h" #include "httpdigest.h" @@ -141,5 +139,3 @@ md_ctx_free(md5_ctx); CvtHex(RespHash, Response); } - -#endif /* if PROXY_DIGEST_AUTH */ diff --git a/src/openvpn/httpdigest.h b/src/openvpn/httpdigest.h index 37f3d98..20db1c4 100644 --- a/src/openvpn/httpdigest.h +++ b/src/openvpn/httpdigest.h @@ -20,8 +20,6 @@ * with this program; if not, see . */ -#if PROXY_DIGEST_AUTH - #define HASHLEN 16 typedef unsigned char HASH[HASHLEN]; #define HASHHEXLEN 32 @@ -42,5 +40,3 @@ const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ HASHHEX Response /* request-digest or response-digest */ ); - -#endif /* if PROXY_DIGEST_AUTH */ diff --git a/src/openvpn/proxy.c b/src/openvpn/proxy.c index cd9f3b2..437733e 100644 --- a/src/openvpn/proxy.c +++ b/src/openvpn/proxy.c @@ -348,14 +348,12 @@ *data = string_alloc(buf + 26, NULL); ret = HTTP_AUTH_BASIC; } -#if PROXY_DIGEST_AUTH else if (!strncmp(buf + 20, "Digest ", 7)) { msg(D_PROXY, "PROXY AUTH DIGEST: '%s'", buf); *data = string_alloc(buf + 27, NULL); ret = HTTP_AUTH_DIGEST; } -#endif } } } @@ -714,121 +712,108 @@ { processed = true; } -#if PROXY_DIGEST_AUTH else if (p->auth_method == HTTP_AUTH_DIGEST && !processed) { const char *pa = p->proxy_authenticate; - const int method = p->auth_method; ASSERT(pa); - if (method == HTTP_AUTH_DIGEST) + const char *http_method = "CONNECT"; + const char *nonce_count = "00000001"; + const char *qop = "auth"; + const char *username = p->up.username; + const char *password = p->up.password; + char *opaque_kv = ""; + char uri[128]; + uint8_t cnonce_raw[8]; + HASHHEX session_key; + HASHHEX response; + + const char *realm = get_pa_var("realm", pa, &gc); + const char *nonce = get_pa_var("nonce", pa, &gc); + const char *algor = get_pa_var("algorithm", pa, &gc); + const char *opaque = get_pa_var("opaque", pa, &gc); + + if (!realm || !nonce) { - const char *http_method = "CONNECT"; - const char *nonce_count = "00000001"; - const char *qop = "auth"; - const char *username = p->up.username; - const char *password = p->up.password; - char *opaque_kv = ""; - char uri[128]; - uint8_t cnonce_raw[8]; - uint8_t *cnonce; - HASHHEX session_key; - HASHHEX response; - - const char *realm = get_pa_var("realm", pa, &gc); - const char *nonce = get_pa_var("nonce", pa, &gc); - const char *algor = get_pa_var("algorithm", pa, &gc); - const char *opaque = get_pa_var("opaque", pa, &gc); - - if (!realm || !nonce) - { - msg(D_LINK_ERRORS, "HTTP proxy: digest auth failed, malformed response " - "from server: realm= or nonce= missing"); - goto error; - } - - /* generate a client nonce */ - prng_bytes(cnonce_raw, sizeof(cnonce_raw)); - cnonce = make_base64_string2(cnonce_raw, sizeof(cnonce_raw), &gc); - - - /* build the digest response */ - snprintf(uri, sizeof(uri), "%s:%s", host, port); - - if (opaque) - { - const size_t len = strlen(opaque) + 16; - opaque_kv = gc_malloc(len, false, &gc); - snprintf(opaque_kv, len, ", opaque=\"%s\"", opaque); - } - - DigestCalcHA1(algor, username, realm, password, nonce, (char *)cnonce, session_key); - DigestCalcResponse(session_key, nonce, nonce_count, (char *)cnonce, qop, - http_method, uri, NULL, response); - - /* format HTTP CONNECT message */ - snprintf(buf, sizeof(buf), "%s %s HTTP/%s", http_method, uri, - p->options.http_version); - - msg(D_PROXY, "Send to HTTP proxy: '%s'", buf); - - /* send HTTP CONNECT message to proxy */ - if (!send_line_crlf(sd, buf)) - { - goto error; - } - - /* send HOST etc, */ - if (!add_proxy_headers(p, sd, host)) - { - goto error; - } - - /* send digest response */ - if (!checked_snprintf( - buf, sizeof(buf), - "Proxy-Authorization: Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", qop=%s, nc=%s, cnonce=\"%s\", response=\"%s\"%s", - username, realm, nonce, uri, qop, nonce_count, cnonce, response, opaque_kv)) - { - goto error; - } - - msg(D_PROXY, "Send to HTTP proxy: '%s'", buf); - if (!send_line_crlf(sd, buf)) - { - goto error; - } - if (!send_crlf(sd)) - { - goto error; - } - /* clear any sensitive content in buf */ - secure_memzero(buf, sizeof(buf)); - - /* receive reply from proxy */ - if (!recv_line(sd, buf, sizeof(buf), - get_server_poll_remaining_time(server_poll_timeout), true, NULL, - signal_received)) - { - goto error; - } - - /* remove trailing CR, LF */ - chomp(buf); - - msg(D_PROXY, "HTTP proxy returned: '%s'", buf); - - /* parse return string */ - nparms = sscanf(buf, "%*s %d", &status); - processed = true; - } - else - { - msg(D_PROXY, "HTTP proxy: digest method not supported"); + msg(D_LINK_ERRORS, "HTTP proxy: digest auth failed, malformed response " + "from server: realm= or nonce= missing"); goto error; } + + /* generate a client nonce */ + prng_bytes(cnonce_raw, sizeof(cnonce_raw)); + uint8_t *cnonce = make_base64_string2(cnonce_raw, sizeof(cnonce_raw), &gc); + + /* build the digest response */ + snprintf(uri, sizeof(uri), "%s:%s", host, port); + + if (opaque) + { + const size_t len = strlen(opaque) + 16; + opaque_kv = gc_malloc(len, false, &gc); + snprintf(opaque_kv, len, ", opaque=\"%s\"", opaque); + } + + DigestCalcHA1(algor, username, realm, password, nonce, (char *)cnonce, session_key); + DigestCalcResponse(session_key, nonce, nonce_count, (char *)cnonce, qop, + http_method, uri, NULL, response); + + /* format HTTP CONNECT message */ + snprintf(buf, sizeof(buf), "%s %s HTTP/%s", http_method, uri, + p->options.http_version); + + msg(D_PROXY, "Send to HTTP proxy: '%s'", buf); + + /* send HTTP CONNECT message to proxy */ + if (!send_line_crlf(sd, buf)) + { + goto error; + } + + /* send HOST etc, */ + if (!add_proxy_headers(p, sd, host)) + { + goto error; + } + + /* send digest response */ + if (!checked_snprintf( + buf, sizeof(buf), + "Proxy-Authorization: Digest username=\"%s\", realm=\"%s\", nonce=\"%s\", uri=\"%s\", qop=%s, nc=%s, cnonce=\"%s\", response=\"%s\"%s", + username, realm, nonce, uri, qop, nonce_count, cnonce, response, opaque_kv)) + { + goto error; + } + + msg(D_PROXY, "Send to HTTP proxy: '%s'", buf); + if (!send_line_crlf(sd, buf)) + { + goto error; + } + if (!send_crlf(sd)) + { + goto error; + } + /* clear any sensitive content in buf */ + secure_memzero(buf, sizeof(buf)); + + /* receive reply from proxy */ + if (!recv_line(sd, buf, sizeof(buf), + get_server_poll_remaining_time(server_poll_timeout), true, NULL, + signal_received)) + { + goto error; + } + + /* remove trailing CR, LF */ + chomp(buf); + + msg(D_PROXY, "HTTP proxy returned: '%s'", buf); + + /* parse return string */ + nparms = sscanf(buf, "%*s %d", &status); + processed = true; } -#endif /* if PROXY_DIGEST_AUTH */ else if (p->options.auth_retry) { /* figure out what kind of authentication the proxy needs */ diff --git a/src/openvpn/syshead.h b/src/openvpn/syshead.h index 65baee3..8f27436 100644 --- a/src/openvpn/syshead.h +++ b/src/openvpn/syshead.h @@ -480,11 +480,6 @@ #endif /* - * Should we include proxy digest auth functionality - */ -#define PROXY_DIGEST_AUTH 1 - -/* * Do we have CryptoAPI capability? */ #if defined(_WIN32) && defined(ENABLE_CRYPTO_OPENSSL) && !defined(ENABLE_CRYPTO_WOLFSSL)