public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stoiko Ivanov <s.ivanov@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 4/6] acme: client: read http_proxy from node config
Date: Tue,  9 Nov 2021 16:54:20 +0000	[thread overview]
Message-ID: <20211109165422.311089-7-s.ivanov@proxmox.com> (raw)
In-Reply-To: <20211109165422.311089-1-s.ivanov@proxmox.com>

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@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





  parent reply	other threads:[~2021-11-09 16:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-09 16:54 [pbs-devel] [PATCH proxmox-backup/proxmox-acme-rs/pwt] acme: add support for http_proxy and wildcard certs Stoiko Ivanov
2021-11-09 16:54 ` [pbs-devel] [PATCH widget-toolkit 1/1] acmeplugin: add use-proxy checkbox Stoiko Ivanov
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-acme-rs 1/1] client: add support for proxies Stoiko Ivanov
2021-11-18 10:15   ` [pbs-devel] applied: " Wolfgang Bumiller
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 1/6] api: config: acme: rustfmt Stoiko Ivanov
2021-11-18 10:33   ` [pbs-devel] applied: " Wolfgang Bumiller
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 2/6] config: acme: plugin: rustfmt Stoiko Ivanov
2021-11-18 10:34   ` [pbs-devel] applied: " Wolfgang Bumiller
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 3/6] api: acme: fix typo Stoiko Ivanov
2021-11-18 10:34   ` [pbs-devel] applied: " Wolfgang Bumiller
2021-11-09 16:54 ` Stoiko Ivanov [this message]
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 5/6] acme: plugin: add 'use-proxy' property Stoiko Ivanov
2021-11-09 16:54 ` [pbs-devel] [PATCH proxmox-backup 6/6] acme: add support for wildcard certificates Stoiko Ivanov

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=20211109165422.311089-7-s.ivanov@proxmox.com \
    --to=s.ivanov@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