new policy
diff -ruN /tmp/policy/domains/program/hwclock.te ./domains/program/hwclock.te
--- /tmp/policy/domains/program/hwclock.te 2002-12-03 15:56:40.000000000
+0
100
+++ ./domains/program/hwclock.te 2002-08-21 20:22:44.000000000 +0200
@@ -45,3 +45,5 @@
allow hwclock_t ptyfile:chr_file rw_file_perms; ifdef(gnome-pty-helper.te', allow hwclock_t sysadm_gph_t:fd use;')
+# hwclock needs to search file_t directories when run from rc.sysinit on RH8 +allow hwclock_t file_t:dir search;
For the above change that's recently committed, shouldn't it have ifdef(`rpm.te', around it?
I've attached another patch with the following features:
Don't audit an ioctl that the latest Perl does when the boot loader scripts read the modules dependency file.
Added a can_exec rule for the ftpd cron jobs.
Allow ipsec_mgmt_t to read it's own symlinks in /proc.
Added support for the new setup of modutils in Debian that apparently provides transperant support for 2.4.x and 2.5.x kernels. I don't know if the 2.5.x functionality works properly, but this is required for 2.4.x to work properly. RH probably doesn't need this yet, but they'll probably do the same thing when they support 2.6.x kernels.
Signature · 4 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
domains/program/bootloader.te renamed from tmp/policy/domains/program/bootloader.te +1 -0
@@ -42,6 +42,7 @@ allow bootloader_t { bin_t sbin_t }:lnk_file read; allow bootloader_t { modules_dep_t modules_object_t }:file read; +dontaudit bootloader_t modules_dep_t:file ioctl; allow bootloader_t modules_object_t:dir { read search }; allow bootloader_t modules_conf_t:file read;
domains/program/ftpd.te renamed from tmp/policy/domains/program/ftpd.te +4 -1
@@ -18,7 +18,10 @@ ifdef(`inetd.te', `domain_auto_trans(inetd_t, ftpd_exec_t, ftpd_t)') ifdef(`tcpd.te', `domain_auto_trans(tcpd_t, ftpd_exec_t, ftpd_t)') -ifdef(`crond.te', `system_crond_entry(ftpd_exec_t, ftpd_t)') +ifdef(`crond.te', ` +system_crond_entry(ftpd_exec_t, ftpd_t) +can_exec(ftpd_t, { bin_t sbin_t }) +') # Inherit and use descriptors from inetd. allow ftpd_t inetd_t:fd use;
domains/program/ipsec.te renamed from tmp/policy/domains/program/ipsec.te +1 -0
@@ -207,3 +207,4 @@ allow ipsec_mgmt_t { initrc_devpts_t admin_tty_type }:chr_file { getattr read write ioctl }; allow ipsec_t initrc_devpts_t:chr_file { getattr read write }; +allow ipsec_mgmt_t self:lnk_file read;
domains/program/modutil.te renamed from tmp/policy/domains/program/modutil.te +5 -0
@@ -21,6 +21,7 @@ every_domain(depmod_t) type depmod_exec_t, file_type, exec_type, sysadmfile; domain_auto_trans(initrc_t, depmod_exec_t, depmod_t) +can_exec(depmod_t, depmod_exec_t) type_transition init_t depmod_exec_t:process depmod_t; domain_auto_trans(sysadm_t, depmod_exec_t, depmod_t)
@@ -54,7 +55,10 @@ allow insmod_t var_log_ksyms_t:dir create_dir_perms; ifdef(`crond.te', ` +# for old modutils rw_dir_create_file(system_crond_t, var_log_ksyms_t) +# for new modutils that is 2.5 compatable +can_exec(insmod_t, bin_t) ') #################################
@@ -67,6 +71,7 @@ every_domain(insmod_t) type insmod_exec_t, file_type, exec_type, sysadmfile; domain_auto_trans({ initrc_t kernel_t }, insmod_exec_t, insmod_t) +can_exec(insmod_t, insmod_exec_t) type_transition init_t insmod_exec_t:process insmod_t; allow insmod_t init_t:fd use; domain_auto_trans(sysadm_t, insmod_exec_t, insmod_t)
file_contexts/program/modutil.fc renamed from tmp/policy/file_contexts/program/modutil.fc +4 -4
@@ -2,9 +2,9 @@ /etc/modules.conf(.old)? system_u:object_r:modules_conf_t /lib/modules(/.*)? system_u:object_r:modules_object_t /lib/modules/[^/]*/modules\..* system_u:object_r:modules_dep_t -/sbin/depmod system_u:object_r:depmod_exec_t -#/sbin/modprobe system_u:object_r:insmod_exec_t -/sbin/insmod system_u:object_r:insmod_exec_t +/sbin/depmod.* system_u:object_r:depmod_exec_t +/sbin/modprobe.* system_u:object_r:insmod_exec_t +/sbin/insmod.* system_u:object_r:insmod_exec_t /sbin/insmod.static system_u:object_r:insmod_exec_t -#/sbin/rmmod system_u:object_r:insmod_exec_t +/sbin/rmmod.* system_u:object_r:insmod_exec_t /sbin/update-modules system_u:object_r:update_modules_exec_t
Quoted 12 lines · Russell Coker
diff -ruN
/tmp/policy/domains/program/hwclock.te./domains/program/hwclock.te
---/tmp/policy/domains/program/hwclock.te2002-12-03 15:56:40.000000000
+0
100
+++ ./domains/program/hwclock.te 2002-08-21 20:22:44.000000000 +0200(quoted diff) +2
-0@@ -45,3 +45,5 @@ allow hwclock_t ptyfile:chr_file rw_file_perms; ifdef(`gnome-pty-helper.te', `allow hwclock_t sysadm_gph_t:fd use;') +# hwclock needs to search file_t directories when run from rc.sysinit on RH8 +allow hwclock_t file_t:dir search;
Quoted 2 lines
For the above change that's recently committed, shouldn't it have ifdef(`rpm.te', around it?
I'm just curious why you think this is necessary? If anything I would have thought something more along the lines of ifdef(`hwclock.te',...) would be appropriate. Neither are really specific to RH systems, and the permission itself isn't that critical.
Thanks,
chris.
--
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 · Chris Vance
Quoted 9 lines · Russell Coker
diff -ruN
/tmp/policy/domains/program/hwclock.te./domains/program/hwclock.te ---/tmp/policy/domains/program/hwclock.te2002-12-03 15:56:40.000000000 +0100
+++ ./domains/program/hwclock.te 2002-08-21 20:22:44.000000000
+0200 @@ -45,3 +45,5 @@
allowhwclock_tptyfile:chr_filerw_file_perms; ifdef(gnome-pty-helper.te',allowhwclock_tsysadm_gph_t:fd use;')
Quoted 8 lines
Quoted 5 lines
+# hwclock needs to search
file_tdirectories when run from rc.sysinit on RH8 +allowhwclock_tfile_t:dir search;For the above change that's recently committed, shouldn't it have ifdef(`rpm.te', around it?
I'm just curious why you think this is necessary? If anything I would have thought something more along the lines of ifdef(`hwclock.te',...)
Having ifdef(`hwclock.te' makes no sense inside the hwclock.te file.
Quoted 2 lines
would be appropriate. Neither are really specific to RH systems, and the permission itself isn't that critical.
If something is specific to a particular distribution then it should be surrounded by an appropriate ifdef. Otherwise the policy for all distributions bloats causing wasted disk space everywhere. If you want to put SE Linux on devices such as iPaq's then you don't want to be doing such things.
Actually there's probably quite a few things that are Debian specific in the main policy because I'm writing lots of policy and no-one is checking whether it's the same way in other distributions. We should probably work on these things.
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 7 lines · Russell Coker
If something is specific to a particular distribution then it should be surrounded by an appropriate ifdef. Otherwise the policy for all distributions bloats causing wasted disk space everywhere. If you want to put SE Linux on devices such as iPaq's then you don't want to be doing such things.
No, the policies should be separate, in my opinion. Creating strong,
static couplings between pieces of the policy that have no logical connection is bad. It's a variant of using data as meta-data, which has caused more problems than (put your favorite bad thing here).
Quoted 5 lines
Actually there's probably quite a few things that are Debian specific in the main policy because I'm writing lots of policy and no-one is checking whether it's the same way in other distributions. We should probably work on these things.
Yes, by keeping them out of the supported, RedHat policy that is part of
the distribution. Otherwise, we need a reliable means of detecting what system we are on in order to build the policy. Checking the existence of a policy piece you think is only on one type of system isn't the solution.
Signature · 8 lines
Wayne Salamon [email protected] -- 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 11 lines · Wayne Salamon
Quoted 5 lines · Russell Coker
If something is specific to a particular distribution then it should be surrounded by an appropriate ifdef. Otherwise the policy for all distributions bloats causing wasted disk space everywhere. If you want to put SE Linux on devices such as iPaq's then you don't want to be doing such things.
No, the policies should be separate, in my opinion. Creating strong,
static couplings between pieces of the policy that have no logical connection is bad. It's a variant of using data as meta-data, which has caused more problems than (put your favorite bad thing here).
Which are the pieces of policy that have no logical connection?
Where exactly is the data-as-metadata issue?
Quoted 9 lines
Quoted 4 lines
Actually there's probably quite a few things that are Debian specific in the main policy because I'm writing lots of policy and no-one is checking whether it's the same way in other distributions. We should probably work on these things.
Yes, by keeping them out of the supported, RedHat policy that is part of
the distribution. Otherwise, we need a reliable means of detecting what system we are on in order to build the policy. Checking the existence of a policy piece you think is only on one type of system isn't the solution.
Sure you could remove dpkg.te from the CVS. But that wouldn't make the distributed policy RH only. There's policy for many daemons in there that I wrote which has not been greatly tested under RH. Someone would have to spend some serious amounts of effort testing and analysing the policy to determine which bits are Debian specific.
What do you think of Brian's work on XML for policy?
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 2 lines · Russell Coker
Which are the pieces of policy that have no logical connection?
The fact that I want to place hwclock in it's own domain has no
relationship to the fact that I have RPM in it's own domain, or an RPM policy for that matter. hwclock, the program, is independent of RPM programs, is it not? Or is there an interaction between the hwclock_t domain and the rpm_t domain that I am missing?
Quoted 1 line
Where exactly is the data-as-metadata issue?
Using the fact that rpm.te exists to say "this is a RedHat system" in
order to conditionally build the policy. I can have RPM on Slackware, for example. Or I might have hwclock on a non-RedHat system. I don't see the reason to conditionally include the hwclock policy piece based on the fact that we've included the RPM policy piece. rpm.te is data for the policy, not an indicator as to the nature of the OS distribution.
Quoted 6 lines
Sure you could remove dpkg.te from the CVS. But that wouldn't make the distributed policy RH only. There's policy for many daemons in there that I wrote which has not been greatly tested under RH. Someone would have to spend some serious amounts of effort testing and analysing the policy to determine which bits are Debian specific.
Yes, there are many things shared between Debian and RedHat, and this is
not an simple problem to solve. We could have the RedHat policy, and the Debian policy in a separate tree that is derived from that, but then we have all kinds of issues with updating both, etc. We could have a single policy, with checks during the build to include only those pieces as necessary, but having those checks WITHIN the policy files is bad, in my opinion. Or we could just "build everything"; it is an example policy, remember, and any serious use of SELinux needs a custom policy anyway.
The issue goes beyond Debian-RedHat. It is possible that portions of the
policy written for RedHat 7.3 do not apply to RedHat 8.0.
I'm porting SELinux and the policy over to a Slackware system for
another project, and need to strip to policy down to exactly what I need. I suspect I'll have to remove some of the if(rpm.te) type rules in order to build what I want.
Quoted 1 line
What do you think of Brian's work on XML for policy?
I haven't looked at it. Does it solve the issues we are dealing with
here, or is it just a representation of policy in an XML form?
Signature · 9 lines
Wayne Salamon [email protected] -- 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 · Wayne Salamon
Quoted 1 line · Russell Coker
Which are the pieces of policy that have no logical connection?
The fact that I want to place hwclock in it's own domain has no
relationship to the fact that I have RPM in it's own domain, or an RPM policy for that matter. hwclock, the program, is independent of RPM programs, is it not? Or is there an interaction between thehwclock_tdomain and therpm_tdomain that I am missing?
There apparently is. Apparently there is functionality needed by the hwclock_t domain on Red Hat but not for other systems. If this is not the case then the following comment is wrong.
# hwclock needs to search file_t directories when run from rc.sysinit on RH8
Quoted 5 lines
Quoted 1 line
Where exactly is the data-as-metadata issue?
Using the fact that rpm.te exists to say "this is a RedHat system" in
order to conditionally build the policy. I can have RPM on Slackware, for example.
If you have the rpm program on Slackware would you use it for full package installation or just use it to build and unpack packages.
Quoted 1 line
Or I might have hwclock on a non-RedHat system.
If you have hwclock on a non-RedHat system then you don't need policy that is specific to Red Hat!
Quoted 4 lines
I don't see the
reason to conditionally include the hwclock policy piece based on the fact that we've included the RPM policy piece. rpm.te is data for the policy, not an indicator as to the nature of the OS distribution.
OK, let's get something else as an indicator of the OS distribution then.
Quoted 2 lines
Or we could just "build everything"; it is an example policy, remember, and any serious use of SELinux needs a custom policy anyway.
Doing that would reduce the potential usage of SE Linux by at least 90%.
Quoted 2 lines
The issue goes beyond Debian-RedHat. It is possible that portions of the
policy written for RedHat 7.3 do not apply to RedHat 8.0.
True. But having special case code for different versions of Red Hat raises upgrade issues.
Quoted 4 lines
I'm porting SELinux and the policy over to a Slackware system for
another project, and need to strip to policy down to exactly what I need. I suspect I'll have to remove some of the if(rpm.te) type rules in order to build what I want.
I don't think that you'll need to do that often (if at all).
Quoted 4 lines
Quoted 1 line
What do you think of Brian's work on XML for policy?
I haven't looked at it. Does it solve the issues we are dealing with
here, or is it just a representation of policy in an XML form?
Not sure. Brian, would you like to comment?
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 6 lines · Russell Coker
There apparently is. Apparently there is functionality needed by the
hwclock_tdomain on Red Hat but not for other systems. If this is not the case then the following comment is wrong.# hwclock needs to search file_t directories when run from rc.sysinit on RH8
Yes, the comment is misleading; sorry. But it doesn't state this is
the ONLY situation the rule applies. The actual rule has nothing to do with rpm_t domain. Easy to fix: remove the comment.
Quoted 4 lines
If you have hwclock on a non-RedHat system then you don't need policy that is specific to Red Hat!
But I need a policy, and it would be easier to reuse the example policy
if I don't have to untangle it from itself.
Quoted 3 lines
I don't think that you'll need to do that often (if at all).
Not too often right now, and I'd like to keep it that way :) But
initrc.te looks like it will need to have the if(rpm.te) because Slackware has /boot as well.
Signature · 8 lines
Wayne Salamon [email protected] -- 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 · Wayne Salamon
Quoted 5 lines · Russell Coker
There apparently is. Apparently there is functionality needed by the
hwclock_tdomain on Red Hat but not for other systems. If this is not the case then the following comment is wrong.# hwclock needs to search file_t directories when run from rc.sysinit on RH8Yes, the comment is misleading; sorry. But it doesn't state this is
the ONLY situation the rule applies. The actual rule has nothing to do withrpm_tdomain. Easy to fix: remove the comment.
Or change it to ifdef(`redhat.te' ...
Quoted 5 lines
Quoted 2 lines
If you have hwclock on a non-RedHat system then you don't need policy that is specific to Red Hat!
But I need a policy, and it would be easier to reuse the example policy
if I don't have to untangle it from itself.
It's not that difficult!
Quoted 5 lines
Quoted 1 line
I don't think that you'll need to do that often (if at all).
Not too often right now, and I'd like to keep it that way :) But
initrc.te looks like it will need to have the if(rpm.te) because Slackware has /boot as well.
Every distribution has /boot. I hoped that only Red Hat had the foolishness of having init scripts mess with /boot, use Debian as a good example for how a distribution can solve these problems in a sane fashion.
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 6 lines · Russell Coker
Quoted 4 lines
Quoted 1 line
What do you think of Brian's work on XML for policy?
I haven't looked at it. Does it solve the issues we are dealing with
here, or is it just a representation of policy in an XML form?Not sure. Brian, would you like to comment?
My selinux policy isn't just a 1:1 mapping of the current design, it is a completely different approach (as explained in my other E-Mails to this list).
I haven't yet focused on this issue, but I imagine that there are a number of ways this could be solved.
(disclaimer: I am not actually sure what the policy line in question does, or why it is red-hat specific).
For instance, the simplest approach (and most like the current approach) would be to have an attribute, eg. os="redhatx.y" and that rule only takes place for that OS.
Another way might be a indirect approach, more like that used by autoconf. eg. os="redhatx.y" has[1] "rpm,rw_boot,broken_hwclock".
Which would mean that rules could be specified only to build if the OS is one that had, say RPM defined.
This could be done with the existing M4 stuff in fact, eg:
define(os_redhat',
define(`has_rpm')
define(`rw_boot')
define(`broken_hwclock')
')
define(os_debian',
define(`has_deb')
')
then in rpm.te:
ifdef(rw_boot',
give read/write access to /boot/*
')
and some automatic configure script would automatically define os_redhat or os_debian.
Users could then override or replace these values as required.
Other OS with similar features of existing OS could easierly be catered for.
Obviously I haven't put much though into this (the above doesn't handle different OS versions for instance; even then you could have different package versions), but hopefully it should give you the general idea.
Maybe something similar could be done for packages too, so package_postfix_x.y would get called if lilo x.y was installed? So current versions could define postfix_has_bug_xxx and postfix_has_bug_yyy which require workarounds in policy, but as soon as you upgrade to a fixed version these workarounds will go away? Similarly you could do this for optional stuff, eg. postfix_has_smtpd_filter_configured.
Just some rough ideas. These still need some work (obviously you don't want to create thousands of package_postfix_* macros for every version of postfix that exists, ideally package ranges would need to be supported somehow; OR some sort of autoconf test maybe to test if these "features" are required, if this is possible).
Comments?
Notes:
[1] I can't think of a better word then "has" right now. --
Brian May <[email protected]>
--
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.