policycoreutils/fixfiles: do not dereference link files in tmp
Files in /tmp, /var/tmp, /var/run and /var/lib/debug labeled as unlabeled_t or undefined_t are relabeled to match corresponding directory label. Stop dereferencing link files in these folders in order not to accidentally change label of other files in the system. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1458831 Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
This commit is contained in:
parent
5a553e8287
commit
2608b4d666
|
@ -255,10 +255,10 @@ case "$RESTORE_MODE" in
|
|||
UNDEFINED=`get_undefined_type` || exit $?
|
||||
UNLABELED=`get_unlabeled_type` || exit $?
|
||||
find /tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) \( -type s -o -type p \) -delete
|
||||
find /tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --reference /tmp {} \;
|
||||
find /var/tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --reference /var/tmp {} \;
|
||||
find /var/run \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --reference /var/run {} \;
|
||||
[ ! -e /var/lib/debug ] || find /var/lib/debug \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --reference /lib {} \;
|
||||
find /tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /tmp {} \;
|
||||
find /var/tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /var/tmp {} \;
|
||||
find /var/run \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /var/run {} \;
|
||||
[ ! -e /var/lib/debug ] || find /var/lib/debug \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /lib {} \;
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue