Skip to contentSkip to conversation

Current diff from debian svn

PATCH Erich Schubert 2 participants 2 messages Mar 8, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hello Christopher,
Attached is the current diff from debian refpolicy SVN to yours, updated to match the 20060307-2 cvs dump.

Contents:
- add default ports for tor
- small tweak to apache policy to allow symlinks in /var/www
- small tweak to logrotate to support logcheck
- amavis policy
- clamd policy
- dpkg/apt-get policy
- some tweaks for rpm/userdomain/usermanage for dpkg/apt (the rpm one needs to be reviewed seriously)

The diff was obtained by running
svn diff svn://svn.debian.org/selinux/refpolicy/branches/upstream \
svn://svn.debian.org/selinux/refpolicy/branches/debian
and then sorting the results a little bit.

best regards,
Erich Schubert

Signature · 4 lines
   erich@(vitavonni.de|debian.org)    --    GPG Key ID: 4B3A135C    (o_
    The infinite! No other question has ever moved so profoundly    //\
                the spirit of man. --- David Hilbert                V_/_
      "Wissen ist Macht" - wenn man das richtige daraus macht.

#### Tor default ports

modules/kernel/corenetwork.te.in +1 -0
Index: policy/modules/kernel/corenetwork.te.in
===================================================================
@@ -121,6 +121,7 @@
 network_port(syslogd, udp,514,s0)
 network_port(telnetd, tcp,23,s0)
 network_port(tftp, udp,69,s0)
+network_port(tor, tcp,9001,s0, tcp,9030,s0, tcp,9050,s0)
 network_port(transproxy, tcp,8081,s0)
 type utcpserver_port_t, port_type; dnl network_port(utcpserver) # no defined portcon
 network_port(uucpd, tcp,540,s0)

#### Since I've added tor ports to corenetwork, this is sufficient

modules/services/tor.te +2 -4
Index: policy/modules/services/tor.te
===================================================================
@@ -1,6 +1,5 @@
+policy_module(tor,1.0.1)
 
-policy_module(tor,1.0.0)
-
 ########################################
 #
 # Declarations
@@ -71,8 +70,7 @@
 corenet_tcp_connect_all_ports(tor_t)
 # ... especially including port 80 and other privileged ports
 corenet_tcp_connect_all_reserved_ports(tor_t)
-# TOR may bind to a non-privileged port
-corenet_tcp_bind_all_ports(tor_t)
+corenet_tcp_bind_tor_port(tor_t)
 corenet_tcp_bind_all_nodes(tor_t)
 
 # tor uses crypto and needs random

### Logcheck is a tool for grepping "unusual" lines out of the syslogs.
### it uses a state dir (keeping track where it was in the log file), which it apparently scans.

modules/admin/logrotate.te +2 -0
Index: policy/modules/admin/logrotate.te
===================================================================
@@ -122,6 +122,8 @@
 
 cron_system_entry(logrotate_t, logrotate_exec_t)
 cron_search_spool(logrotate_t)
+# for logcheck:
+allow crond_t logrotate_var_lib_t:dir search;
 
 mta_send_mail(logrotate_t)
 

### Debian has a symlink /var/www/phpmyadmin to the actual phpmyadmin location ### so users can remove it from their /var/www path easily

modules/services/apache.if +1 -0
Index: policy/modules/services/apache.if
===================================================================
@@ -800,6 +800,7 @@
 
 	allow $1 httpd_sys_content_t:dir r_dir_perms;
 	allow $1 httpd_sys_content_t:file { getattr read };
+	allow $1 httpd_sys_content_t:lnk_file { getattr read };
 ')
 
 ########################################

## this is because debian uses symlinks there, e.g. phpmyadmin package.

modules/services/apache.te +1 -0
Index: policy/modules/services/apache.te
===================================================================
@@ -187,6 +187,7 @@
 
 allow httpd_t httpd_sys_content_t:dir r_dir_perms;
 allow httpd_t httpd_sys_content_t:file r_file_perms;
+allow httpd_t httpd_sys_content_t:lnk_file r_file_perms;
 
 allow httpd_t httpd_tmp_t:dir create_dir_perms;
 allow httpd_t httpd_tmp_t:file create_file_perms;
modules/services/amavis.te +173 -0

173 lines not on this page · raw message

modules/services/amavis.fc +14 -0
Index: policy/modules/services/amavis.fc
===================================================================
@@ -0,0 +1,14 @@
+# amavis executable will have:
+# label: system_u:object_r:amavis_exec_t
+# MLS sensitivity: s0
+# MCS categories: <none>
+
+/usr/sbin/amavisd.*		--	gen_context(system_u:object_r:amavis_exec_t,s0)
+/etc/amavisd(/.*)?		--	gen_context(system_u:object_r:amavis_etc_t,s0)
+/var/run/amavis(/.*)?			gen_context(system_u:object_r:amavis_var_run_t,s0)
+/var/lib/amavis(/.*)?			gen_context(system_u:object_r:amavis_var_lib_t,s0)
+# less common:
+/etc/amavis\.conf		--	gen_context(system_u:object_r:amavis_etc_t,s0)
+/var/log/amavisd\.log		--	gen_context(system_u:object_r:amavis_var_log_t,s0)
+/var/amavis(/.*)?			gen_context(system_u:object_r:amavis_var_lib_t,s0)
+/var/virusmails(/.*)?			gen_context(system_u:object_r:amavis_quarantine_t,s0)
modules/services/amavis.if +24 -0
Index: policy/modules/services/amavis.if
===================================================================
@@ -0,0 +1,24 @@
+## <summary>policy for amavis</summary>
+
+########################################
+## <summary>
+##	Execute a domain transition to run amavis.
+## </summary>
+## <param name="domain">
+##  <summary>
+##	Domain allowed to transition.
+##  </summary>
+## </param>
+#
+interface(`amavis_domtrans',`
+	gen_require(`
+		type amavis_t, amavis_exec_t;
+	')
+
+	domain_auto_trans($1,amavis_exec_t,amavis_t)
+
+	allow $1 amavis_t:fd use;
+	allow amavis_t $1:fd use;
+	allow amavis_t:$1:fifo_file rw_file_perms;
+	allow amavis_t $1:process sigchld;
+')
modules/services/clamd.te +198 -0

198 lines not on this page · raw message

modules/services/clamd.fc +16 -0
Index: policy/modules/services/clamd.fc
===================================================================
@@ -0,0 +1,16 @@
+# clamd executable will have:
+# label: system_u:object_r:clamd_exec_t
+# MLS sensitivity: s0
+# MCS categories: <none>
+
+/usr/bin/clamscan		--	gen_context(system_u:object_r:clamscan_exec_t,s0)
+/usr/bin/clamdscan		--	gen_context(system_u:object_r:clamscan_exec_t,s0)
+/usr/sbin/clamd			--	gen_context(system_u:object_r:clamd_exec_t,s0)
+/usr/bin/freshclam		--	gen_context(system_u:object_r:freshclam_exec_t,s0)
+/etc/clamav(/.*)?			gen_context(system_u:object_r:clamd_etc_t,s0)
+/var/run/clamav(/.*)?			gen_context(system_u:object_r:clamd_var_run_t,s0)
+/var/run/clamav/clamd.ctl	-s	gen_context(system_u:object_r:clamd_sock_t,s0)
+/var/lib/clamav(/.*)?			gen_context(system_u:object_r:clamd_var_lib_t,s0)
+/var/log/clamav			-d	gen_context(system_u:object_r:clamd_var_log_t,s0)
+/var/log/clamav/clamav.*	--	gen_context(system_u:object_r:clamd_var_log_t,s0)
+/var/log/clamav/freshclam.*	--	gen_context(system_u:object_r:freshclam_var_log_t,s0)
modules/services/clamd.if +48 -0

48 lines not on this page · raw message

modules/admin/apt.if +174 -0

174 lines not on this page · raw message

modules/admin/apt.fc +16 -0
Index: policy/modules/admin/apt.fc
===================================================================
@@ -0,0 +1,16 @@
+/usr/bin/apt-get		--	gen_context(system_u:object_r:apt_exec_t,s0)
+# apt-shell is redhat specific
+/usr/bin/apt-shell		--	gen_context(system_u:object_r:apt_exec_t,s0)
+# other package managers
+/usr/bin/aptitude		--	gen_context(system_u:object_r:apt_exec_t,s0)
+/usr/sbin/synaptic		--	gen_context(system_u:object_r:apt_exec_t,s0)
+# these don't need special privileges
+/usr/bin/apt-cache		--	gen_context(system_u:object_r:bin_t,s0)
+/usr/bin/apt-config		--	gen_context(system_u:object_r:bin_t,s0)
+
+/usr/lib(64)?/apt/methods.+	--	gen_context(system_u:object_r:bin_t,s0)
+# package list repository
+/var/lib/apt(/.*)?			gen_context(system_u:object_r:apt_var_lib_t,s0)
+/var/lib/aptitude(/.*)?		gen_context(system_u:object_r:apt_var_lib_t,s0)
+# package cache repository
+/var/cache/apt(/.*)?			gen_context(system_u:object_r:apt_var_cache_t,s0)
modules/admin/dpkg.te +362 -0

362 lines not on this page · raw message

modules/admin/dpkg.if +241 -0

241 lines not on this page · raw message

modules/admin/apt.te +139 -0

139 lines not on this page · raw message

modules/admin/dpkg.fc +15 -0
Index: policy/modules/admin/dpkg.fc
===================================================================
@@ -0,0 +1,15 @@
+# Debian package manager
+/usr/bin/dpkg			--	gen_context(system_u:object_r:dpkg_exec_t,s0)
+/usr/bin/debsums		--	gen_context(system_u:object_r:dpkg_exec_t,s0)
+/usr/sbin/dpkg-reconfigure	--	gen_context(system_u:object_r:dpkg_exec_t,s0)
+/usr/sbin/dpkg-preconfigure	--	gen_context(system_u:object_r:dpkg_exec_t,s0)
+# not sure if dselect should be in apt instead?
+/usr/bin/dselect		--	gen_context(system_u:object_r:dpkg_exec_t,s0)
+
+/usr/lib(64)?/dpkg/.+		--	gen_context(system_u:object_r:bin_t,s0)
+/usr/bin/update-menus		--	gen_context(system_u:object_r:bin_t,s0)
+/usr/share/debconf/.+		--	gen_context(system_u:object_r:bin_t,s0)
+
+/var/lib/dpkg(/.*)?			gen_context(system_u:object_r:dpkg_var_lib_t,s0)
+# lockfile is treated specially, since used by apt, too
+/var/lib/dpkg/(meth)?lock	--	gen_context(system_u:object_r:dpkg_lock_t,s0)
modules/admin/rpm.fc +0 -3
Index: policy/modules/admin/rpm.fc
===================================================================
@@ -2,9 +2,6 @@
 /bin/rpm 			--	gen_context(system_u:object_r:rpm_exec_t,s0)
 /usr/bin/smart 			--	gen_context(system_u:object_r:rpm_exec_t,s0)
 
-/usr/bin/apt-get 		--	gen_context(system_u:object_r:rpm_exec_t,s0)
-/usr/bin/apt-shell   	 	-- 	gen_context(system_u:object_r:rpm_exec_t,s0)
-/usr/bin/synaptic		--    	gen_context(system_u:object_r:rpm_exec_t,s0)
 /usr/bin/yum 			--	gen_context(system_u:object_r:rpm_exec_t,s0)
 
 /usr/lib(64)?/rpm/rpmd		-- 	gen_context(system_u:object_r:bin_t,s0)
modules/admin/usermanage.te +10 -0
Index: policy/modules/admin/usermanage.te
===================================================================
@@ -261,6 +261,11 @@
 	rpm_rw_pipes(groupadd_t)
 ')
 
+optional_policy(`dpkg',`
+	dpkg_use_fd(groupadd_t)
+	dpkg_rw_pipes(groupadd_t)
+')
+
 ########################################
 #
 # Passwd local policy
@@ -523,3 +528,8 @@
 	rpm_use_fds(useradd_t)
 	rpm_rw_pipes(useradd_t)
 ')
+
+optional_policy(`dpkg',`
+	dpkg_use_fd(useradd_t)
+	dpkg_rw_pipes(useradd_t)
+')
modules/system/userdomain.te +8 -0
Index: policy/modules/system/userdomain.te
===================================================================
@@ -347,6 +347,14 @@
 		rpm_run(sysadm_t,sysadm_r,admin_terminal)
 	')
 
+	optional_policy(`apt',`
+		apt_run(sysadm_t,sysadm_r,admin_terminal)
+	')
+
+	optional_policy(`dpkg',`
+		dpkg_run(sysadm_t,sysadm_r,admin_terminal)
+	')
+
 	optional_policy(`samba',`
 		samba_run_net(sysadm_t,sysadm_r,admin_terminal)
 		samba_run_winbind_helper(sysadm_t,sysadm_r,admin_terminal)
#1 lore raw
Quoted 4 lines · Erich Schubert

Attached is the current diff from debian refpolicy SVN to yours, updated to match the 20060307-2 cvs dump.

- small tweak to logrotate to support logcheck

Dropped this since it uses cron_t in the logrotate module. Cron needs to use a logrotate interface.

Quoted 2 lines

- amavis policy
- clamd policy

These were already added.

Quoted 1 line

- dpkg/apt-get policy

Some reordering done.

Quoted 2 lines

- some tweaks for rpm/userdomain/usermanage for dpkg/apt (the rpm one needs to be reviewed seriously)

I dropped the rpm_manage_db(apt_t) until its clear that its needed

The remainder should be merged.

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.