Skip to contentSkip to conversation

djb-related policy diff

PATCH Petre Rodan 2 participants 2 messages Jan 14, 2006 – Jan 16, 2006 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

attached you'll find

* policies for daemontools, ucspi-tcp, djbdns, publicfile
* modified apache.te, ftp.te, mysql.te, rsync.te, spamassassin.te, ssh.te, stunnel.te, init.te, selinuxutil.te to add daemontools support.

cheers,
peter

Signature · 4 lines
petre rodan
<[email protected]>
Developer,
Hardened Gentoo Linux 
policy/modules/services/apache.te +4 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/apache.te policy/policy/modules/services/apache.te
@@ -395,6 +395,10 @@
 	userdom_dontaudit_use_sysadm_terms(httpd_t)
 ')
 
+optional_policy(`daemontools',`
+	daemontools_service_domain(httpd_t, httpd_exec_t)
+')
+
 optional_policy(`kerberos',`
 	kerberos_use(httpd_t)
 ')
policy/modules/services/djbdns.fc +9 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/djbdns.fc policy/policy/modules/services/djbdns.fc
@@ -0,0 +1,9 @@
+
+/usr/bin/axfrdns		--	gen_context(system_u:object_r:djbdns_axfrdns_exec_t,s0)
+/usr/bin/dnscache	--	gen_context(system_u:object_r:djbdns_dnscache_exec_t,s0)
+/usr/bin/tinydns		--	gen_context(system_u:object_r:djbdns_tinydns_exec_t,s0)
+
+/var/axfrdns/root(/.*)?		gen_context(system_u:object_r:djbdns_axfrdns_conf_t,s0)
+/var/dnscache/root(/.*)?		gen_context(system_u:object_r:djbdns_dnscache_conf_t,s0)
+/var/tinydns/root(/.*)?		gen_context(system_u:object_r:djbdns_tinydns_conf_t,s0)
+
policy/modules/services/djbdns.if +53 -0

53 lines not on this page · raw message

policy/modules/services/djbdns.te +45 -0

45 lines not on this page · raw message

policy/modules/services/ftp.te +4 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/ftp.te policy/policy/modules/services/ftp.te
@@ -193,6 +193,10 @@
 	')
 ')
 
+optional_policy(`daemontools',`
+	daemontools_service_domain(ftpd_t, ftpd_exec_t)
+')
+
 optional_policy(`inetd',`
 	#reh: typeattributes not allowed in conditionals yet.
 	#tunable_policy(`! ftpd_is_daemon',`
policy/modules/services/mysql.te +1 -6
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/mysql.te policy/policy/modules/services/mysql.te
@@ -141,11 +141,6 @@
 	udev_read_db(mysqld_t)
 ')
 
-ifdef(`TODO',`
 optional_policy(`daemontools',`
-	domain_auto_trans( svc_run_t, mysqld_exec_t, mysqld_t)
-	mysqld_signal(svc_start_t)
-
-	svc_ipc_domain(mysqld_t)
+	daemontools_service_domain(mysqld_t, mysqld_exec_t)
 ')
-') dnl end TODO
policy/modules/services/publicfile.fc +7 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/publicfile.fc policy/policy/modules/services/publicfile.fc
@@ -0,0 +1,7 @@
+
+/usr/bin/ftpd		--	gen_context(system_u:object_r:publicfile_exec_t,s0)
+/usr/bin/httpd		--	gen_context(system_u:object_r:publicfile_exec_t,s0)
+
+# this is the place where online content located
+# set this to suit your needs
+#/var/www(/.*)?			gen_context(system_u:object_r:publicfile_content_t,s0)
policy/modules/services/publicfile.if +1 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/publicfile.if policy/policy/modules/services/publicfile.if
@@ -0,0 +1 @@
+## <summary>publicfile supplies files to the public through HTTP and FTP</summary>
policy/modules/services/publicfile.te +39 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/publicfile.te policy/policy/modules/services/publicfile.te
@@ -0,0 +1,39 @@
+
+policy_module(publicfile,1.0.0)
+
+########################################
+#
+# Declarations
+#
+
+type publicfile_t;
+type publicfile_exec_t;
+init_system_domain(publicfile_t,publicfile_exec_t)
+role system_r types publicfile_t;
+
+type publicfile_content_t;
+files_type(publicfile_content_t)
+
+########################################
+#
+# Local policy
+#
+
+allow publicfile_t self:capability { dac_override setgid setuid sys_chroot };
+allow publicfile_t publicfile_content_t:dir r_dir_perms;
+allow publicfile_t publicfile_content_t:file r_file_perms;
+
+files_search_var(publicfile_t)
+
+libs_use_ld_so(publicfile_t)
+libs_use_shared_libs(publicfile_t)
+
+optional_policy(`ucspitcp',`
+	ucspitcp_service_domain(publicfile_t, publicfile_exec_t)
+')
+
+optional_policy(`daemontools',`
+	daemontools_ipc_domain(publicfile_t)
+')
+
+#allow publicfile_t initrc_t:tcp_socket { read write };
policy/modules/services/rsync.te +4 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/rsync.te policy/policy/modules/services/rsync.te
@@ -87,6 +87,10 @@
 	miscfiles_manage_public_files(rsync_t)
 ')
 
+optional_policy(`daemontools',`
+	daemontools_service_domain(rsync_t, rsync_exec_t)
+')
+
 optional_policy(`kerberos',`
 	kerberos_use(rsync_t)
 ')
policy/modules/services/spamassassin.te +4 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/spamassassin.te policy/policy/modules/services/spamassassin.te
@@ -136,6 +136,10 @@
 	cron_system_entry(spamd_t,spamd_exec_t)
 ')
 
+optional_policy(`daemontools',`
+	daemontools_service_domain(spamd_t,spamd_exec_t)
+')
+
 optional_policy(`nis',`
 	nis_use_ypbind(spamd_t)
 ')
policy/modules/services/ssh.te +5 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/ssh.te policy/policy/modules/services/ssh.te
@@ -113,6 +113,10 @@
 		userdom_signal_unpriv_users(sshd_t)
 	')
 
+	optional_policy(`daemontools',`
+		daemontools_service_domain(sshd_t, sshd_exec_t)
+	')
+
 	optional_policy(`rpm',`
 		rpm_use_script_fd(sshd_t)
 	')
@@ -139,6 +143,7 @@
 		allow sshd_t userpty_type:chr_file { relabelto read write getattr ioctl setattr };
 	')
 	') dnl endif TODO
+
 ')
 
 #################################
policy/modules/services/stunnel.te +4 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/stunnel.te policy/policy/modules/services/stunnel.te
@@ -103,6 +103,10 @@
         	files_dontaudit_read_root_file(stunnel_t)
 	')
 
+	optional_policy(`daemontools',`
+		daemontools_service_domain(stunnel_t, stunnel_exec_t)
+	')
+
 	optional_policy(`mount',`
         	mount_send_nfs_client_request(stunnel_t)
 	')
policy/modules/services/ucspitcp.fc +3 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/ucspitcp.fc policy/policy/modules/services/ucspitcp.fc
@@ -0,0 +1,3 @@
+
+/usr/bin/rblsmtpd	--	gen_context(system_u:object_r:rblsmtpd_exec_t,s0)
+/usr/bin/tcpserver	--	gen_context(system_u:object_r:ucspitcp_exec_t,s0)
policy/modules/services/ucspitcp.if +36 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/services/ucspitcp.if policy/policy/modules/services/ucspitcp.if
@@ -0,0 +1,36 @@
+## <summary>ucspitcp policy</summary>
+## <desc>
+##      <p>
+##              Policy for DJB's ucspi-tcpd
+##      </p>
+## </desc>
+
+########################################
+## <summary>
+##      Define a specified domain as a ucspitcp service.
+## </summary>
+## <param name="domain">
+##      Domain allowed access.
+## </param>
+## <param name="entrypoint">
+##      The type associated with the process program.
+## </param>
+#
+interface(`ucspitcp_service_domain', `
+	gen_require(`
+		type ucspitcp_t;
+		role system_r;
+	')
+
+	domain_type($1)
+	domain_entry_file($1,$2)
+
+	role system_r types $1;
+
+	domain_auto_trans(ucspitcp_t, $2, $1)
+
+	allow $1 ucspitcp_t:fd use;
+	allow $1 ucspitcp_t:process sigchld;
+	allow $1 ucspitcp_t:tcp_socket rw_stream_socket_perms;
+')
+
policy/modules/services/ucspitcp.te +90 -0

90 lines not on this page · raw message

policy/modules/system/daemontools.fc +49 -0

49 lines not on this page · raw message

policy/modules/system/daemontools.if +147 -0

147 lines not on this page · raw message

policy/modules/system/daemontools.te +122 -0

122 lines not on this page · raw message

policy/modules/system/init.fc +3 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/system/init.fc policy/policy/modules/system/init.fc
@@ -28,6 +28,8 @@
 /sbin/rc		--	gen_context(system_u:object_r:initrc_exec_t,s0)
 /sbin/runscript		--      gen_context(system_u:object_r:initrc_exec_t,s0)
 /sbin/runscript\.sh	--	gen_context(system_u:object_r:initrc_exec_t,s0)
+/sbin/runsvcscript\.sh	--	gen_context(system_u:object_r:initrc_exec_t,s0)
+/sbin/svcinit		--	gen_context(system_u:object_r:initrc_exec_t,s0)
 ')
 
 #
@@ -41,6 +43,7 @@
 #
 ifdef(`distro_gentoo', `
 /var/lib/init\.d(/.*)?		gen_context(system_u:object_r:initrc_state_t,s0)
+/var/run/svscan\.pid	--	gen_context(system_u:object_r:initrc_var_run_t,s0)
 ')
 
 /var/run/utmp		--	gen_context(system_u:object_r:initrc_var_run_t,s0)
policy/modules/system/init.te +8 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/system/init.te policy/policy/modules/system/init.te
@@ -182,6 +182,10 @@
 	auth_rw_login_records(init_t)
 ')
 
+optional_policy(`daemontools',`
+	daemontools_start_domtrans(init_t)
+')
+
 optional_policy(`nscd',`
 	nscd_use_socket(init_t)
 ')
@@ -512,6 +516,10 @@
 	cups_read_log(initrc_t)
 ')
 
+optional_policy(`daemontools',`
+	daemontools_create_svc(initrc_t)
+')
+
 optional_policy(`dbus',`
 	dbus_connect_system_bus(initrc_t)
 	dbus_send_system_bus_msg(initrc_t)
policy/modules/system/logging.fc +6 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/system/logging.fc policy/policy/modules/system/logging.fc
@@ -19,6 +19,9 @@
 /var/lib/stunnel/dev/log -s	gen_context(system_u:object_r:devlog_t,s0)
 ')
 
+/var/axfrdns/log/main(/.*)?		gen_context(system_u:object_r:var_log_t,s0)
+/var/dnscache/log/main(/.*)?	gen_context(system_u:object_r:var_log_t,s0)
+
 /var/log			-d	gen_context(system_u:object_r:var_log_t,s0-s15:c0.c255)
 /var/log/.*			gen_context(system_u:object_r:var_log_t,s0)
 /var/log/audit.log	--	gen_context(system_u:object_r:auditd_log_t,s15:c0.c255)
@@ -29,3 +32,6 @@
 /var/run/log		-s	gen_context(system_u:object_r:devlog_t,s0)
 /var/run/metalog\.pid	--	gen_context(system_u:object_r:syslogd_var_run_t,s0)
 /var/run/syslogd\.pid	--	gen_context(system_u:object_r:syslogd_var_run_t,s0)
+
+/var/tinydns/log/main(/.*)?		gen_context(system_u:object_r:var_log_t,s0)
+
policy/modules/system/selinuxutil.te +0 -0
diff -ur --new-file --exclude=CVS --exclude='corenetwork.*' policy.orig/policy/modules/system/selinuxutil.te policy/policy/modules/system/selinuxutil.te
@@ -451,13 +451,15 @@
 	logging_send_syslog_msg(run_init_t)
 ') dnl end ifdef targeted policy
 

ifdef(TODO',
ifdef(distro_gentoo',
# Gentoo integrated run_init+open_init_pty-runscript:
domain_entry_file(run_init_t,initrc_exec_t) domain_auto_trans(sysadm_t,initrc_exec_t,run_init_t)
')
') dnl end TODO
+
+optional_policy(daemontools',
+ daemontools_start_domtrans(run_init_t)
+')

########################################
#

#1 lore raw
Quoted 2 lines · Petre Rodan

* policies for daemontools, ucspi-tcp, djbdns, publicfile
* modified apache.te, ftp.te, mysql.te, rsync.te, spamassassin.te, ssh.te, stunnel.te, init.te, selinuxutil.te to add daemontools support.

I renamed a few interfaces in daemontools, and reordered a few lines. Otherwise, looks good. 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.