[pmg-devel] [PATCH pmg-api 2/2] api: acme: dns-plugin: conditionally pass proxy to acme.sh wrapper

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


If an acme (dns) plugin has set the 'use-proxy' flag, pass
the http_proxy configured in pmg.conf to be used by the dns-plugin

The setting is configurable for each dns-plugin, based on the
assumption that some dns-apis might be 'local' (e.g. a pdns-server in
the internal network) and communication with them should not pass
through the proxy.

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 src/PMG/API2/Certificates.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/PMG/API2/Certificates.pm b/src/PMG/API2/Certificates.pm
index 6627328..668134f 100644
--- a/src/PMG/API2/Certificates.pm
+++ b/src/PMG/API2/Certificates.pm
@@ -375,6 +375,13 @@ my $order_certificate = sub {
 	    die "plugin '$plugin_id' for domain '$domain' not found!\n"
 		if !$plugin_cfg;
 
+	    if ($plugin_cfg->{'use-proxy'}) {
+		my $pmg_cfg = PMG::Config->new();
+		if (my $http_proxy = $pmg_cfg->get('admin', 'http_proxy')) {
+		    $plugin_cfg->{proxy} = $http_proxy;
+		}
+	    }
+
 	    my $data = {
 		plugin => $plugin_cfg,
 		alias => $domain_config->{alias},
-- 
2.30.2





More information about the pmg-devel mailing list