Skip to contentSkip to conversation

patch for latest release

PATCH Russell Coker 2 participants 2 messages Oct 23, 2002 – Oct 28, 2002 SELinux security module

lore
Share & tools
lore
#0 lore raw

I've attached my latest patch against the recent release.

The ipsec change is merely cosmetic, it removed duplicate entries and combines some entries, but a policy file that ugly needs some cosmetic changes. ;)

The samba changes are apparently related to newer versions of samba and only are needed in some situations. The older versions of samba (which I understood) didn't need such things, and the new version didn't show a need for it when I first installed SE on a sometimes-samba machine.

I've allowed squid to setuid/setgid because the default setup of squid on Debian wants to change it's uid/gid to proxy/proxy and forcing everyone to change their config.

I changed the file_contexts entries for /var/spool/mail to be in mta.fc instead of sendmail.fc because it applies to all mail servers.

I changed crontab_macros.te to not audit writes to the home directory (when vim wants to create it's config file).

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/dpkg.te renamed from tmp/t/policy/domains/program/dpkg.te +5 -0
diff -ru /tmp/t/policy/domains/program/dpkg.te policy/domains/program/dpkg.te
@@ -60,6 +60,11 @@
 ifdef(`named.te', `
 file_type_auto_trans(dpkg_t, named_zone_t, rndc_conf_t)
 ')
+# because the syslogd package is broken and does not use the start scripts
+ifdef(`syslogd.te', `
+domain_auto_trans(dpkg_t, klogd_exec_t, klogd_t)
+domain_auto_trans(dpkg_t, syslogd_exec_t, syslogd_t)
+')
 
 # for apt
 type apt_t, domain, admin, privmail;
domains/program/fingerd.te renamed from tmp/t/policy/domains/program/fingerd.te +2 -0
diff -ru /tmp/t/policy/domains/program/fingerd.te policy/domains/program/fingerd.te
@@ -35,6 +35,8 @@
 allow fingerd_t inetd_t:tcp_socket { read write getattr ioctl };
 
 allow fingerd_t self:capability { setgid setuid };
+# for gzip from logrotate
+dontaudit fingerd_t self:capability fsetid;
 
 # cfingerd runs shell scripts
 allow fingerd_t { bin_t sbin_t }:dir search;
domains/program/gatekeeper.te renamed from tmp/t/policy/domains/program/gatekeeper.te +3 -0
diff -ru /tmp/t/policy/domains/program/gatekeeper.te policy/domains/program/gatekeeper.te
@@ -17,6 +17,9 @@
 can_network(gatekeeper_t)
 allow gatekeeper_t self:unix_stream_socket create_socket_perms;
 
+# for stupid symlinks
+tmp_domain(gatekeeper)
+
 # pthreads wants to know the kernel version
 allow gatekeeper_t sysctl_kernel_t:dir r_dir_perms;
 allow gatekeeper_t sysctl_kernel_t:file r_file_perms;
domains/program/ipsec.te renamed from tmp/t/policy/domains/program/ipsec.te +8 -24
diff -ru /tmp/t/policy/domains/program/ipsec.te policy/domains/program/ipsec.te
@@ -114,20 +114,11 @@
 dontaudit ipsec_mgmt_t domain:key_socket { read write };
 dontaudit ipsec_mgmt_t domain:udp_socket { read write };
 
-#
-# bits and pieces from other files to make this as self-contained as possible
-#
-
 # from rbac
-role system_r types {
-	ipsec_t
-	ipsec_mgmt_t
-};
+role system_r types { ipsec_t ipsec_mgmt_t };
 
 # from initrc.te
 domain_auto_trans(initrc_t, ipsec_mgmt_exec_t, ipsec_mgmt_t)
-# i don't know if this is really needed anymore...
-# allow initrc_t ipsec_var_run_t:sock_file { read write };
 
 # from init.te
 type_transition init_t ipsec_mgmt_exec_t:process ipsec_mgmt_t;
@@ -136,8 +127,7 @@
 ########## The following rules were added by [email protected] ##########
 
 # allow pluto and startup scripts to access /dev/urandom
-allow ipsec_t random_device_t:chr_file r_file_perms;
-allow ipsec_mgmt_t random_device_t:chr_file r_file_perms;
+allow { ipsec_t ipsec_mgmt_t } random_device_t:chr_file r_file_perms;
 
 # allow pluto to access /proc/net/ipsec_eroute;
 general_proc_read_access(ipsec_t)
@@ -145,26 +135,21 @@
 
 # allow pluto to search the root directory (not sure why, but mostly harmless)
 # Are these all really necessary?
-allow ipsec_t root_t:dir r_dir_perms;
-allow ipsec_t etc_t:dir { search };
 allow ipsec_t var_t:dir { search };
 allow ipsec_t bin_t:dir { search };
-allow ipsec_t device_t:dir { search };
-allow ipsec_mgmt_t etc_t:dir { search };
+allow ipsec_t device_t:dir { getattr search };
+allow ipsec_mgmt_t device_t:dir { getattr search read };
+dontaudit ipsec_mgmt_t tty_device_t:chr_file getattr;
+dontaudit ipsec_mgmt_t devpts_t:dir getattr;
 allow ipsec_mgmt_t etc_t:lnk_file read;
 allow ipsec_mgmt_t var_t:dir { search };
 allow ipsec_mgmt_t sbin_t:dir { search };
 allow ipsec_mgmt_t bin_t:dir { search };
-allow ipsec_mgmt_t device_t:dir { search };
 allow ipsec_mgmt_t ipsec_var_run_t:file { getattr read };
 
 # Startup scripts
 # use libraries
-uses_shlib(ipsec_mgmt_t)
-uses_shlib(ipsec_t)
-allow ipsec_mgmt_t lib_t:dir r_dir_perms;
-# access /usr/share/locale 
-allow ipsec_mgmt_t usr_t:file r_file_perms;
+uses_shlib({ ipsec_t ipsec_mgmt_t })
 # Read and write /dev/tty
 allow ipsec_mgmt_t devtty_t:chr_file rw_file_perms;
 # fork
@@ -174,8 +159,7 @@
 # read /etc/mtab Why?
 allow ipsec_mgmt_t etc_runtime_t:file { read getattr };
 # read link for /bin/sh 
-allow ipsec_mgmt_t bin_t:lnk_file read;
-allow ipsec_t bin_t:lnk_file read;
+allow { ipsec_t ipsec_mgmt_t } bin_t:lnk_file read;
 
 #
 allow ipsec_mgmt_t self:process { sigchld signal };
domains/program/logrotate.te renamed from tmp/t/policy/domains/program/logrotate.te +3 -0
diff -ru /tmp/t/policy/domains/program/logrotate.te policy/domains/program/logrotate.te
@@ -21,6 +21,9 @@
 # it should not require this
 allow logrotate_t sysadm_home_dir_t:dir { read getattr search };
 
+# create lock files
+rw_dir_create_file(logrotate_t, var_lock_t)
+
 # Create temporary files.
 tmp_domain(logrotate)
 
domains/program/samba.te renamed from tmp/t/policy/domains/program/samba.te +8 -1
diff -ru /tmp/t/policy/domains/program/samba.te policy/domains/program/samba.te
@@ -16,6 +16,13 @@
 type samba_share_t, file_type, sysadmfile;
 type samba_secrets_t, file_type, sysadmfile;
 
+# for /var/run/samba/messages.tdb
+allow smbd_t var_run_nmbd_t:file rw_file_perms;
+
+ifdef(`crond.te', `
+allow system_crond_t samba_etc_t:file { read getattr };
+')
+
 #################################
 #
 # Rules for the smbd_t domain.
@@ -37,7 +44,7 @@
 
 # Permissions for Samba files in /etc/samba
 # either allow read access to the directory or allow the auto_trans rule to
-# allow creation of the secrets.tdb file
+# allow creation of the secrets.tdb file and the MACHINE.SID file
 #allow smbd_t samba_etc_t:dir { search getattr };
 file_type_auto_trans(smbd_t, samba_etc_t, samba_secrets_t, file)
 
domains/program/squid.te renamed from tmp/t/policy/domains/program/squid.te +1 -0
diff -ru /tmp/t/policy/domains/program/squid.te policy/domains/program/squid.te
@@ -25,6 +25,7 @@
 # type for /var/cache/squid
 type squid_cache_t, file_type, sysadmfile;
 
+allow squid_t squid_t:capability { setgid setuid };
 allow squid_t { etc_t etc_runtime_t }:file r_file_perms;
 allow squid_t etc_t:lnk_file read;
 allow squid_t self:unix_stream_socket create_socket_perms;
file_contexts/program/mta.fc renamed from tmp/t/policy/file_contexts/program/mta.fc +2 -0
diff -ru /tmp/t/policy/file_contexts/program/mta.fc policy/file_contexts/program/mta.fc
@@ -2,3 +2,5 @@
 /usr/sbin/sendmail(.sendmail)?	system_u:object_r:sendmail_exec_t
 /etc/aliases			system_u:object_r:etc_aliases_t
 /etc/aliases.db			system_u:object_r:etc_aliases_t
+/var/spool/mail(/.*)?		system_u:object_r:mail_spool_t
+/var/mail(/.*)?			system_u:object_r:mail_spool_t
file_contexts/program/samba.fc renamed from tmp/t/policy/file_contexts/program/samba.fc +2 -0
diff -ru /tmp/t/policy/file_contexts/program/samba.fc policy/file_contexts/program/samba.fc
@@ -4,4 +4,6 @@
 /etc/samba(/.*)?		system_u:object_r:samba_etc_t
 /var/log/samba(/.*)?		system_u:object_r:samba_log_t
 /var/cache/samba(/.*)?		system_u:object_r:samba_var_t
+/var/lib/samba(/.*)?		system_u:object_r:samba_var_t
 /etc/samba/secrets.tdb		system_u:object_r:samba_secrets_t
+/etc/samba/MACHINE.SID		system_u:object_r:samba_secrets_t
file_contexts/program/sendmail.fc renamed from tmp/t/policy/file_contexts/program/sendmail.fc +0 -2
diff -ru /tmp/t/policy/file_contexts/program/sendmail.fc policy/file_contexts/program/sendmail.fc
@@ -1,6 +1,4 @@
 # sendmail
 /etc/mail(/.*)?			system_u:object_r:etc_mail_t
-/var/spool/mail(/.*)?		system_u:object_r:mail_spool_t
 /var/spool/mqueue(/.*)?		system_u:object_r:mqueue_spool_t
 /var/log/sendmail.st		system_u:object_r:sendmail_var_log_t
-/var/mail(/.*)?			system_u:object_r:mail_spool_t
macros/program/crontab_macros.te renamed from tmp/t/policy/macros/program/crontab_macros.te +1 -0
diff -ru /tmp/t/policy/macros/program/crontab_macros.te policy/macros/program/crontab_macros.te
@@ -65,6 +65,7 @@
 # Read user crontabs 
 allow $1_crontab_t { $1_home_t $1_home_dir_t }:dir r_dir_perms;  
 allow $1_crontab_t $1_home_t:file r_file_perms;  
+dontaudit $1_crontab_t $1_home_dir_t:dir write;
 
 # Access the cron log file.
 allow $1_crontab_t cron_log_t:file r_file_perms;
#1 lore raw
Quoted 1 line · Russell Coker

I've attached my latest patch against the recent release.

Thanks, merged.

--
Stephen D. Smalley, NAI Labs
[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.