Skip to contentSkip to conversation

automatic type transitions for pts in devfs

DISCUSSION Debian User 2 participants 9 messages Jul 9, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

Whats best way to go about this? Where do i look first? I will try fixing this with some help.

Russell?

Is there a work around for this?

--
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 2 lines · Debian User

Whats best way to go about this? Where do i look first? I will try fixing this with some help.

You can look at how we provide labeling for the devpts filesystem. The devpts filesystem uses transition SIDs to label its inodes. Look at the sbsec->uses_trans case of inode_precondition in lsm-2.4/security/selinux/hooks.c. The devfs filesystem uses genfs_contexts to label its inodes (the sbsec->uses_genfs case). You want devfs to actually be a hybrid of the two methods, with /pts entries in devfs using transition SIDs like devpts and other entries using genfs_contexts.

--
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 9 lines · Stephen Smalley
Quoted 4 lines · Debian User

Whats best way to go about this? Where do i look first? I will try fixing this with some help.

Quoted 10 lines

You can look at how we provide labeling for the devpts filesystem. The devpts filesystem uses transition SIDs to label its inodes. Look at the sbsec->uses_trans case of inode_precondition in lsm-2.4/security/selinux/hooks.c. The devfs filesystem uses genfs_contexts to label its inodes (the sbsec->uses_genfs case). You want devfs to actually be a hybrid of the two methods, with /pts entries in devfs using transition SIDs like devpts and other entries using genfs_contexts.

I see im beginning to see things clearly. Are all the stuff involved in this restricted to hooks.c? Im afraid im not familiar with lsm. I have to look for an introduction somewhere.

Quoted 7 lines

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

#5 lore raw
In reply to Stephen Smalley
Quoted 9 lines · Stephen Smalley
Quoted 4 lines · Debian User

Whats best way to go about this? Where do i look first? I will try fixing this with some help.

Quoted 10 lines

You can look at how we provide labeling for the devpts filesystem. The devpts filesystem uses transition SIDs to label its inodes. Look at the sbsec->uses_trans case of inode_precondition in lsm-2.4/security/selinux/hooks.c. The devfs filesystem uses genfs_contexts to label its inodes (the sbsec->uses_genfs case). You want devfs to actually be a hybrid of the two methods, with /pts entries in devfs using transition SIDs like devpts and other entries using genfs_contexts.

Ok I just read through the technical paper.
So I focus on hooks.c. This is basically getting the inodes labelled correctly.
Either we add some new fields(?) in the inode structure or we insert a condition that would make the inode get the proper label. Is that correct?

I hope someone can beat me to the answer.

Quoted 7 lines

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

#3 lore raw
In reply to Debian User
Quoted 1 line · Debian User

Are all the stuff involved in this restricted to hooks.c?

You can implement a quick-and-dirty solution entirely by modifying hooks.c. A more general solution will require changes to the security server and the policy configuration to support such hybrid schemes.

Quoted 2 lines

Im afraid im not familiar with lsm. I have
to look for an introduction somewhere.

lsm.immunix.org has some documentation about LSM. The NSA SELinux site has a technical report describing the implementation of the LSM-based SELinux module, although it is not entirely up-to-date.

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

#6 lore raw
In reply to Debian User
Quoted 4 lines · Debian User

So I focus on hooks.c. This is basically getting the inodes labelled correctly.
Either we add some new fields(?) in the inode structure or we insert a condition that would make the inode get the proper label. Is that correct?

You could add a test within the sbsec->uses_genfs case to see whether the filesystem type is devfs and whether the inode corresponds to a /pts node. If so, then you want to use a transition SID as with the sbsec->uses_trans case. Otherwise, you would use genfs_contexts as usual.

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

#4 lore raw
In reply to Stephen Smalley
Quoted 4 lines · Stephen Smalley

On Tue, 9 Jul 2002, Debian User wrote:

Quoted 9 lines
Quoted 3 lines

Are all the stuff involved in this restricted to hooks.c?

You can implement a quick-and-dirty solution entirely by modifying hooks.c. A more general solution will require changes to the security server and the policy configuration to support such hybrid schemes.

I will try the quick and dirty solution. I have an idea where to look. I just read some papers and its very enlightening. It looks like i need to wrap the present set of nested ifs with another that tests some variables to get inode properly labeled.

Quoted 7 lines
Quoted 6 lines

Im afraid im not familiar with lsm. I have
to look for an introduction somewhere.

Quoted 11 lines

lsm.immunix.org has some documentation about LSM. The NSA SELinux site has a technical report describing the implementation of the LSM-based SELinux module, although it is not entirely up-to-date.

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

#7 lore raw
In reply to Stephen Smalley
Quoted 11 lines · Stephen Smalley
Quoted 6 lines · Debian User

So I focus on hooks.c. This is basically getting the inodes labelled correctly.
Either we add some new fields(?) in the inode structure or we insert a condition that would make the inode get the proper label. Is that correct?

Quoted 6 lines

You could add a test within the sbsec->uses_genfs case to see whether the filesystem type is devfs and whether the inode corresponds to a /pts node. If so, then you want to use a transition SID as with the sbsec->uses_trans case. Otherwise, you would use genfs_contexts as usual.

cool! i see it now. this is great. this is the first time i hacked devfs and selinux! Thanks!

Quoted 7 lines

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

#8 lore raw
In reply to Stephen Smalley
Quoted 11 lines · Stephen Smalley
Quoted 6 lines · Debian User

So I focus on hooks.c. This is basically getting the inodes labelled correctly.
Either we add some new fields(?) in the inode structure or we insert a condition that would make the inode get the proper label. Is that correct?

Quoted 6 lines

You could add a test within the sbsec->uses_genfs case to see whether the filesystem type is devfs and whether the inode corresponds to a /pts node. If so, then you want to use a transition SID as with the sbsec->uses_trans case. Otherwise, you would use genfs_contexts as usual.

That would mean checking if the inode's super block magic number is DEVPTS. Is that going to be enough?

Quoted 7 lines

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