]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virt-login-shell: fully reset container environment
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 12 Apr 2016 15:52:58 +0000 (16:52 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 10 Jun 2016 10:03:02 +0000 (11:03 +0100)
commitee877b871042099b6e9c66eea6cbcf90f8cfc2f0
treea5595533958814da6f72a307ce59fe5fc0282ce7
parent1ebe6f24341f3f8a0f4d4f995ce12326f062119c
virt-login-shell: fully reset container environment

The virt-login-shell environment will be initialized with
an arbitrary number of environment variables determined
by the SSH daemon and PAM configuration. Most of these are
not relevant inside the container, and at best they are
noise and at worst they'll break apps. For example if
XDG_RUNTIME_DIR is leaked to the container, it'll break
any apps using it, since  the directory it points to is
only visible to the host OS filesystem, not the container
FS.

Use clearenv() to blank out everything and then set known
good values for PATH, SHELL, USER, LOGNAME HOME and TERM.
Everything else is left up to the login shell to initialize.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
tools/virt-login-shell.c