All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] policycoreutils/fixfiles: do not dereference link files in tmp
@ 2017-06-16  8:29 Vit Mojzis
  2017-06-16 16:53 ` Stephen Smalley
  0 siblings, 1 reply; 2+ messages in thread
From: Vit Mojzis @ 2017-06-16  8:29 UTC (permalink / raw)
  To: selinux

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>
---
 policycoreutils/scripts/fixfiles | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/policycoreutils/scripts/fixfiles b/policycoreutils/scripts/fixfiles
index 0eeeea4..1aa330f 100755
--- a/policycoreutils/scripts/fixfiles
+++ b/policycoreutils/scripts/fixfiles
@@ -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
 }
-- 
2.9.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] policycoreutils/fixfiles: do not dereference link files in tmp
  2017-06-16  8:29 [PATCH] policycoreutils/fixfiles: do not dereference link files in tmp Vit Mojzis
@ 2017-06-16 16:53 ` Stephen Smalley
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Smalley @ 2017-06-16 16:53 UTC (permalink / raw)
  To: Vit Mojzis, selinux

On Fri, 2017-06-16 at 10:29 +0200, Vit Mojzis wrote:
> 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>

Thanks, applied.

> ---
>  policycoreutils/scripts/fixfiles | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/policycoreutils/scripts/fixfiles
> b/policycoreutils/scripts/fixfiles
> index 0eeeea4..1aa330f 100755
> --- a/policycoreutils/scripts/fixfiles
> +++ b/policycoreutils/scripts/fixfiles
> @@ -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
>  }

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-16 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-16  8:29 [PATCH] policycoreutils/fixfiles: do not dereference link files in tmp Vit Mojzis
2017-06-16 16:53 ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.