Skip to contentSkip to conversation

uw-imapd policy

PATCH Ed Street 1 participant 1 message May 21, 2004 SELinux security module

lore
Share & tools
lore

Ed Street

author
#0 lore raw

Hello,

This is the uw-imapd policy files that I created under debian SID. The only snag I ran into was some mislabeled files in net_contexts. Namely when labeling ports 143 tcp, 220 tcp, and 993 tcp. Some of these are currently labeled as pop_* shouldn’t’ these be labeled as imapd_* ?

Ed

---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.687 / Virus Database: 448 - Release Date: 5/16/2004

domains/program/uwimapd.te +62 -0
diff -urN current-orig/domains/program/uwimapd.te current/domains/program/uwimapd.te
@@ -0,0 +1,62 @@
+#DESC uw-imapd-ssl server
+#
+# Author:  Ed Street <[email protected]>
+# X-Debian-Packages: uw-imapd (was uw-imapd-ssl)
+#
+
+#we are using ports
+type imapd_port_t, port_type;
+
+daemon_domain(imapd, `, auth_chkpwd')
+tmp_domain(imapd)
+
+can_network(imapd_t)
+can_ypbind(imapd_t)
+
+#declare our own services
+allow imapd_t self:capability { dac_override net_bind_service setgid setuid sys_resource };
+allow imapd_t imapd_port_t:tcp_socket name_bind;
+
+#allow inetd to bind to us
+allow inetd_t imapd_port_t:tcp_socket { name_bind };
+
+#declare this a socket from inetd
+allow imapd_t self:unix_dgram_socket { sendto create_socket_perms };
+allow imapd_t self:unix_stream_socket create_socket_perms;
+domain_auto_trans(inetd_t, imapd_exec_t, imapd_t)
+ifdef(`tcpd.te', `domain_auto_trans(tcpd_t, imapd_exec_t, imapd_t)')
+
+#friendly stuff we dont want to see :)
+dontaudit imapd_t etc_t:file { getattr };
+dontaudit imapd_t net_conf_t:file { getattr };
+dontaudit system_chkpwd_t system_chkpwd_t:file { getattr };
+dontaudit imapd_t mail_spool_t:dir { getattr };
+dontaudit imapd_t bin_t:dir { search };
+
+#read /etc/ for hostname nsswitch.conf
+allow imapd_t etc_t:file { read };
+
+#socket i/o stuff
+allow imapd_t inetd_t:tcp_socket { read write ioctl getattr };
+
+#read resolv.conf
+allow imapd_t net_conf_t:file { read };
+
+#urandom, for ssl
+allow system_chkpwd_t urandom_device_t:chr_file { read };
+allow imapd_t random_device_t:chr_file { read };
+allow imapd_t urandom_device_t:chr_file { read getattr };
+
+#verify password
+allow system_chkpwd_t inetd_t:fd { use };
+allow system_chkpwd_t inetd_t:tcp_socket { read write };
+
+allow imapd_t imapd_t:fifo_file { write read };
+
+#mail directory
+create_dir_file(imapd_t mail_spool_t)
+
+#home directory
+allow imapd_t home_root_t:dir { search };
+create_dir_file(imapd_t, user_home_type)
+allow imapd_t imapd_t:file { read getattr };
file_contexts/program/uwimapd.fc +2 -0
diff -urN current-orig/file_contexts/program/uwimapd.fc current/file_contexts/program/uwimapd.fc
@@ -0,0 +1,2 @@
+# uw-imapd and uw-imapd-ssl
+/usr/sbin/imapd		-- system_u:object_r:imapd_exec_t
net_contexts +6 -0
diff -urN current-orig/net_contexts current/net_contexts
@@ -37,6 +37,12 @@
 portcon udp 892 system_u:object_r:inetd_port_t
 portcon tcp 901 system_u:object_r:biff_port_t
 ')
+ifdef(`uwimapd.te', `
+portcon tcp 993 system_u:object_r:imapd_port_t
+portcon tcp 143 system_u:object_r:imapd_port_t
+portcon tcp 220 system_u:object_r:imapd_port_t
+')
+
 ifdef(`courier.te', `define(`use_pop')')
 ifdef(`perdition.te', `define(`use_pop')')
 ifdef(`cyrus.te', `define(`use_pop')')