[pve-devel] [PATCH proxmox-acme 1/1] dns-challenge: use configured datacenter http_proxy for acme dns challenges

Hannes Laimer h.laimer at proxmox.com
Wed Feb 28 12:24:11 CET 2024


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





More information about the pve-devel mailing list