Skip to contentSkip to conversation

/dev/pts/x use denials

DISCUSSION Ivan Gyurdiev 3 participants 7 messages Apr 3, 2005 – Apr 4, 2005 SELinux security module

lore
Share & tools
lore
#0 lore raw

Strange denials:

/dev/pts/2 has context: sysadm_tmp_t.
Those happen intermittently, but I can't figure out when exactly. I am logged in as a regular user, but su-ed to root. Usually accompanied by a dac_override.

audit(1112568847.907:0): avc: denied { use } for pid=22851 exe=/usr/bin/mplayer path=/dev/pts/2 dev=devpts ino=4 scontext=root:sysadm_r:sysadm_mplayer_t tcontext=phantom:staff_r:staff_t tclass=fd
audit(1112568874.222:0): avc: denied { use } for pid=22870 exe=/usr/bin/tvtime path=/dev/pts/2 dev=devpts ino=4 scontext=root:sysadm_r:sysadm_tvtime_t tcontext=phantom:staff_r:staff_t tclass=fd
audit(1112568881.428:0): avc: denied { use } for pid=22872 exe=/bin/bash path=/dev/pts/2 dev=devpts ino=4 scontext=root:sysadm_r:sysadm_mozilla_t tcontext=phantom:staff_r:staff_t tclass=fd

Signature · 8 lines
Ivan Gyurdiev <[email protected]>
Cornell University


--
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 6 lines · Ivan Gyurdiev

Strange denials:

/dev/pts/2 has context: sysadm_tmp_t.
Those happen intermittently, but I can't figure out when exactly. I am logged in as a regular user, but su-ed to root. Usually accompanied by a dac_override.

It's sometimes followed by a dac_override - not all the time. Here's something reproducible:

If I su to root, launch tvtime/mplayer/whatever, then make load the selinux policy, I get use denial on /dev/pts. Then if I launch the same program - no use denial. Then I make load the policy again, launch program, and I get a use denial.

Signature · 8 lines
Ivan Gyurdiev <[email protected]>
Cornell University


--
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 12 lines · Ivan Gyurdiev
Quoted 8 lines · Ivan Gyurdiev

Strange denials:

/dev/pts/2 has context: sysadm_tmp_t.
Those happen intermittently, but I can't figure out when exactly. I am logged in as a regular user, but su-ed to root. Usually accompanied by a dac_override.

Quoted 10 lines

It's sometimes followed by a dac_override - not all the time. Here's something reproducible:

If I su to root, launch tvtime/mplayer/whatever, then make load the selinux policy, I get use denial on /dev/pts. Then if I launch the same program - no use denial. Then I make load the policy again, launch program, and I get a use denial.

If you are running in permissive mode, you only get the denial once. When you reload the policy it clears the flag.

Dan

Signature · 4 lines
--
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 Ivan Gyurdiev
Quoted 7 lines · Ivan Gyurdiev

Strange denials:

/dev/pts/2 has context: sysadm_tmp_t.
Those happen intermittently, but I can't figure out when exactly. I am logged in as a regular user, but su-ed to root. Usually accompanied by a dac_override.

Quoted 12 lines

audit(1112568847.907:0): avc: denied { use } for pid=22851 exe=/usr/bin/mplayer path=/dev/pts/2 dev=devpts ino=4 scontext=root:sysadm_r:sysadm_mplayer_t tcontext=phantom:staff_r:staff_t tclass=fd
audit(1112568874.222:0): avc: denied { use } for pid=22870 exe=/usr/bin/tvtime path=/dev/pts/2 dev=devpts ino=4 scontext=root:sysadm_r:sysadm_tvtime_t tcontext=phantom:staff_r:staff_t tclass=fd
audit(1112568881.428:0): avc: denied { use } for pid=22872 exe=/bin/bash path=/dev/pts/2 dev=devpts ino=4 scontext=root:sysadm_r:sysadm_mozilla_t tcontext=phantom:staff_r:staff_t tclass=fd

I don't see sysadm_tmp_t anywhere above. I do see staff_t fd's, but that just shows that the descriptor was opened by a staff_t process and then inherited across the su, nothing surprising there. Earlier versions of pam_selinux did try closing and re-opening descriptors 0-2 as newrole does, but that proved problematic. su likely just needs to be directly patched rather than using pam_selinux.

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
Quoted 2 lines

I don't see sysadm_tmp_t anywhere above.

Right, that was a typo.. I'm sure I meant sysadm_devpts_t (or at least I hope I did - sysadm_tmp_t doesn't make sense)

Quoted 6 lines

I do see staff_t fd's, but that
just shows that the descriptor was opened by a staff_t process and then inherited across the su, nothing surprising there. Earlier versions of pam_selinux did try closing and re-opening descriptors 0-2 as newrole does, but that proved problematic. su likely just needs to be directly patched rather than using pam_selinux.

What was the problem?
I remember another message about this, but I didn't understand it then - I see what you mean now.

Signature · 8 lines
Ivan Gyurdiev <[email protected]>
Cornell University


--
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.
#5 lore raw
Quoted 10 lines · Ivan Gyurdiev
Quoted 6 lines

I do see staff_t fd's, but that
just shows that the descriptor was opened by a staff_t process and then inherited across the su, nothing surprising there. Earlier versions of pam_selinux did try closing and re-opening descriptors 0-2 as newrole does, but that proved problematic. su likely just needs to be directly patched rather than using pam_selinux.

What was the problem?
I remember another message about this, but I didn't understand it then - I see what you mean now.

IIRC, it had to do with su's manipulation of fsuid/fsguid prior to calling pam_open_session; this ultimately prevented pam_selinux from being able to re-open the tty due to DAC restrictions. There were several bugzillas related to su and sudo and the issues of tty relabeling, descriptor inheritance, etc during earlier Fedora integration (likely filed against rawhide). As a separate but related issue, having a proxy pty for su/sudo similar to what is now being done for run_init would be helpful in providing stronger isolation. That came up too during earlier bugzillas I think.

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.
#6 lore raw
In reply to Ivan Gyurdiev
Quoted 17 lines · Ivan Gyurdiev
Quoted 3 lines

I don't see sysadm_tmp_t anywhere above.

Right, that was a typo.. I'm sure I meant sysadm_devpts_t (or at least I hope I did - sysadm_tmp_t doesn't make sense)

Quoted 8 lines

I do see staff_t fd's, but that
just shows that the descriptor was opened by a staff_t process and then inherited across the su, nothing surprising there. Earlier versions of pam_selinux did try closing and re-opening descriptors 0-2 as newrole does, but that proved problematic. su likely just needs to be directly patched rather than using pam_selinux.

Quoted 6 lines

What was the problem?
I remember another message about this, but I didn't understand it then - I see what you mean now.

Closing and reopeing a tty device in a pam module is not a good idea.

Signature · 4 lines
--
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.