[pbs-devel] [PATCH proxmox-backup 4/6] acme: client: read http_proxy from node config

Stoiko Ivanov s.ivanov at proxmox.com
Tue Nov 9 17:54:20 CET 2021


If a http_proxy is set in the node config, use it for communicating with
the (usually public) Acme provider.

The code is adapted from src/tools/subscription.rs

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/acme/client.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/acme/client.rs b/src/acme/client.rs
index 8d6cf6bd..784d7bac 100644
--- a/src/acme/client.rs
+++ b/src/acme/client.rs
@@ -20,6 +20,7 @@ use proxmox_http::client::SimpleHttp;
 
 use crate::api2::types::AcmeAccountName;
 use crate::config::acme::account_path;
+use crate::config::node;
 use crate::tools::pbs_simple_http;
 
 /// Our on-disk format inherited from PVE's proxmox-acme code.
@@ -65,6 +66,11 @@ pub struct AcmeClient {
 impl AcmeClient {
     /// Create a new ACME client for a given ACME directory URL.
     pub fn new(directory_url: String) -> Self {
+        let proxy_config = if let Ok((node_config, _digest)) = node::config() {
+            node_config.http_proxy()
+        } else {
+            None
+        };
         Self {
             directory_url,
             debug: false,
@@ -73,7 +79,7 @@ impl AcmeClient {
             account: None,
             directory: None,
             nonce: None,
-            http_client: pbs_simple_http(None),
+            http_client: pbs_simple_http(proxy_config),
         }
     }
 
-- 
2.30.2





More information about the pbs-devel mailing list