platform_external_selinux/policycoreutils/setfiles
Antoine Tenart c94e542c98 policycoreutils: setfiles: do not restrict checks against a binary policy
The -c option allows to check the validity of contexts against a
specified binary policy. Its use is restricted: no pathname can be used
when a binary policy is given to setfiles. It's not clear if this is
intentional as the built-in help and the man page are not stating the
same thing about this (the man page document -c as a normal option,
while the built-in help shows it is restricted).

When generating full system images later used with SELinux in enforcing
mode, the extended attributed of files have to be set by the build
machine. The issue is setfiles always checks the contexts against a
policy (ctx_validate = 1) and using an external binary policy is not
currently possible when using a pathname. This ends up in setfiles
failing early as the contexts of the target image are not always
compatible with the ones of the build machine.

This patch reworks a check on optind only made when -c is used, that
enforced the use of a single argument to allow 1+ arguments, allowing to
use setfiles with an external binary policy and pathnames. The following
command is then allowed, as already documented in the man page:

  $ setfiles -m -r target/ -c policy.32 file_contexts target/

Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
Acked-by: Stephen Smalley <stephen.smalley.work@gmail.com>
2020-07-10 15:40:57 +02:00
..
ru Add man pages translation by Olesya Gerasimenko 2019-01-28 12:03:57 +01:00
.gitignore setfiles: Fix setfiles progress indicator 2017-01-27 09:39:22 -05:00
Makefile Allow installing translated man pages 2019-01-28 12:03:57 +01:00
restore.c setfiles: Add -E option to treat conflicting specifications as errors. 2020-04-14 18:22:25 +02:00
restore.h setfiles: Add -E option to treat conflicting specifications as errors. 2020-04-14 18:22:25 +02:00
restorecon.8 setfiles: clarify documented path resolution behaviour 2020-06-25 13:29:08 -04:00
restorecon_xattr.8 setfiles: Update utilities for the new digest scheme 2019-07-27 10:39:24 +02:00
restorecon_xattr.c setfiles: Update utilities for the new digest scheme 2019-07-27 10:39:24 +02:00
setfiles.8 setfiles: clarify documented path resolution behaviour 2020-06-25 13:29:08 -04:00
setfiles.c policycoreutils: setfiles: do not restrict checks against a binary policy 2020-07-10 15:40:57 +02:00