public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Hannes Laimer <h.laimer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-acme 1/1] dns-challenge: use configured datacenter http_proxy for acme dns challenges
Date: Wed, 28 Feb 2024 12:24:11 +0100	[thread overview]
Message-ID: <20240228112412.3982-2-h.laimer@proxmox.com> (raw)
In-Reply-To: <20240228112412.3982-1-h.laimer@proxmox.com>

the proxy is added to the plugin config so the `proxmox-acme` script
exports it and it'll be used by curl when requests are made.

Based on e1088f616ffc73a96ee3433f0ea07639ef7513e7 (reverted).

Signed-off-by: Hannes Laimer <h.laimer@proxmox.com>
---
 src/PVE/ACME/DNSChallenge.pm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/PVE/ACME/DNSChallenge.pm b/src/PVE/ACME/DNSChallenge.pm
index 7214d88..29b741e 100644
--- a/src/PVE/ACME/DNSChallenge.pm
+++ b/src/PVE/ACME/DNSChallenge.pm
@@ -85,6 +85,9 @@ my $proxmox_acme_command = sub {
     my $dnsplugin = $data->{plugin}->{api};
     my $plugin_conf_string = $data->{plugin}->{data};
 
+    my $dccfg = PVE::Cluster::cfs_read_file('datacenter.cfg');
+    my $proxy = $dccfg->{http_proxy};
+
     # for security reasons, we execute the command as nobody
     # we can't verify that the code of the DNSPlugins are harmless.
     my $cmd = ["setpriv", "--reuid", "nobody", "--regid", "nogroup", "--clear-groups", "--reset-env", "--"];
@@ -99,6 +102,7 @@ my $proxmox_acme_command = sub {
     }
     my $input = "$txtvalue\n";
     $input .= "$plugin_conf_string\n" if $plugin_conf_string;
+    $input .= "https_proxy=$proxy\nhttp_proxy=$proxy\n" if $proxy;
 
     PVE::Tools::run_command($cmd, input => $input);
 
-- 
2.39.2





  reply	other threads:[~2024-02-28 11:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-28 11:24 [pve-devel] [PATCH proxmox-acme/pve-cluster 0/2] Add support to use a http proxy " Hannes Laimer
2024-02-28 11:24 ` Hannes Laimer [this message]
2024-02-28 11:24 ` [pve-devel] [PATCH pve-cluster] docs: update http_proxy option description Hannes Laimer

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=20240228112412.3982-2-h.laimer@proxmox.com \
    --to=h.laimer@proxmox.com \
    --cc=pve-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