Skip to contentSkip to conversation

seref: trivial patch:

PATCH Serge E. Hallyn 2 participants 5 messages Feb 9, 2006 – Feb 10, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

Fix compilation failure for cron with apache=off.

Now maybe cron as a policy module doesn't make sense anyway... but I'd say the below was wrong regardless.

thanks,
-serge

policy/modules/services/cron.te +1 -1
Index: refpolicy/policy/modules/services/cron.te
===================================================================
@@ -208,7 +208,7 @@ ifdef(`TODO',`
 # crond tries to search /root.  Not sure why.
 allow crond_t sysadm_home_dir_t:dir r_dir_perms;
 
-ifdef(`apache.te',`
+optional_policy(`apache',`
 allow system_crond_t httpd_modules_t:lnk_file read;
 # Needed for certwatch
 can_exec(system_crond_t, httpd_modules_t)

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

policy/modules/services/cron.te ifdef(`TODO',` · line 214

Quoted 13 lines · Serge E. Hallyn

Fix compilation failure for cron with apache=off.

policy/modules/services/cron.te +1 -1
@@ -208,7 +208,7 @@ ifdef(`TODO',`
 # crond tries to search /root.  Not sure why.
 allow crond_t sysadm_home_dir_t:dir r_dir_perms;
 
-ifdef(`apache.te',`
+optional_policy(`apache',`
 allow system_crond_t httpd_modules_t:lnk_file read;
 # Needed for certwatch
 can_exec(system_crond_t, httpd_modules_t)

While this change is correct, I'm surprised that it caused a compile failure in the first place, as its in a ifdef(`TODO' block which should make this whole section drop out. Did you define TODO to make the rules get included?

Merged. I changed the rules to use the appropriate interface and moved them to the appropriate places.

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
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 9 lines · Christopher J. PeBenito
Quoted 8 lines · Serge E. Hallyn

Fix compilation failure for cron with apache=off.

policy/modules/services/cron.te +0 -0
@@ -208,7 +208,7 @@ ifdef(`TODO',`
 # crond tries to search /root.  Not sure why.
 allow crond_t sysadm_home_dir_t:dir r_dir_perms;
 
Quoted 10 lines

policy/modules/services/cron.te ifdef(`TODO',` · line 214

Quoted 5 lines
policy/modules/services/cron.te +1 -1
-ifdef(`apache.te',`
+optional_policy(`apache',`
 allow system_crond_t httpd_modules_t:lnk_file read;
 # Needed for certwatch
 can_exec(system_crond_t, httpd_modules_t)

While this change is correct, I'm surprised that it caused a compile failure in the first place, as its in a ifdef(`TODO' block which should make this whole section drop out. Did you define TODO to make the rules get included?

No, but then after I sent this out, it started failing to compile again... I clearly have some issues with stuff mysteriously staying around after make clean. Not bc it started to fail, but bc it ever succeeded.

A question that's not clear in my mind - if a module, like certwatch.te, uses the apache_exec_modules() interface, should that call automatically be defined away to nothing if apache is not defined, or does that call still need to be inside of a 'optional_policy(`apache'' block? The former sounds like preferred behavior to keep policies clean, but that' not what is happening right now, judging by the otput under tmp/.

For the moment I'm going back to defining all the modules I want as being part of the base policy - after all I want them always on. It's my own policy that I want to compile as modules.

Quoted 2 lines

Merged. I changed the rules to use the appropriate interface and moved them to the appropriate places.

Thanks.

On this theme, appended is a list of place which a quick set of greps shows may have the same problem:

find policy/modules -name "*.fc" -exec "grep" "-Hn" 'ifdef([a-z]*\.te' "{}" \; policy/modules/services/mta.fc:21:#ifdef(postfix.te', ',

find policy/modules -name "*.if" -exec "grep" "-Hn" 'ifdef(`[a-z]*\.te' "{}" \;
policy/modules/admin/su.if:235: ifdef(xauth.te',
policy/modules/admin/su.if:242: ifdef(cyrus.te',
policy/modules/admin/su.if:245: ifdef(ssh.te',
policy/modules/admin/sudo.if:140: ifdef(mta.te',
policy/modules/admin/sudo.if:145: ifdef(pam.te',
policy/modules/apps/gpg.if:208: ifdef(xdm.te',
policy/modules/apps/gpg.if:322: ifdef(xdm.te',
policy/modules/apps/java.if:170: ifdef(gnome.te',
policy/modules/services/cron.if:162: ifdef(mta.te',
policy/modules/services/dbus.if:168: ifdef(xdm.te',
policy/modules/services/mta.if:138: ifdef(qmail.te',
policy/modules/services/mta.if:232: ifdef(postfix.te',
policy/modules/services/ssh.if:348: ifdef(xdm.te',
policy/modules/services/xserver.if:160: ifdef(rpm.te',
policy/modules/services/xserver.if:276: ifdef(xdm.te',
policy/modules/system/userdomain.if:478: ifdef(xdm.te',
policy/modules/system/userdomain.if:492: ifdef(gnome.te',
policy/modules/system/userdomain.if:681: ifdef(xdm.te',
policy/modules/system/userdomain.if:690: ifdef(ftpd.te',
policy/modules/system/userdomain.if:696: ifdef(useradd.te',
policy/modules/system/userdomain.if:725: ifdef(syslogd.te',
policy/modules/system/userdomain.if:928: ifdef(xserver.te',
policy/modules/system/userdomain.if:935: ifdef(xdm.te',
policy/modules/system/userdomain.if:944: ifdef(ftpd.te', can_tcp_connect(ftpd_t, $1_t)')
policy/modules/system/userdomain.if:947: ifdef(rshd.te', can_tcp_connect(rshd_t, $1_t)')

find policy/modules -name "*.te" -exec "grep" "-Hn" 'ifdef([a-z]*\.te' "{}" \; policy/modules/admin/firstboot.te:132:ifdef(printconf.te', policy/modules/admin/firstboot.te:136:ifdef(userhelper.te', policy/modules/admin/firstboot.te:141:ifdef(xserver.te', policy/modules/admin/logrotate.te:202:ifdef(backup.te', policy/modules/services/bluetooth.te:213:ifdef(xserver.te', `
policy/modules/services/bluetooth.te:219: ifdef(xdm.te',
policy/modules/services/cron.te:432: ifdef(mta.te',
policy/modules/services/portmap.te:136:ifdef(rpcd.te',can_udp_send(portmap_t, rpcd_t)') policy/modules/services/portmap.te:140:ifdef(lpd.te',can_udp_send(portmap_t, lpd_t)') policy/modules/services/remotelogin.te:176:ifdef(alsa.te', policy/modules/services/samba.te:527:ifdef(cups.te', policy/modules/services/squid.te:181:ifdef(apache.te', policy/modules/services/squid.te:185:ifdef(winbind.te',
policy/modules/services/ssh.te:165: ifdef(xauth.te',
policy/modules/services/xserver.te:454:ifdef(rhgb.te', policy/modules/system/authlogin.te:247:ifdef(xdm.te',
policy/modules/system/init.te:699: ifdef(xserver.te',
policy/modules/system/selinuxutil.te:392:ifdef(dpkg.te',
policy/modules/system/sysnetwork.te:181: ifdef(unconfined.te',

thanks,
-serge

--
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
Quoted 6 lines · Serge E. Hallyn

A question that's not clear in my mind - if a module, like certwatch.te, uses the apache_exec_modules() interface, should that call automatically be defined away to nothing if apache is not defined, or does that call still need to be inside of a 'optional_policy(`apache'' block? The former sounds like preferred behavior to keep policies clean, but that' not what is happening right now, judging by the otput under tmp/.

No, we want those rules in an optional_policy(). Its implementation is an ifdef for monolithic policy/base module, and an optional{} block for loadable modules. Optional{} blocks are compiled in and are resolved at link time; then you don't have to recompile the module to change the optional policy blocks.

Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
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 8 lines · Christopher J. PeBenito
Quoted 6 lines · Serge E. Hallyn

A question that's not clear in my mind - if a module, like certwatch.te, uses the apache_exec_modules() interface, should that call automatically be defined away to nothing if apache is not defined, or does that call still need to be inside of a 'optional_policy(`apache'' block? The former sounds like preferred behavior to keep policies clean, but that' not what is happening right now, judging by the otput under tmp/.

Quoted 5 lines

No, we want those rules in an optional_policy(). Its implementation is an ifdef for monolithic policy/base module, and an optional{} block for loadable modules. Optional{} blocks are compiled in and are resolved at link time; then you don't have to recompile the module to change the optional policy blocks.

Ok - then the following patch will be needed :)

thanks,
-serge

policy/modules/admin/certwatch.te +3 -1
Index: refpolicy/policy/modules/admin/certwatch.te
===================================================================
@@ -27,7 +27,9 @@ logging_send_syslog_msg(certwatch_t)
 miscfiles_read_certs(certwatch_t)
 miscfiles_read_localization(certwatch_t)
 
-apache_exec_modules(certwatch_t)
+optional_policy(`apache',`
+	apache_exec_modules(certwatch_t)
+')
 
 optional_policy(`cron',`
 	cron_system_entry(certwatch_t,certwatch_exec_t)

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