sulogin: relabel terminal according to SELinux policy
The common SELinux practice is to have a distinct label for terminals in
use by logged in users. This allows to differentiate access on the
associated terminal (e.g. user_tty_device_t) vs foreign ones (e.g.
tty_device_t or sysadm_tty_device_t). Therefore the application
performing the user login and setting up the associated terminal should
label that terminal according to the loaded SELinux policy. Commonly
this is done by pam_selinux(7). Since sulogin(8) does not use pam(7)
perform the necessary steps manually.
Fixes: https://github.com/util-linux/util-linux/issues/1578 Reviewed-by: James Carter <jwcart2@gmail.com> Signed-off-by: Christian Göttsche <cgzones@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>