On 11/2/21 4:01 PM, Дамјан Георгиевски wrote:
openssh supports environment variable expansion in its ssh_config
file[1]. These two environment variables can be used to
expand paths for ssh sockets and other files.
Ex.
```
Host *
ControlMaster auto
ControlPath ${XDG_RUNTIME_DIR}/ssh-%C.ctl
IdentityAgent ${XDG_RUNTIME_DIR}/ssh-agent.socket
```
see also:
[1]
https://man7.org/linux/man-pages/man5/ssh_config.5.html#ENVIRONMENT_VARIA...
[2]
https://gitlab.com/libvirt/libvirt/-/issues/232
Signed-off-by: Дамјан Георгиевски <gdamjan(a)gmail.com>
---
src/rpc/virnetsocket.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 943406cd64..76d8519d3a 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -852,6 +852,8 @@ int virNetSocketNewConnectSSH(const char *nodename,
cmd = virCommandNew(binary ? binary : "ssh");
virCommandAddEnvPassCommon(cmd);
+ virCommandAddEnvPass(cmd, "HOME");
No need to pass HOME, it's passed in virCommandAddEnvPassCommon() call
above.
+ virCommandAddEnvPass(cmd, "XDG_RUNTIME_DIR");
virCommandAddEnvPass(cmd, "KRB5CCNAME");
virCommandAddEnvPass(cmd, "SSH_AUTH_SOCK");
virCommandAddEnvPass(cmd, "SSH_ASKPASS");
Reviewed-by: Michal Privoznik <mprivozn(a)redhat.com>
and pushed. Congratulations on your first Libvirt contribution!
Michal