[libvirt PATCH] rpc: Pass GPG_TTY and TERM environment variables

Andrea Bolognani posted 1 patch 5 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20231116213841.2440110-1-abologna@redhat.com
src/rpc/virnetsocket.c | 5 +++++
1 file changed, 5 insertions(+)
[libvirt PATCH] rpc: Pass GPG_TTY and TERM environment variables
Posted by Andrea Bolognani 5 months, 1 week ago
gpg-agent can be used instead of ssh-agent to authenticate
against an SSH server, but in order to do so the GPG_TTY and
TERM environment variables need to be passed through.

For obvious reasons, we avoid doing that when no_tty=1 is found
in the connection URI.

https://bugs.debian.org/843863
https://gitlab.com/libvirt/libvirt/-/merge_requests/290

Thanks: Guilhem Moulin <guilhem@guilhem.org>
Thanks: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 src/rpc/virnetsocket.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index b58f7a6b8f..151077c2dd 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -843,6 +843,11 @@ int virNetSocketNewConnectSSH(const char *nodename,
     virCommandAddEnvPass(cmd, "OPENSSL_CONF");
     virCommandAddEnvPass(cmd, "DISPLAY");
     virCommandAddEnvPass(cmd, "XAUTHORITY");
+    if (!noTTY) {
+        /* Needed for gpg-agent's curses-based authentication prompt */
+        virCommandAddEnvPass(cmd, "GPG_TTY");
+        virCommandAddEnvPass(cmd, "TERM");
+    }
     virCommandClearCaps(cmd);
 
     if (service)
-- 
2.41.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org
Re: [libvirt PATCH] rpc: Pass GPG_TTY and TERM environment variables
Posted by Daniel P. Berrangé 5 months, 1 week ago
On Thu, Nov 16, 2023 at 10:38:41PM +0100, Andrea Bolognani wrote:
> gpg-agent can be used instead of ssh-agent to authenticate
> against an SSH server, but in order to do so the GPG_TTY and
> TERM environment variables need to be passed through.
> 
> For obvious reasons, we avoid doing that when no_tty=1 is found
> in the connection URI.
> 
> https://bugs.debian.org/843863
> https://gitlab.com/libvirt/libvirt/-/merge_requests/290
> 
> Thanks: Guilhem Moulin <guilhem@guilhem.org>
> Thanks: Kunwu Chan <chentao@kylinos.cn>
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  src/rpc/virnetsocket.c | 5 +++++
>  1 file changed, 5 insertions(+)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-leave@lists.libvirt.org