From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Subject: Re: [pve-devel] [PATCH container] fix #5194: delete environment variables set by pve
Date: Tue, 23 Jan 2024 10:51:09 +0100 [thread overview]
Message-ID: <1706003149.vhzmc5u0zf.astroid@yuna.none> (raw)
In-Reply-To: <20240122101206.226150-1-f.gleumes@proxmox.com>
On January 22, 2024 11:12 am, Folke Gleumes wrote:
> 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.
after a short talk with Wolfgang - this patch is probably an okay
stop-gap to fix the particular regression.
but it might be nice to switch to `--clear-env` for lxc-attach with
corresponding options for pct to either preserve the whole env, or
particular variables? might be 9.0 material since it is a semantic
change that possibly breaks scripted use cases that rely on env
variables to pass along things from host to whatever they run inside the
container.. we could introduce the options now though and also have a
`--keep-env` that is the default for 8.x, and flip it to default to
`--clear-env` with 9.0.
>
> Signed-off-by: Folke Gleumes <f.gleumes@proxmox.com>
> ---
> src/PVE/CLI/pct.pm | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
> index a0b9bce..53519e4 100755
> --- a/src/PVE/CLI/pct.pm
> +++ b/src/PVE/CLI/pct.pm
> @@ -143,6 +143,15 @@ __PACKAGE__->register_method ({
> exec(@$cmd);
> }});
>
> +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 +173,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 +199,7 @@ __PACKAGE__->register_method ({
>
> die "missing command" if !@{$param->{'extra-args'}};
>
> + clean_environment();
> exec('lxc-attach', '-n', $vmid, '--', @{$param->{'extra-args'}});
> }});
>
> --
> 2.39.2
>
>
>
> _______________________________________________
> pve-devel mailing list
> pve-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
next prev parent reply other threads:[~2024-01-23 9:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-22 10:12 Folke Gleumes
2024-01-23 9:51 ` Fabian Grünbichler [this message]
2024-01-26 11:39 ` Folke Gleumes
2024-01-26 12:31 ` Wolfgang Bumiller
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=1706003149.vhzmc5u0zf.astroid@yuna.none \
--to=f.gruenbichler@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=w.bumiller@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox