policycoreutils/fixfiles: do not dereference link files in tmp
PATCH 1/1 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.
--- policycoreutils/scripts/fixfiles | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
policycoreutils/scripts/fixfiles +4 -4
@@ -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 }
Signature · 1 line
2.9.4
Stephen Smalley
AppliedQuoted 9 lines · Vit Mojzis
Files in /tmp,
/var/tmp,/var/runand/var/lib/debuglabeled asunlabeled_torundefined_tare 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.Signed-off-by Vit Mojzis <[email protected]>
Thanks, applied.
Quoted 38 lines
---
policycoreutils/scripts/fixfiles | 8 ++++----1 file changed, 4 insertions(+), 4 deletions(-)policycoreutils/scripts/fixfiles +0
-0@@ -255,10 +255,10 @@ case "$RESTORE_MODE" inUNDEFINED=`get_undefined_type` || exit $? UNLABELED=`get_unlabeled_type` || exit $?find /tmp \( -context "*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) \( -type s -o -type p \) -delete
policycoreutils/scripts/fixfiles +0
-1- find /tmp \( -context "*:${UNLABELED}*" -o -context"*:${UNDEFINED}*" \) -exec chcon --reference /tmp {} \;
policycoreutils/scripts/fixfiles +0
-1- find /var/tmp \( -context "*:${UNLABELED}*" -o -context"*:${UNDEFINED}*" \) -exec chcon --reference
/var/tmp{} \;policycoreutils/scripts/fixfiles +0
-1- find /var/run \( -context "*:${UNLABELED}*" -o -context"*:${UNDEFINED}*" \) -exec chcon --reference
/var/run{} \;policycoreutils/scripts/fixfiles +0
-1- [ ! -e /var/lib/debug ] || find /var/lib/debug \( -context"*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon -- reference /lib {} \;
policycoreutils/scripts/fixfiles +1
-0+ find /tmp \( -context "*:${UNLABELED}*" -o -context"*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference /tmp {} \;
policycoreutils/scripts/fixfiles +1
-0+ find /var/tmp \( -context "*:${UNLABELED}*" -o -context"*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference
/var/tmp{} \;policycoreutils/scripts/fixfiles +1
-0+ find /var/run \( -context "*:${UNLABELED}*" -o -context"*:${UNDEFINED}*" \) -exec chcon --no-dereference --reference
/var/run{} \;policycoreutils/scripts/fixfiles +1
-0+ [ ! -e /var/lib/debug ] || find /var/lib/debug \( -context"*:${UNLABELED}*" -o -context "*:${UNDEFINED}*" \) -exec chcon --no- dereference --reference /lib {} \;
;;
esac
}