/dev/pts/* denials w/devfs
I'm trying to integrate SELinux with Gentoo
(http://www.gentoo.org/proj/en/hardened/), however I'm encountering some problems. The problem surrounds /dev/pts/* denials. Gentoo uses devfs, so I have a feeling that it might be causing some problems. For example, the following are the denials I get when logging in via ssh. The ssh.te is still the stock from selinux-small, and openssh is patched. I also have the devfsd-se.so devfsd module running. Suggestions?
Thanks, Chris
avc: denied { getattr } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=system_u:object_r:devpts_t tclass=chr_file
avc: denied { read write } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=system_u:object_r:devpts_t tclass=chr_file
avc: denied { ioctl } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=system_u:object_r:devpts_t tclass=chr_file
avc: denied { setattr } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=system_u:object_r:devpts_t tclass=chr_file
avc: denied { relabelfrom } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=system_u:object_r:devpts_t tclass=chr_file
avc: denied { relabelto } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=pebenito:object_r:devpts_t tclass=chr_file
avc: denied { ioctl } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=pebenito:object_r:devpts_t tclass=chr_file
avc: denied { read write } for pid=3911 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=pebenito:object_r:devpts_t tclass=chr_file
avc: denied { getattr } for pid=3912 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=pebenito:object_r:devpts_t tclass=chr_file
avc: denied { read write } for pid=3912 exe=/bin/bash path=/pts/1 dev=00:07 ino=917 scontext=pebenito:user_r:user_t tcontext=pebenito:object_r:devpts_t tclass=chr_file
avc: denied { ioctl } for pid=3912 exe=/bin/bash path=/pts/1 dev=00:07 ino=917 scontext=pebenito:user_r:user_t tcontext=pebenito:object_r:devpts_t tclass=chr_file
avc: denied { getattr } for pid=3912 exe=/bin/bash path=/pts/1 dev=00:07 ino=917 scontext=pebenito:user_r:user_t tcontext=pebenito:object_r:devpts_t tclass=chr_file
Signature · 13 lines
Chris PeBenito <[email protected]> AIM: PeBenito78 ICQ#: 10434387 "Engineering does not require science. Science helps a lot, but people built perfectly good brick walls long before they knew why cement works."-Alan Cox -- 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 10 lines · Christopher J. PeBenito
problems. The problem surrounds
/dev/pts/*denials. Gentoo uses devfs, so I have a feeling that it might be causing some problems. For example, the following are the denials I get when logging in via ssh. The ssh.te is still the stock from selinux-small, and openssh is patched. I also have the devfsd-se.so devfsd module running. Suggestions?avc: denied { getattr } for pid=3909 exe=/usr/sbin/sshd path=/pts/1 dev=00:07 ino=917 scontext=system_u:system_r:sshd_t tcontext=system_u:object_r:devpts_t tclass=chr_file
REGISTER ^pts/.* IGNORE
Try putting the above line near the start of the devfsd.conf file.
I suspect that your problem is that devfsd is accessing the /dev/pts/* file first and then the type_transition rule doesn't apply.
The problem with this solution is that you then can't have the /dev/pts/* nodes default to being writable by group "tty" as one of the Unix specs requires. But then SE Linux can enable other solutions to this (EG a SETUID version of wall isn't a big deal).
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 8 lines · Christopher J. PeBenito
I'm trying to integrate SELinux with Gentoo
(http://www.gentoo.org/proj/en/hardened/), however I'm encountering some problems. The problem surrounds/dev/pts/*denials. Gentoo uses devfs, so I have a feeling that it might be causing some problems. For example, the following are the denials I get when logging in via ssh. The ssh.te is still the stock from selinux-small, and openssh is patched. I also have the devfsd-se.so devfsd module running. Suggestions?
The devfs kernel code really needs to be patched to work properly with SELinux; your pty problem is just a small part of the problem. Note that in 2.4, we have to patch devpts for it to properly set up the inode's security label; in 2.5, this is handled without patching because devpts_pty_new now calls d_instantiate, so we can set up the security label in the usual manner via the d_instantiate hook. You could patch the devfs code similarly, but there isn't much point in doing so, as unix98 pty support has been removed from devfs in 2.5, so everyone needs to start using devpts anyway if they want unix98 ptys. A more serious problem with using devfs with SELinux is preserving security labels on devfs entries when they are evicted from the dcache; if you don't patch devfs to preserve the security information, devfs entries will "lose" any security label when the entry is evicted.
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.