public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [RFC manager 1/1] api: nodes: set environment variable for shells started via the API
Date: Mon, 13 Sep 2021 14:26:44 +0200	[thread overview]
Message-ID: <6cd295e1-51a4-ae30-c86a-60fc3c47b436@proxmox.com> (raw)
In-Reply-To: <20210913120446.23392-2-f.ebner@proxmox.com>

Am 13.09.21 um 14:04 schrieb Fabian Ebner:
> so that proxmox-ve's apt hook script can detect this.
> 
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
>   PVE/API2/Nodes.pm | 10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/PVE/API2/Nodes.pm b/PVE/API2/Nodes.pm
> index e58d9c10..c57ad995 100644
> --- a/PVE/API2/Nodes.pm
> +++ b/PVE/API2/Nodes.pm
> @@ -843,13 +843,13 @@ my $sslcert;
>   
>   my $shell_cmd_map = {
>       'login' => {
> -	cmd => [ '/bin/login', '-f', 'root' ],
> +	cmd => [ '/bin/login', '-f', 'root', 'PVE_API_SHELL=1' ],
>       },
>       'upgrade' => {
> -	cmd => [ '/usr/bin/pveupgrade', '--shell' ],
> +	cmd => [ '/usr/bin/env', 'PVE_API_SHELL=1', '/usr/bin/pveupgrade', '--shell' ],
>       },
>       'ceph_install' => {
> -	cmd => [ '/usr/bin/pveceph', 'install' ],
> +	cmd => [ '/usr/bin/env', 'PVE_API_SHELL=1', '/usr/bin/pveceph', 'install' ],
>   	allow_args => 1,
>       },
>   };
> @@ -866,11 +866,11 @@ sub get_shell_command  {
>   		push @$cmd, split("\0", $args);
>   	    }
>   	} else {
> -	    $cmd = [ '/bin/login', '-f', 'root' ];
> +	    $cmd = [ '/bin/login', '-f', 'root', 'PVE_API_SHELL=1' ];
>   	}
>       } else {
>   	# non-root must always login for now, we do not have a superuser role!
> -	$cmd = [ '/bin/login' ];
> +	$cmd = [ '/bin/login', 'PVE_API_SHELL=1' ];

Sorry, I think the PVE_API_SHELL=1 gets interpreted as the username in 
this case. I'll fix that in v2 if we even go with this approach.

>       }
>       return $cmd;
>   }
> 




  reply	other threads:[~2021-09-13 12:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-13 12:04 [pve-devel] [PATCH-SERIES manager/proxmox-ve] warn against/prevent using virtual console for major upgrade Fabian Ebner
2021-09-13 12:04 ` [pve-devel] [RFC manager 1/1] api: nodes: set environment variable for shells started via the API Fabian Ebner
2021-09-13 12:26   ` Fabian Ebner [this message]
2021-09-13 12:04 ` [pve-devel] [PATCH proxmox-ve 1/3] apt hook: avoid long line and fix typo Fabian Ebner
2021-09-13 12:04 ` [pve-devel] [PATCH proxmox-ve 2/3] apt hook: mention that console/ssh should be used for major upgrade Fabian Ebner
2021-09-13 12:04 ` [pve-devel] [RFC proxmox-ve 3/3] apt hook: disallow major upgrade via virtual console from API/UI Fabian Ebner
2021-10-29  9:32 ` [pve-devel] [PATCH-SERIES manager/proxmox-ve] warn against/prevent using virtual console for major upgrade Fabian Ebner

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=6cd295e1-51a4-ae30-c86a-60fc3c47b436@proxmox.com \
    --to=f.ebner@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal