From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <t.lamprecht@proxmox.com>
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) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 23B2A7BEBB
 for <pve-devel@lists.proxmox.com>; Wed,  3 Nov 2021 11:32:25 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 185F812191
 for <pve-devel@lists.proxmox.com>; Wed,  3 Nov 2021 11:32:25 +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) server-digest SHA256)
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 92E3C12184
 for <pve-devel@lists.proxmox.com>; Wed,  3 Nov 2021 11:32:24 +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 64F9A45DCA
 for <pve-devel@lists.proxmox.com>; Wed,  3 Nov 2021 11:32:24 +0100 (CET)
Message-ID: <c7a688ea-71f5-1ee7-b8bf-670c03f4de78@proxmox.com>
Date: Wed, 3 Nov 2021 11:32:23 +0100
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101
 Thunderbird/94.0
Content-Language: en-US
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
 =?UTF-8?Q?Fabian_Gr=c3=bcnbichler?= <f.gruenbichler@proxmox.com>
References: <20210713080917.1546780-1-f.gruenbichler@proxmox.com>
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
In-Reply-To: <20210713080917.1546780-1-f.gruenbichler@proxmox.com>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.178 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. [openid.pm]
Subject: [pve-devel] applied: [PATCH access-control] fix #3513: pass
 configured proxy to OpenID
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Wed, 03 Nov 2021 10:32:25 -0000

On 13.07.21 10:09, Fabian Gr=C3=BCnbichler wrote:
> Signed-off-by: Fabian Gr=C3=BCnbichler <f.gruenbichler@proxmox.com>
> ---
> seemed like the easiest way to fix this - but we could also change the
> proxmox-openid-rs API to take the proxy as parameter..
>=20
>  src/PVE/API2/OpenId.pm | 6 ++++++
>  1 file changed, 6 insertions(+)
>=20
>

applied, thanks! just to be sure I made a followup to only change the env=
 if the config
variable actually exists:

--8<--
commit afda4f1a83a5c0bbd798facd27c0cb74759968ff
Author: Thomas Lamprecht <t.lamprecht@proxmox.com>
Date:   Wed Nov 3 11:30:05 2021 +0100

    openid: proxy: only set env var if DC-config property exists
   =20
    Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>

diff --git a/src/PVE/API2/OpenId.pm b/src/PVE/API2/OpenId.pm
index 9080865..4fc0be8 100644
--- a/src/PVE/API2/OpenId.pm
+++ b/src/PVE/API2/OpenId.pm
@@ -98,7 +98,7 @@ __PACKAGE__->register_method ({
 	my ($param) =3D @_;
=20
 	my $dcconf =3D PVE::Cluster::cfs_read_file('datacenter.cfg');
-	local $ENV{all_proxy} =3D $dcconf->{http_proxy};
+	local $ENV{all_proxy} =3D $dcconf->{http_proxy} if exists $dcconf->{htt=
p_proxy};
=20
 	my $realm =3D extract_param($param, 'realm');
 	my $redirect_url =3D extract_param($param, 'redirect-url');
@@ -153,7 +153,7 @@ __PACKAGE__->register_method ({
 	my $res;
 	eval {
 	    my $dcconf =3D PVE::Cluster::cfs_read_file('datacenter.cfg');
-	    local $ENV{all_proxy} =3D $dcconf->{http_proxy};
+	    local $ENV{all_proxy} =3D $dcconf->{http_proxy} if exists $dcconf->=
{http_proxy};
=20
 	    my ($realm, $private_auth_state) =3D PVE::RS::OpenId::verify_public=
_auth_state(
 		$openid_state_path, $param->{'state'});