From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 89996916D2 for ; Mon, 29 Jan 2024 16:43:41 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6B88418BEE for ; Mon, 29 Jan 2024 16:43:41 +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)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 29 Jan 2024 16:43:39 +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 A37A7492F5 for ; Mon, 29 Jan 2024 16:43:39 +0100 (CET) From: Folke Gleumes To: pve-devel@lists.proxmox.com Date: Mon, 29 Jan 2024 16:43:17 +0100 Message-Id: <20240129154318.682297-1-f.gleumes@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.020 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy 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 T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com, pct.pm] Subject: [pve-devel] [PATCH container v2 1/2] fix #5194: pct: delete environment variables set by pve X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Jan 2024 15:43:41 -0000 proxmox-perl-rs set's SSL_CERT_{DIR,FILE}, which can break ssl in containers if their certificate store can't be found in the same spot. This patch explicitly unsets those variables before starting the container. Signed-off-by: Folke Gleumes --- Changes since v1: * Add reevaluation notice for pve9 src/PVE/CLI/pct.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm index a0b9bce..091ac8e 100755 --- a/src/PVE/CLI/pct.pm +++ b/src/PVE/CLI/pct.pm @@ -143,6 +143,16 @@ __PACKAGE__->register_method ({ exec(@$cmd); }}); +# TODO: Evaluate if still needed with PVE9 +sub clean_environment { + # These env variables are currently needed by PVE to work correctly with rust libraries, + # but can break ssl inside of containers. + # An explanation why they are needed and the code that sets them can be found here: + # https://git.proxmox.com/?p=proxmox-perl-rs.git;a=blob;f=common/pkg/Proxmox/Lib/SslProbe.pm + delete $ENV{SSL_CERT_FILE}; + delete $ENV{SSL_CERT_DIR}; +}; + __PACKAGE__->register_method ({ name => 'enter', path => 'enter', @@ -164,6 +174,7 @@ __PACKAGE__->register_method ({ PVE::LXC::Config->load_config($vmid); # test if container exists on this node die "container '$vmid' not running!\n" if !PVE::LXC::check_running($vmid); + clean_environment(); exec('lxc-attach', '-n', $vmid); }}); @@ -189,6 +200,7 @@ __PACKAGE__->register_method ({ die "missing command" if !@{$param->{'extra-args'}}; + clean_environment(); exec('lxc-attach', '-n', $vmid, '--', @{$param->{'extra-args'}}); }}); -- 2.39.2