all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH cluster 1/3] datacenter config: add setting for HTTP{, S} proxies
Date: Tue, 21 Oct 2025 12:03:25 +0200	[thread overview]
Message-ID: <20251021100332.251697-2-m.sandoval@proxmox.com> (raw)
In-Reply-To: <20251021100332.251697-1-m.sandoval@proxmox.com>

Adds a 'proxy' setting which is meant to replace 'http_proxy'. This new
setting allows to specify different HTTP and HTTPS proxies for different
pieces of the stack.

In the UI each option would set both the HTTP and HTTPS proxies together
to the same value to avoid configuration mistakes, e.g. if only one
proxy is set.

The use-case this option intends to cover is a proxy which allows to
proxy HTTP(S) requests to the outside but will reject any connection to
resources which are already in the internal network, for this cases the
'none' option would declare that no proxy should be used.

The {proxy}->{global} default key of the property string acts as a
drop-in replacement for the {http_proxy} setting. However, we document
that this will be used both as a HTTP and a HTTPS proxy which was not
done always for the 'http_proxy' setting.

Individual proxy configurations accept a 'none' value that allows to say
that no proxy should be used for this use-case, this takes precedence
over both the new global proxy and the 'http_proxy'.

Subscriptions only need HTTPS proxies and thus we do not offer the
option to setup a HTTP proxy here.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---
 src/PVE/DataCenterConfig.pm | 60 +++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/src/PVE/DataCenterConfig.pm b/src/PVE/DataCenterConfig.pm
index c6d56c1..57c5c1c 100644
--- a/src/PVE/DataCenterConfig.pm
+++ b/src/PVE/DataCenterConfig.pm
@@ -120,6 +120,52 @@ my $notification_format = {
     },
 };
 
+my $proxy_format = {
+    'global' => {
+        default_key => 1,
+        optional => 1,
+        type => 'string',
+        description => "Proxy used as a fallback. It will be used when the respective component does not have a proxy defined. Will be used both as a HTTP and HTTPS proxies.",
+        pattern => "http://.*",
+        format_description => 'URL',
+    },
+    'http-download' => {
+        optional => 1,
+        type => 'string',
+        description => "HTTP proxy used for downloading ISOs and container templates. When set to 'none' no proxy will be used.",
+        pattern => "(http://.*|none)",
+        format_description => 'URL',
+    },
+    'https-download' => {
+        optional => 1,
+        description => "HTTPS proxy used for downloading ISOs and container templates. When set to 'none' no proxy will be used.",
+        type => 'string',
+        pattern => "(http://.*|none)",
+        format_description => 'URL',
+    },
+    'https-subscription' => {
+        optional => 1,
+        description => "HTTPS proxy used for subscription related tasks. When set to 'none' no proxy will be used.",
+        type => 'string',
+        pattern => "(http://.*|none)",
+        format_description => 'URL',
+    },
+    'http-apt' => {
+        optional => 1,
+        description => "HTTP proxy used for APT. When set to 'none' no proxy will be used.",
+        type => 'string',
+        pattern => "(http://.*|none)",
+        format_description => 'URL',
+    },
+    'https-apt' => {
+        optional => 1,
+        description => "HTTPS proxy used for APT. When set to 'none' no proxy will be used.",
+        type => 'string',
+        pattern => "(http://.*|none)",
+        format_description => 'URL',
+    },
+};
+
 register_standard_option(
     'pve-ha-shutdown-policy',
     {
@@ -352,6 +398,12 @@ my $datacenter_schema = {
                 "Specify external http proxy which is used for downloads (example: 'http://username:password\@host:port/')",
             pattern => "http://.*",
         },
+        proxy => {
+            optional => 1,
+            type => 'string',
+            description => "Settings for declaring HTTP and HTTPS proxies for individual components. When a specific proxy is not specied 'http_proxy' will be used instead.",
+            format => $proxy_format,
+        },
         # FIXME: remove with 8.0 (add check to pve7to8!), merged into "migration" since 4.3
         migration_unsecure => {
             optional => 1,
@@ -536,6 +588,10 @@ sub parse_datacenter_config {
         $res->{replication} = parse_property_string($replication_format, $replication);
     }
 
+    if (my $proxy = $res->{proxy}) {
+        $res->{proxy} = parse_property_string($proxy_format, $proxy);
+    }
+
     if (my $next_id = $res->{'next-id'}) {
         $res->{'next-id'} = parse_property_string($next_id_format, $next_id);
     }
@@ -619,6 +675,10 @@ sub write_datacenter_config {
         $cfg->{replication} = PVE::JSONSchema::print_property_string($replication, $replication_format);
     }
 
+    if (ref(my $proxy = $cfg->{proxy})) {
+        $cfg->{proxy} = PVE::JSONSchema::print_property_string($proxy, $proxy_format);
+    }
+
     if (defined(my $next_id = $cfg->{'next-id'})) {
         $next_id = parse_property_string($next_id_format, $next_id) if !ref($next_id);
 
-- 
2.47.3



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


  reply	other threads:[~2025-10-21 10:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-21 10:03 [pve-devel] [RFC cluster/manager/storage 0/7] " Maximiliano Sandoval
2025-10-21 10:03 ` Maximiliano Sandoval [this message]
2025-10-21 10:03 ` [pve-devel] [PATCH cluster 2/3] datacenter config: deprecate http_proxy Maximiliano Sandoval
2025-10-21 10:03 ` [pve-devel] [PATCH cluster 3/3] cluster: add helper to retrieve proxies Maximiliano Sandoval
2025-10-21 10:03 ` [pve-devel] [PATCH manager 1/3] api: subscription: use new proxy dc option Maximiliano Sandoval
2025-10-21 10:03 ` [pve-devel] [PATCH manager 2/3] api: apt: use new dc proxy option Maximiliano Sandoval
2025-10-21 10:03 ` [pve-devel] [PATCH manager 3/3] api: nodes: " Maximiliano Sandoval
2025-10-21 10:03 ` [pve-devel] [PATCH storage 1/1] api: storage: status: " Maximiliano Sandoval

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=20251021100332.251697-2-m.sandoval@proxmox.com \
    --to=m.sandoval@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal