initrdinject: Force added files to be owned as root (bz 1686464)

systemd in fedora30 has some new security restriction about non-root
owned directories. Initrd inject would tickle this because the cpio
archive would cause the root dir in the initrd to be owned by the
uid that launched virt-install.

Pass --owner=+0:+0 to cpio to force root ownership

Suggested-by: James Szinger <jszinger@gmail.com>

https://bugzilla.redhat.com/show_bug.cgi?id=1686464
This commit is contained in:
Cole Robinson 2019-04-03 18:07:12 -04:00
parent d252061b4b
commit c6b5f22fa6

View File

@ -31,7 +31,7 @@ def perform_initrd_injections(initrd, injections, scratchdir):
stderr=subprocess.PIPE,
cwd=tempdir)
cpio_proc = subprocess.Popen(['cpio', '--create', '--null', '--quiet',
'--format=newc'],
'--format=newc', '--owner=+0:+0'],
stdin=find_proc.stdout,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,