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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id BDE057DE77 for ; Tue, 9 Nov 2021 17:59:02 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BC04D11515 for ; Tue, 9 Nov 2021 17:59:02 +0100 (CET) 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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 2CD54114D7 for ; Tue, 9 Nov 2021 17:59:01 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 6C0B646064 for ; Tue, 9 Nov 2021 17:54:33 +0100 (CET) From: Stoiko Ivanov To: pbs-devel@lists.proxmox.com Date: Tue, 9 Nov 2021 16:54:20 +0000 Message-Id: <20211109165422.311089-7-s.ivanov@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211109165422.311089-1-s.ivanov@proxmox.com> References: <20211109165422.311089-1-s.ivanov@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.343 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [client.rs, subscription.rs] Subject: [pbs-devel] [PATCH proxmox-backup 4/6] acme: client: read http_proxy from node config 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: Tue, 09 Nov 2021 16:59:02 -0000 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 --- 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