Skip to contentSkip to conversation

useradd

DISCUSSION Russell Coker 2 participants 3 messages Oct 21, 2009 – Oct 23, 2009 SELinux security module

lore
Share & tools
lore
#0 lore raw

It seems impossible to have policy that allows useradd to always get the right context for the new home directory.

I am thinking of patching useradd such that if the -m option is given then it will spawn the command "restorecon -R /home/$USER" - or alternately putting in SE Linux code to match the context for each file or directory that is copied from /etc/skel .

What do you think?

Signature · 8 lines
[email protected]
http://etbe.coker.com.au/          My Main Blog
http://doc.coker.com.au/           My Documents Blog

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw
Quoted 9 lines · Russell Coker

It seems impossible to have policy that allows useradd to always get the right context for the new home directory.

I am thinking of patching useradd such that if the -m option is given then it will spawn the command "restorecon -R /home/$USER" - or alternately putting in SE Linux code to match the context for each file or directory that is copied from /etc/skel .

What do you think?

The useradd in shadow-utils is already modified to:
a) To add the user to seusers via semanage if the -Z option is used to specify a SELinux user, and
b) set the fscreate context based on matchpathcon() for the user home dir prior to creating the files there.

So it should already do the right thing.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 7 lines · Stephen Smalley

The useradd in shadow-utils is already modified to:
a) To add the user to seusers via semanage if the -Z option is used to specify a SELinux user, and
b) set the fscreate context based on matchpathcon() for the user home dir prior to creating the files there.

So it should already do the right thing.

I had forgotten that useradd in Debian is different from useradd in Fedora. Thanks for letting me know that the Fedora version does what is required.

I'll port the changes to Debian when I get time.

Signature · 8 lines
[email protected]
http://etbe.coker.com.au/          My Main Blog
http://doc.coker.com.au/           My Documents Blog

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.