Skip to contentSkip to conversation

is_selinux_enabled in fileutils

DISCUSSION Joshua Brindle 4 participants 5 messages Sep 29, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

I'm just wondering a few things about the new API patches for fileutils (and no doubt others)

right now the ls, cp, mv patches etc do an is_selinux_enabled check which isn't technically required (since xattr is not specific to selinux). IMHO these artificial contraints shouldn't be added so that recovery cd's and things of this nature which have xattr enabled but not selinux will be able to see/copy/move files with their context. We aren't gaining any security by adding these contraints since libxattr, setfattr, getfattr, etc doesn't care if selinux is enabled or not (and are easier for mangling attributes anyway).

second, why aren't the selinux patches to file/coreutils generalized for all extended attributes? If we (or someone) made patches that would copy/move/view all extended attributes or just specified ones it could be used by many more people than just selinux users and would be more friendly upstream. the core/fileutils patches don't really even need to rely on libselinux since xattr is now standard in the kernel and the library for accessing xattr's is completely separate from selinux..

Thanks..

Joshua Brindle
Hardened Gentoo

--
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 22 lines · Joshua Brindle

I'm just wondering a few things about the new API patches for fileutils (and no doubt others)

right now the ls, cp, mv patches etc do an is_selinux_enabled check which isn't technically required (since xattr is not specific to selinux). IMHO these artificial contraints shouldn't be added so that recovery cd's and things of this nature which have xattr enabled but not selinux will be able to see/copy/move files with their context. We aren't gaining any security by adding these contraints since libxattr, setfattr, getfattr, etc doesn't care if selinux is enabled or not (and are easier for mangling attributes anyway).

second, why aren't the selinux patches to file/coreutils generalized
for all extended attributes? If we (or someone) made patches that
would copy/move/view all extended attributes or just specified ones
it could be used by many more people than just selinux users and
would be more friendly upstream. the core/fileutils patches don't
really even need to rely on libselinux since xattr is now standard
in the kernel and the library for accessing xattr's is completely separate from selinux..

Quoted 3 lines

Thanks..

The main problem is setxattr has to be done after the file is new created, so the file will sit on disk for a admittedly small amount of time with the wrong security context, and be vulnerable for that time. Using SELinux with setfscreatecon, causes the file to be created with the correct context before the contents get put on disk. I think your suggestion is valuable and the patch might be better rewritten to

if selinux
setfscreatecon
output file
setxattr
else
output file
setxattr
end

Quoted 11 lines

Joshua Brindle
Hardened Gentoo

--
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.

--
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.

#3 lore raw
In reply to Joshua Brindle
Quoted 13 lines · Joshua Brindle

I'm just wondering a few things about the new API patches for fileutils (and no doubt others)

right now the ls, cp, mv patches etc do an is_selinux_enabled check which isn't technically required (since xattr is not specific to selinux). IMHO these artificial contraints shouldn't be added so that recovery cd's and things of this nature which have xattr enabled but not selinux will be able to see/copy/move files with their context. We aren't gaining any security by adding these contraints since libxattr, setfattr, getfattr, etc doesn't care if selinux is enabled or not (and are easier for mangling attributes anyway).

Quoted 8 lines

second, why aren't the selinux patches to file/coreutils generalized for all extended attributes? If we (or someone) made patches that would copy/move/view all extended attributes or just specified ones it could be used by many more people than just selinux users and would be more friendly upstream. the core/fileutils patches don't really even need to rely on libselinux since xattr is now standard in the kernel and the library for accessing xattr's is completely separate from selinux..

The xattr API only supports a subset of the SELinux API. For example, the xattr API provides no way to create a file with a specified attribute value; you have to create the file with some default behavior, typically inherit-from-parent-directory, and then change its attribute. This leaves a window where the file may be accessible to unauthorized processes. The SELinux API allows for immediate creation of a file with a specified attribute. The new SELinux API makes use of three
components: the process attribute API (/proc/pid/attr), the xattr API, and the selinuxfs policy API.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.
#4 lore raw
In reply to Joshua Brindle
Quoted 8 lines · Joshua Brindle

second, why aren't the selinux patches to file/coreutils generalized for all extended attributes? If we (or someone) made patches that would copy/move/view all extended attributes or just specified ones it could be used by many more people than just selinux users and would be more friendly upstream. the core/fileutils patches don't really even need to rely on libselinux since xattr is now standard in the kernel and the library for accessing xattr's is completely separate from selinux..

As a side note, there already is a general xattr patch for coreutils from acl.bestbits.at, but it has the limitation that I mentioned with respect to not being able to create files immediately with a specified security attribute. This is a limitation of the xattr API, not just the implementation.

Signature · 8 lines
Stephen Smalley <[email protected]>
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
In reply to Daniel J Walsh
Quoted 6 lines · Daniel J Walsh

if selinux
setfscreatecon
output file
setxattr
else
output file

Of course there are some potential issues if the machine crashes at this point. However if you are running a SE Linux machine in non-SE mode then you probably have bigger problems than this. Also the old SE Linux with the ...security directory had problems like this on unexpected crashes, and I'm not sure that the use of XATTR's will solve this problem.

Quoted 2 lines

setxattr
end

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
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.