From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id E001D1FF13E for ; Wed, 01 Jul 2026 12:31:26 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id EDEF721445; Wed, 01 Jul 2026 12:31:25 +0200 (CEST) From: Dominik Csapak To: pve-devel@lists.proxmox.com, pbs-devel@lists.proxmox.com Subject: [PATCH proxmox v4 2/8] http: tls: use legacy behavior when PROXMOX_OLD_TLS_CHECK is set to "1" Date: Wed, 1 Jul 2026 12:30:46 +0200 Message-ID: <20260701103120.1593265-3-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260701103120.1593265-1-d.csapak@proxmox.com> References: <20260701103120.1593265-1-d.csapak@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 3AL24NPUEQVXG3K6FZPSJTLL7OA52753 X-Message-ID-Hash: 3AL24NPUEQVXG3K6FZPSJTLL7OA52753 X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: If that environment variable is set to "1", give the openssl result priority, and potentially ignore a given fingerprint that is not matching. If that's the case, print a warning. Co-developed-by: Shannon Sterz Signed-off-by: Dominik Csapak --- proxmox-http/src/tls.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/proxmox-http/src/tls.rs b/proxmox-http/src/tls.rs index 5c2b1743..abdf51e9 100644 --- a/proxmox-http/src/tls.rs +++ b/proxmox-http/src/tls.rs @@ -103,6 +103,8 @@ impl std::str::FromStr for Fingerprint { } } +pub const PROXMOX_OLD_TLS_CHECK_VAR: &str = "PROXMOX_OLD_TLS_CHECK"; + /// /// Error type returned by failed [`openssl_verify_callback`]. /// @@ -159,15 +161,24 @@ impl PartialEq for SslVerifyError { /// Intended as an openssl verification callback. /// -/// The following things are checked: +/// If the 'PROXMOX_OLD_TLS_CHECK' environment variable is not set to "1", +/// the following things are checked: /// /// * If no fingerprint is given, return the openssl verification result -/// * If a fingerprint is given get the leaf fp and check that against the given +/// * If a fingerprint is given, check it against the leaf fp +/// +/// Otherwise, we trust the openssl result if the whole chain was trusted pub fn openssl_verify_callback( openssl_valid: bool, ctx: &mut X509StoreContextRef, expected_fp: Option, ) -> Result<(), SslVerifyError> { + let old_check = matches!(std::env::var(PROXMOX_OLD_TLS_CHECK_VAR).as_deref(), Ok("1")); + + if old_check && openssl_valid { + return Ok(()); + } + match expected_fp { Some(expected_fp) => { let fingerprint = get_leaf_fp(ctx)?; -- 2.47.3