From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (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 lists.proxmox.com (Postfix) with ESMTPS id DAD237A9F5 for ; Mon, 10 May 2021 10:52:41 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id C8D0F15837 for ; Mon, 10 May 2021 10:52:41 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 firstgate.proxmox.com (Proxmox) with ESMTPS id 3E1411582B for ; Mon, 10 May 2021 10:52:41 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 0F4B3443F1 for ; Mon, 10 May 2021 10:52:41 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Mon, 10 May 2021 10:52:31 +0200 Message-Id: <20210510085234.775062-1-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 1/4] fix #3391: improve mismatched fingerprint handling X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 10 May 2021 08:52:41 -0000 if the expected fingerprint and the one returned by the server don't match, print a warning and allow confirmation and proceeding if running interactive. previous: $ proxmox-backup-client ... Error: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1915: new: $ proxmox-backup-client ... WARNING: certificate fingerprint does not match expected fingerprint! expected: ac:cb:6a:bc:d6:b7:b4:77:3e:17:05:d6:b6:29:dd:1f:05:9c:2b:3a:df:84:3b:4d:f9:06:2c:be:da:06:52:12 fingerprint: ab:cb:6a:bc:d6:b7:b4:77:3e:17:05:d6:b6:29:dd:1f:05:9c:2b:3a:df:84:3b:4d:f9:06:2c:be:da:06:52:12 Are you sure you want to continue connecting? (y/n): n Error: error trying to connect: error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed:../ssl/statem/statem_clnt.c:1915: Signed-off-by: Fabian Grünbichler --- src/client/http_client.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/client/http_client.rs b/src/client/http_client.rs index c8d1f743..1df22dc9 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -498,10 +498,12 @@ impl HttpClient { .collect::>().join(":"); if let Some(expected_fingerprint) = expected_fingerprint { - if expected_fingerprint.to_lowercase() == fp_string { + let expected_fingerprint = expected_fingerprint.to_lowercase(); + if expected_fingerprint == fp_string { return (true, Some(fp_string)); } else { - return (false, None); + eprintln!("WARNING: certificate fingerprint does not match expected fingerprint!"); + eprintln!("expected: {}", expected_fingerprint); } } -- 2.20.1