]> git.ipfire.org Git - people/stevee/selinux-policy.git/blob - policy/modules/services/mta.te
trunk: Move user roles into individual modules.
[people/stevee/selinux-policy.git] / policy / modules / services / mta.te
1
2 policy_module(mta,1.9.1)
3
4 ########################################
5 #
6 # Declarations
7 #
8
9 attribute mta_user_agent;
10 attribute mailserver_delivery;
11 attribute mailserver_domain;
12 attribute mailserver_sender;
13
14 attribute user_mail_domain;
15
16 type etc_aliases_t;
17 files_type(etc_aliases_t)
18
19 type etc_mail_t;
20 files_config_file(etc_mail_t)
21
22 type mqueue_spool_t;
23 files_type(mqueue_spool_t)
24
25 type mail_spool_t;
26 files_type(mail_spool_t)
27
28 type sendmail_exec_t;
29 application_executable_file(sendmail_exec_t)
30
31 mta_base_mail_template(system)
32 role system_r types system_mail_t;
33
34 ########################################
35 #
36 # System mail local policy
37 #
38
39 # newalias required this, not sure if it is needed in 'if' file
40 allow system_mail_t self:capability { dac_override };
41
42 read_files_pattern(system_mail_t,etc_mail_t,etc_mail_t)
43
44 kernel_read_system_state(system_mail_t)
45 kernel_read_network_state(system_mail_t)
46
47 dev_read_rand(system_mail_t)
48 dev_read_urand(system_mail_t)
49
50 init_use_script_ptys(system_mail_t)
51
52 sysadm_use_terms(system_mail_t)
53 sysadm_dontaudit_search_home_dirs(system_mail_t)
54
55 optional_policy(`
56 apache_read_squirrelmail_data(system_mail_t)
57 apache_append_squirrelmail_data(system_mail_t)
58
59 # apache should set close-on-exec
60 apache_dontaudit_append_log(system_mail_t)
61 apache_dontaudit_rw_stream_sockets(system_mail_t)
62 apache_dontaudit_rw_tcp_sockets(system_mail_t)
63 apache_dontaudit_rw_sys_script_stream_sockets(system_mail_t)
64 ')
65
66 optional_policy(`
67 arpwatch_manage_tmp_files(system_mail_t)
68
69 ifdef(`hide_broken_symptoms', `
70 arpwatch_dontaudit_rw_packet_sockets(system_mail_t)
71 ')
72 ')
73
74 optional_policy(`
75 cron_read_system_job_tmp_files(system_mail_t)
76 cron_dontaudit_write_pipes(system_mail_t)
77 ')
78
79 optional_policy(`
80 cvs_read_data(system_mail_t)
81 ')
82
83 optional_policy(`
84 logrotate_read_tmp_files(system_mail_t)
85 ')
86
87 optional_policy(`
88 logwatch_read_tmp_files(system_mail_t)
89 ')
90
91 optional_policy(`
92 nagios_read_tmp_files(system_mail_t)
93 ')
94
95 optional_policy(`
96 manage_dirs_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
97 manage_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
98 manage_lnk_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
99 manage_fifo_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
100 manage_sock_files_pattern(system_mail_t,etc_aliases_t,etc_aliases_t)
101 files_etc_filetrans(system_mail_t,etc_aliases_t,{ file lnk_file sock_file fifo_file })
102
103 domain_use_interactive_fds(system_mail_t)
104
105 # postfix needs this for newaliases
106 files_getattr_tmp_dirs(system_mail_t)
107
108 postfix_exec_master(system_mail_t)
109 postfix_read_config(system_mail_t)
110 postfix_search_spool(system_mail_t)
111
112 ifdef(`distro_redhat',`
113 # compatability for old default main.cf
114 postfix_config_filetrans(system_mail_t,etc_aliases_t,{ dir file lnk_file sock_file fifo_file })
115 ')
116
117 optional_policy(`
118 cron_rw_tcp_sockets(system_mail_t)
119 ')
120 ')
121
122 optional_policy(`
123 qmail_domtrans_inject(system_mail_t)
124 ')
125
126 optional_policy(`
127 sxid_read_log(system_mail_t)
128 ')
129
130 optional_policy(`
131 userdom_dontaudit_use_unpriv_users_ptys(system_mail_t)
132
133 optional_policy(`
134 cron_dontaudit_append_system_job_tmp_files(system_mail_t)
135 ')
136 ')
137
138 optional_policy(`
139 smartmon_read_tmp_files(system_mail_t)
140 ')
141
142 # should break this up among sections:
143
144 optional_policy(`
145 # why is mail delivered to a directory of type arpwatch_data_t?
146 arpwatch_search_data(mailserver_delivery)
147 arpwatch_manage_tmp_files(mta_user_agent)
148
149 ifdef(`hide_broken_symptoms', `
150 arpwatch_dontaudit_rw_packet_sockets(mta_user_agent)
151 ')
152
153 optional_policy(`
154 cron_read_system_job_tmp_files(mta_user_agent)
155 ')
156 ')