attr_copy_file()
This function usually returns errors when running on SE Linux. It tries to set the security.selinux attribute which in most cases will fail, and is often not desirable even if it will work.
To deal with this it has to check for a security.selinux attribute name and for whether SE Linux is active, if so then it needs special case handling.
I am considering two options for dealing with this. One is to just never copy security.selinux when SE Linux is enabled, the other is to never display EPERM error messages in this case if the operation fails. The problem with the latter is that every cp by sysadm_t acts like a "cp -c", which often is not what you desire.
This gets ugly in that code for is_selinux_enabled() will need to be copied into libxattr source (can't have libxattr and libselinux depend on each other).
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.
Quoted 13 lines · Russell Coker
This function usually returns errors when running on SE Linux. It tries to set the security.selinux attribute which in most cases will fail, and is often not desirable even if it will work.
To deal with this it has to check for a security.selinux attribute name and for whether SE Linux is active, if so then it needs special case handling.
I am considering two options for dealing with this. One is to just never copy security.selinux when SE Linux is enabled, the other is to never display EPERM error messages in this case if the operation fails. The problem with the latter is that every cp by
sysadm_tacts like a "cp -c", which often is not what you desire.
Quoted 3 lines
This gets ugly in that code for
is_selinux_enabled()will need to be copied into libxattr source (can't have libxattr and libselinux depend on each other).
- libselinux no longer depends on libattr at all, as it can obtain the [gs]etxattr functions from glibc. I posted a patch to eliminate the libattr dependency a while back.
- attr_copy_file doesn't appear to be called from the RH coreutils SRPM, so I assume you are looking at the one from acl.bestbits.at for some reason. Or has the coreutils xattr patch been incorporated into a more recent RH one?
- In the coreutils-xattr patch, a filter is already applied (via attr_copy_check_permissions) that excludes POSIX ACLs, trusted SGI attributes, and xfsroot attributes from the default copying behavior. It would be trivial to add a test to attr_copy_check_permissions to also exclude all attributes beginning with the "security." prefix, which are also permission-related. I'd suggest submitting a patch to acl-devel to do this.
- I don't see any reason for libattr to test for the presence of SELinux. It just needs to be patched to know about the "security." prefix as another namespace that has to do with file permissions and thus should not be copied by default.
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.