All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ivan Gyurdiev <gyurdiev@redhat.com>
To: Joshua Brindle <jbrindle@tresys.com>
Cc: Daniel J Walsh <dwalsh@redhat.com>,
	SELinux <selinux@tycho.nsa.gov>,
	selinux-dev@tresys.com
Subject: Re: Restorecon script
Date: Thu, 09 Jun 2005 22:32:47 -0400	[thread overview]
Message-ID: <1118370767.30464.16.camel@localhost.localdomain> (raw)
In-Reply-To: <42A8F6C1.20106@tresys.com>


> What problem is this solving?

It is solving the problem of labeling things properly in /tmp and /home
(according to recent policy changes, which I've been working on).
This cannot be accomplished by either inheriting the parent's context,
(because it's not the same), or by file_type_auto_trans, because of
ambiguity - same type change rule matches multiple target types.
You can see details of what I mean in the thread "file_type_auto_trans
is not sufficient" on selinux@tycho.nsa.gov.

It can be solved by setfscreate code in the application, but
that's worse - intrusive code in multiple applications.

Creating folders ahead of time is the most acceptable solution so far.
I'm not sure how exactly this should be done, but some sort of simple 
script like this is one possibility. 

>  In general relabeling isn't something that 
> should be done without careful attention, especially when automated. 

I agree.

> User home directories shouldn't have incorrect labels is care is taken 
> (ie, skel contains the directories you'd be relabeling anyway and they 
> are labeled correctly when the user is added).

skel is populated when installing individual applications, and 
that doesn't fix the labels for existing users, only for newly 
created users. Also, that doesn't address /tmp.
==============

Here's a new script:

#!/bin/bash

([ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled) || exit

DIRS=" \
/tmp/orbit-$USER \
$HOME/.fonts \
$HOME/.fonts/auto \
$HOME/.gnome2 \
$HOME/.gnome2/share/fonts \
$HOME/.gnome2/share/cursor-fonts \
$HOME/.gnome2_private \
$HOME/.mozilla \
$HOME/.evolution \
$HOME/.thunderbird \
"

for DIR in $DIRS; do
[ -d $DIR ] || mkdir -m 700 -p $DIR
done

RESTORED=`/sbin/restorecon -v $DIRS 2>&1`
if [ ! -z "$RESTORED" ]; then
        RESULT=`echo "$RESTORED" | awk '{ print $3 }'`
        echo "Restoring SELinux context for:"
        echo $RESULT | sed 's| |\n|g'
        /sbin/restorecon -R $RESULT
fi




--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.

  reply	other threads:[~2005-06-10  2:39 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-09 14:41 Restorecon script Ivan Gyurdiev
2005-06-10  2:11 ` Joshua Brindle
2005-06-10  2:32   ` Ivan Gyurdiev [this message]
2005-06-10 13:52     ` Steve G
2005-06-10 18:04       ` Ivan Gyurdiev
2005-06-10 16:05     ` Joshua Brindle
2005-06-10 16:11       ` Stephen Smalley
2005-06-10 17:44         ` Karl MacMillan
2005-06-10 17:41           ` Stephen Smalley
2005-06-10 18:01             ` Ivan Gyurdiev
2005-06-10 18:06             ` Karl MacMillan
2005-06-10 18:04               ` Stephen Smalley
2005-06-10 18:59                 ` Karl MacMillan
2005-06-10 18:21               ` Ivan Gyurdiev
2005-06-10 19:58                 ` Karl MacMillan
2005-06-10 20:45                   ` Ivan Gyurdiev
2005-06-10 21:05                     ` Karl MacMillan
2005-06-10 21:47                       ` Ivan Gyurdiev
2005-06-11 17:45                         ` Karl MacMillan
2005-06-11 18:35                           ` Ivan Gyurdiev
2005-06-10 20:18                 ` Luke Kenneth Casson Leighton
2005-06-10 20:54                   ` Ivan Gyurdiev
2005-06-10 21:05                   ` Valdis.Kletnieks
2005-06-10 21:42                     ` Luke Kenneth Casson Leighton
2005-06-10 21:03                 ` Joshua Brindle
2005-06-10 21:30                   ` Ivan Gyurdiev
2005-06-11 18:00                     ` Karl MacMillan
2005-06-10 17:58       ` Ivan Gyurdiev
2005-06-10 18:19         ` Karl MacMillan
2005-06-10 18:31           ` Ivan Gyurdiev
2005-06-10 19:45             ` Karl MacMillan
2005-06-10 20:57               ` Ivan Gyurdiev
2005-06-10 21:09                 ` Karl MacMillan
2005-06-10 20:26             ` Luke Kenneth Casson Leighton
2005-06-10 21:57               ` Ivan Gyurdiev
2005-06-10 22:11                 ` Luke Kenneth Casson Leighton
2005-06-10 20:21           ` Luke Kenneth Casson Leighton
2005-06-11  0:09             ` Valdis.Kletnieks
2005-06-11  1:13               ` Casey Schaufler
2005-06-10 15:15 ` Stephen Smalley
2005-06-10 15:38   ` Stephen Smalley
2005-06-10 17:15     ` Ivan Gyurdiev
2005-06-10 17:12   ` Ivan Gyurdiev
2005-06-10 15:18 ` Stephen Smalley
2005-06-10 17:52   ` Ivan Gyurdiev
2005-06-10 20:23     ` Luke Kenneth Casson Leighton
2005-06-10 21:59       ` Ivan Gyurdiev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1118370767.30464.16.camel@localhost.localdomain \
    --to=gyurdiev@redhat.com \
    --cc=dwalsh@redhat.com \
    --cc=jbrindle@tresys.com \
    --cc=selinux-dev@tresys.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.