initrc question and initrc+proftpd patch
I have one question about the initrc handling in the example policy:
Why does it not do a domain transition to initrc_t when the scripts are executed by sysadm_t (i.e. manually by the sysadmin) ?
With the example policy, the same process started at system boot or manually later will run in different domains. I've added this line to domains/program/initrc.te:
domain_auto_trans(sysadm_t, initrc_exec_t, initrc_t)
But please tell me if there's a reason why it's not there, and I'm dumb and/or compromising the system's security. In order for this to work on debian, I also added to file_contexts:
/etc/init.d(|/.*) system_u:object_r:initrc_exec_t
The weird part is that SOME of the program.te files have a domain_auto_trans line which serves essentially the same purpose. Does it make sense to define this transition individually for each program or doesn't it make more sense to drop these transitions and instead trans to the initrc domain when the admin executes an init script?
Finally, some patches/changes to add proftpd support (using the existing ftpd types and files):
add to domains/program/ftpd.te:domain_auto_trans(initrc_t, ftpd_exec_t, ftpd_t)
for standalone ftp servers, such as proftpd. the current ftpd.te only works for ftp daemons being called by inetd or tcpd.
add to file_contexts:/etc/proftpd.conf system_u:object_r:etc_ftp_t/usr/sbin/proftpd system_u:object_r:ftpd_exec_t
plus the ftpd.te line from above and proftpd should be working. the etc_ftp_t type was added by me to types/file.te:
type etc_ftp_t, file_type, sysadmfile;
this is essentially a copy of etc_mail_t.
next time, I'll post a real diff file. my current playing-around policy is so messed up that making a diff is not practical, sorry.
Signature · 8 lines
http://web.lemuria.org/pubkey.html pub 1024D/D88D35A6 2001-11-14 Tom Vogt <[email protected]> Key fingerprint = 276B B7BB E4D8 FCCE DB8F F965 310B 811A D88D 35A6 -- 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.
Quoted 9 lines · Tom
I have one question about the initrc handling in the example policy:
Why does it not do a domain transition to
initrc_twhen the scripts are executed bysysadm_t(i.e. manually by the sysadmin) ?
With the example policy, the same process started at system boot or manually later will run in different domains. I've added this line to domains/program/initrc.te:
domain_auto_trans(sysadm_t, initrc_exec_t, initrc_t)
The init scripts should be run via run_init by an administrator. A domain transition is not sufficient, as it does not address the user identity or role attributes, and a direct transition poses risks from malicious code.
--
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.
Quoted 3 lines · Stephen Smalley
The init scripts should be run via
run_initby an administrator. A domain transition is not sufficient, as it does not address the user identity or role attributes, and a direct transition poses risks from malicious code.
That makes sense and leaves just one question: Why then do some of the program.te files contain a domain transition for the sysadmin user? snort is one example.
Signature · 8 lines
http://web.lemuria.org/pubkey.html pub 1024D/D88D35A6 2001-11-14 Tom Vogt <[email protected]> Key fingerprint = 276B B7BB E4D8 FCCE DB8F F965 310B 811A D88D 35A6 -- 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.
Quoted 2 lines · Tom
Why does it not do a domain transition to
initrc_twhen the scripts are executed bysysadm_t(i.e. manually by the sysadmin) ?
Here's the answer Steve gave when I asked that question:
http://marc.theaimsgroup.com/?l=selinux&m=101170830818619&w=2
Quoted 3 lines
With the example policy, the same process started at system boot or manually later will run in different domains. I've added this line to domains/program/initrc.te:
You are supposed to use "run_init /etc/init.d/daemon start" to start the daemon.
Quoted 5 lines
But please tell me if there's a reason why it's not there, and I'm dumb and/or compromising the system's security. In order for this to work on debian, I also added to
file_contexts:/etc/init.d(|/.*) system_u:object_r:initrc_exec_t
I tried that once, but decided it was a bad idea and changed it back.
Quoted 2 lines
The weird part is that SOME of the program.te files have a
domain_auto_transline which serves essentially the same purpose. Does
Which ones are you referring to?
Quoted 1 line
From a casual inspection I can't see any daemon what has such a
configuration. There are many utility programs such as fsck and ifconfig that do, but they are in a different category.
Quoted 5 lines
Finally, some patches/changes to add proftpd support (using the existing ftpd types and files):
add to domains/program/ftpd.te:
domain_auto_trans(initrc_t, ftpd_exec_t, ftpd_t)
I've put in the following:domain_auto_trans({ initrc_t inetd_t tcpd_t }, ftpd_exec_t, ftpd_t)
Better one line than 3.
Quoted 7 lines
/etc/proftpd.confsystem_u:object_r:etc_ftp_t/usr/sbin/proftpdsystem_u:object_r:ftpd_exec_tplus the ftpd.te line from above and proftpd should be working. the
etc_ftp_ttype was added by me to types/file.te:type
etc_ftp_t,file_type, sysadmfile;
OK, I've merged that in my tree. But I've changed etc_ftp_t to etc_ftpd_t (next you might want a policy for ncftp or some other FTP client that has config files in /etc).
Quoted 2 lines
next time, I'll post a real diff file. my current playing-around policy is so messed up that making a diff is not practical, sorry.
You could just email me the files complete.
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.
Quoted 3 lines · Tom
That makes sense and leaves just one question: Why then do some of the program.te files contain a domain transition for the sysadmin user? snort is one example.
Some programs are directly executed by administrators as utilities in addition to being executed from init scripts. In that case, you can simply use a domain transition from sysadm_t to the program domain. However, I wouldn't be surprised if there are unnecessary transitions from sysadm_t to some of the program domains.
--
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.
Quoted 7 lines · Russell Coker
Quoted 5 lines
But please tell me if there's a reason why it's not there, and I'm dumb and/or compromising the system's security. In order for this to work on debian, I also added to
file_contexts:/etc/init.d(|/.*) system_u:object_r:initrc_exec_t
I tried that once, but decided it was a bad idea and changed it back.
Why was it a bad idea? Even without the auto transition, these files are, IMHO, special enough and should have a domain. For example, you may want to restrict run_init to only being able to execute initrc_exec_t files.
Quoted 4 lines
Quoted 2 lines
The weird part is that SOME of the program.te files have a
domain_auto_transline which serves essentially the same purpose. DoesWhich ones are you referring to?
snort is one example I know by heart. I dig the utils, such as ifconfig, but some daemons have this, too.
Quoted 4 lines
I've put in the following:
domain_auto_trans({ initrc_t inetd_t tcpd_t }, ftpd_exec_t, ftpd_t)Better one line than 3.
yes. I'm still learning syntax, and just discovered that the policy files understand lists. :)
Signature · 8 lines
http://web.lemuria.org/pubkey.html pub 1024D/D88D35A6 2001-11-14 Tom Vogt <[email protected]> Key fingerprint = 276B B7BB E4D8 FCCE DB8F F965 310B 811A D88D 35A6 -- 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.
Quoted 5 lines · Tom
Quoted 4 lines · Russell Coker
Quoted 4 lines
But please tell me if there's a reason why it's not there, and I'm dumb and/or compromising the system's security. In order for this to work on debian, I also added to
file_contexts:
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
/etc/init.d(|/.*) system_u:object_r:initrc_exec_t
I tried that once, but decided it was a bad idea and changed it back.
Why was it a bad idea? Even without the auto transition, these files are, IMHO, special enough and should have a domain. For example, you may want to restrict
run_initto only being able to executeinitrc_exec_tfiles.
I first tried having a transition from init_t to the relevant domain via a hacked run_init that didn't require a password if the source context was system_u:system_r:init_t. Then I decided that was a bad idea and make the /etc/init.d files be of initrc_exec_t to trigger an automatic domain transition, then I did the following:/etc/init.d/rc system_u:object_r:initrc_exec_t/etc/init.d/rcS system_u:object_r:initrc_exec_t
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
The weird part is that SOME of the program.te files have a
domain_auto_transline which serves essentially the same purpose. DoesWhich ones are you referring to?
snort is one example I know by heart. I dig the utils, such as ifconfig, but some daemons have this, too.
Which daemons?
I'll change them...
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.