public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup 2/3] fix #3723: api: remote: optionally use node proxy config for http client
Date: Wed, 11 Feb 2026 17:18:44 +0100	[thread overview]
Message-ID: <20260211161845.1006528-4-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260211161845.1006528-1-c.ebner@proxmox.com>

Allow to use the node's http proxy config if the new `use-node-proxy`
flag is set in the remote config. If ever required, it is still
possible to extend this to allow for custom proxy settings on the
remote.

Fixes: https://bugzilla.proxmox.com/show_bug.cgi?id=3723
Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
---
 src/api2/config/remote.rs | 13 +++++++++++++
 src/config/node.rs        |  5 +++++
 2 files changed, 18 insertions(+)

diff --git a/src/api2/config/remote.rs b/src/api2/config/remote.rs
index 0a0996e25..1996ee91b 100644
--- a/src/api2/config/remote.rs
+++ b/src/api2/config/remote.rs
@@ -142,6 +142,8 @@ pub enum DeletableProperty {
     Fingerprint,
     /// Delete the port property.
     Port,
+    /// Delete the use_node_proxy property.
+    UseNodeProxy,
 }
 
 #[api(
@@ -209,6 +211,9 @@ pub fn update_remote(
                 DeletableProperty::Port => {
                     data.config.port = None;
                 }
+                DeletableProperty::UseNodeProxy => {
+                    data.config.use_node_proxy = None;
+                }
             }
         }
     }
@@ -238,6 +243,10 @@ pub fn update_remote(
         data.config.fingerprint = update.fingerprint;
     }
 
+    if update.use_node_proxy.is_some() {
+        data.config.use_node_proxy = update.use_node_proxy;
+    }
+
     config.set_data(&name, "remote", &data)?;
 
     pbs_config::remote::save_config(&config)?;
@@ -310,6 +319,10 @@ pub fn remote_client_config(
     if let Some(limit) = limit {
         options = options.rate_limit(limit);
     }
+    if remote.config.use_node_proxy.unwrap_or(false) {
+        let proxy = crate::config::node::node_http_proxy_config()?;
+        options = options.proxy(proxy);
+    }
 
     let client = HttpClient::new(
         &remote.config.host,
diff --git a/src/config/node.rs b/src/config/node.rs
index 81eecb247..a79bf5707 100644
--- a/src/config/node.rs
+++ b/src/config/node.rs
@@ -309,3 +309,8 @@ impl Iterator for AcmeDomainIter<'_> {
         ))
     }
 }
+
+pub(crate) fn node_http_proxy_config() -> Result<Option<ProxyConfig>, Error> {
+    let (node_config, _digest) = self::config()?;
+    Ok(node_config.http_proxy())
+}
-- 
2.47.3





  parent reply	other threads:[~2026-02-11 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-11 16:18 [PATCH proxmox{,-backup} 0/4] fix #3723: allow using node http proxy for remote connections Christian Ebner
2026-02-11 16:18 ` [PATCH proxmox 1/1] pbs-api-types: remote: add flag to use node proxy for remote connect Christian Ebner
2026-02-11 16:18 ` [PATCH proxmox-backup 1/3] http client: use http proxy from client options if set Christian Ebner
2026-02-11 16:18 ` Christian Ebner [this message]
2026-02-11 16:18 ` [PATCH proxmox-backup 3/3] ui: expose flag to use node's http proxy in remote edit window Christian Ebner

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=20260211161845.1006528-4-c.ebner@proxmox.com \
    --to=c.ebner@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