public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Lukas Wagner <l.wagner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox] fix #5808: http: use native-tls instead of rustls for the sync client
Date: Thu, 24 Oct 2024 11:45:04 +0200	[thread overview]
Message-ID: <20241024094504.141092-1-l.wagner@proxmox.com> (raw)

In the reference Bugzilla entry, a certificate with an IP address as a
SAN was used. rustls seems to have problems with that [1].
Also, pretty much all of our code uses native-tls at the moment, so
it makes sense to not pull in a second TLS implementation.

Tested by rebuilding libpve-rs-perl and testing a Gotify notification
target with a self-signed TLS certificate (one that is accepted by
OpenSSL but not by rusttls).

[1] https://github.com/rustls/rustls/issues/184

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
---
 proxmox-http/Cargo.toml         | 5 +++--
 proxmox-http/src/client/sync.rs | 4 ++++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/proxmox-http/Cargo.toml b/proxmox-http/Cargo.toml
index a15c3367..bc79c53d 100644
--- a/proxmox-http/Cargo.toml
+++ b/proxmox-http/Cargo.toml
@@ -17,11 +17,12 @@ base64 = { workspace = true, optional = true }
 futures = { workspace = true, optional = true }
 http = { workspace = true, optional = true }
 hyper = { workspace = true, optional = true }
+native-tls = { workspace = true, optional = true }
 openssl =  { version = "0.10", optional = true }
 serde_json = { workspace = true, optional = true }
 tokio = { workspace = true, features = [], optional = true }
 tokio-openssl = { workspace = true, optional = true }
-ureq = { version = "2.4", features = ["native-certs"], optional = true }
+ureq = { version = "2.4", features = ["native-certs", "native-tls"], optional = true, default-features = false }
 url = { workspace = true, optional = true }
 
 proxmox-async = { workspace = true, optional = true }
@@ -61,7 +62,7 @@ client = [
     "rate-limited-stream",
     "tokio?/io-util",
 ]
-client-sync = [ "client-trait", "http-helpers", "dep:ureq" ]
+client-sync = [ "client-trait", "http-helpers", "dep:ureq", "dep:native-tls" ]
 client-trait = [ "dep:http" ]
 http-helpers = [ "dep:base64", "dep:http", "dep:proxmox-sys", "dep:serde_json", "dep:url" ]
 websocket = [
diff --git a/proxmox-http/src/client/sync.rs b/proxmox-http/src/client/sync.rs
index 195ce98f..fb10f5be 100644
--- a/proxmox-http/src/client/sync.rs
+++ b/proxmox-http/src/client/sync.rs
@@ -1,5 +1,6 @@
 use std::collections::HashMap;
 use std::io::Read;
+use std::sync::Arc;
 
 use anyhow::Error;
 use http::Response;
@@ -21,6 +22,9 @@ impl Client {
     fn agent(&self) -> Result<ureq::Agent, Error> {
         let mut builder = ureq::AgentBuilder::new();
 
+        let connector = Arc::new(native_tls::TlsConnector::new()?);
+        builder = builder.tls_connector(connector);
+
         builder = builder.user_agent(self.options.user_agent.as_deref().unwrap_or(concat!(
             "proxmox-sync-http-client/",
             env!("CARGO_PKG_VERSION")
-- 
2.39.5



_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel


             reply	other threads:[~2024-10-24  9:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-24  9:45 Lukas Wagner [this message]
2024-10-30 11:21 ` [pbs-devel] applied: " Fabian Grünbichler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241024094504.141092-1-l.wagner@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal