Skip to contentSkip to conversation

automatic type transitions for pts in devfs

DISCUSSION Russell Coker 2 participants 3 messages Mar 6, 2002 – Mar 9, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

It seems that the automatic type transitions for /dev/pts don't work on devfs. When the sshd (in sshd_t domain) opens /dev/pts/1 it does not get changed to sshd_devpts_t domain.

When I put the following in my devfs_contexts file it all works as desired (so my only problem is the sshd_t causing a transition of the /dev/pts/1 device node to sshd_devpts_t.
/pts system_u:object_r:sshd_devpts_t

I'm using the default sshd configuration.

Signature · 9 lines
If you send email to me or to a mailing list that I use which has >4 lines
of legalistic junk at the end then you are specifically authorizing me to do
whatever I wish with the message and all other messages from your domain, by
posting the message you agree that your long legalistic sig is void.

--
You have received this message because you are subscribed to the selinux 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 3 lines · Russell Coker

It seems that the automatic type transitions for /dev/pts don't work on devfs. When the sshd (in sshd_t domain) opens /dev/pts/1 it does not get changed to sshd_devpts_t domain.

Right. The initial labeling of pty nodes based on the allocating process domain is only implemented for the devpts filesystem at present, not the devfs filesystem. The SELinux kernel module performs special processing for the devpts filesystem type to ensure that new nodes are initially labeled with the type specified by a type transition rule between the domain that initially allocated the pty and the base devpts_t type. When sshd or rlogind allocate a pty in a devpts filesystem, it is initially labeled by the kernel with a sshd_devpts_t or rlogind_devpts_t type and is subsequently relabeled by sshd or login to the appropriate user_devpts_t or sysadm_devpts_t type. When a user runs X, his ptys are initially allocated from the user_t or sysadm_t domain, so they are immediately labeled with user_devpts_t or sysadm_devpts_t by the kernel.

At present, we don't use devfs on our systems, so it hasn't (yet) been a priority to provide identical functionality in devfs.

--
Stephen D. Smalley, NAI Labs
[email protected]

--
You have received this message because you are subscribed to the selinux 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
Quoted 3 lines · Russell Coker

It seems that the automatic type transitions for /dev/pts don't work on devfs. When the sshd (in sshd_t domain) opens /dev/pts/1 it does not get changed to sshd_devpts_t domain.

Right. The initial labeling of pty nodes based on the allocating process domain is only implemented for the devpts filesystem at present, not the

[...]

Quoted 2 lines

At present, we don't use devfs on our systems, so it hasn't (yet) been a priority to provide identical functionality in devfs.

I've tried patching that myself, but it seems that my skills are not up to it.

It seems that the filp->f_owner.pid is being set in the devfs initialisation code somehow at an earlier stage than in devpts, therefore by the time tty_fasync() is called it's already done and the set_fowner() call is skipped.

Could you give me a clue as to where I should look next? Or would you recommend that I give up?

Signature · 9 lines
If you send email to me or to a mailing list that I use which has >4 lines
of legalistic junk at the end then you are specifically authorizing me to do
whatever I wish with the message and all other messages from your domain, by
posting the message you agree that your long legalistic sig is void.

--
You have received this message because you are subscribed to the selinux list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.