summaryrefslogtreecommitdiff
path: root/policy/modules/admin/netutils.te
blob: 6b4794fdd382a2e05ee9a2f7f778fdba010bbfa5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213

policy_module(netutils, 1.8.0)

########################################
#
# Declarations
#

## <desc>
## <p>
## Control users use of ping and traceroute
## </p>
## </desc>
gen_tunable(user_ping, false)

type netutils_t;
type netutils_exec_t;
init_system_domain(netutils_t, netutils_exec_t)
role system_r types netutils_t;

type netutils_tmp_t;
files_tmp_file(netutils_tmp_t)

type ping_t;
type ping_exec_t;
init_system_domain(ping_t, ping_exec_t)
role system_r types ping_t;

type traceroute_t;
type traceroute_exec_t;
init_system_domain(traceroute_t, traceroute_exec_t)
role system_r types traceroute_t;

########################################
#
# Netutils local policy
#

# Perform network administration operations and have raw access to the network.
allow netutils_t self:capability { net_admin net_raw setuid setgid };
dontaudit netutils_t self:capability sys_tty_config;
allow netutils_t self:process { sigkill sigstop signull signal };
allow netutils_t self:netlink_route_socket { bind create getattr nlmsg_read nlmsg_write read write };
allow netutils_t self:packet_socket create_socket_perms;
allow netutils_t self:udp_socket create_socket_perms;
allow netutils_t self:tcp_socket create_stream_socket_perms;

manage_dirs_pattern(netutils_t, netutils_tmp_t, netutils_tmp_t)
manage_files_pattern(netutils_t, netutils_tmp_t, netutils_tmp_t)
files_tmp_filetrans(netutils_t, netutils_tmp_t, { file dir })

kernel_search_proc(netutils_t)
kernel_read_sysctl(netutils_t)

corenet_all_recvfrom_unlabeled(netutils_t)
corenet_all_recvfrom_netlabel(netutils_t)
corenet_tcp_sendrecv_all_if(netutils_t)
corenet_raw_sendrecv_all_if(netutils_t)
corenet_udp_sendrecv_all_if(netutils_t)
corenet_tcp_sendrecv_all_nodes(netutils_t)
corenet_raw_sendrecv_all_nodes(netutils_t)
corenet_udp_sendrecv_all_nodes(netutils_t)
corenet_tcp_sendrecv_all_ports(netutils_t)
corenet_udp_sendrecv_all_ports(netutils_t)
corenet_tcp_connect_all_ports(netutils_t)
corenet_sendrecv_all_client_packets(netutils_t)
corenet_udp_bind_generic_node(netutils_t)

dev_read_sysfs(netutils_t)

fs_getattr_xattr_fs(netutils_t)

domain_use_interactive_fds(netutils_t)

files_read_etc_files(netutils_t)
# for nscd
files_dontaudit_search_var(netutils_t)

init_use_fds(netutils_t)
init_use_script_ptys(netutils_t)

auth_use_nsswitch(netutils_t)

logging_send_syslog_msg(netutils_t)

miscfiles_read_localization(netutils_t)

userdom_use_user_terminals(netutils_t)
userdom_use_all_users_fds(netutils_t)

optional_policy(`
	nis_use_ypbind(netutils_t)
')

optional_policy(`
	vmware_append_log(netutils_t)
')

optional_policy(`
	xen_append_log(netutils_t)
')

########################################
#
# Ping local policy
#

allow ping_t self:capability { setuid net_raw };
dontaudit ping_t self:capability sys_tty_config;
allow ping_t self:tcp_socket create_socket_perms;
allow ping_t self:rawip_socket { create ioctl read write bind getopt setopt };
allow ping_t self:packet_socket { create ioctl read write bind getopt setopt };
allow ping_t self:netlink_route_socket create_netlink_socket_perms;

corenet_all_recvfrom_unlabeled(ping_t)
corenet_all_recvfrom_netlabel(ping_t)
corenet_tcp_sendrecv_all_if(ping_t)
corenet_raw_sendrecv_all_if(ping_t)
corenet_raw_sendrecv_all_nodes(ping_t)
corenet_raw_bind_all_nodes(ping_t)
corenet_tcp_sendrecv_all_nodes(ping_t)
corenet_tcp_sendrecv_all_ports(ping_t)

fs_dontaudit_getattr_xattr_fs(ping_t)

domain_use_interactive_fds(ping_t)

files_read_etc_files(ping_t)
files_dontaudit_search_var(ping_t)

auth_use_nsswitch(ping_t)

logging_send_syslog_msg(ping_t)

miscfiles_read_localization(ping_t)

userdom_use_user_terminals(ping_t)

ifdef(`hide_broken_symptoms',`
	init_dontaudit_use_fds(ping_t)
')

tunable_policy(`user_ping',`
	term_use_all_user_ttys(ping_t)
	term_use_all_user_ptys(ping_t)
')

optional_policy(`
	pcmcia_use_cardmgr_fds(ping_t)
')

optional_policy(`
	hotplug_use_fds(ping_t)
')

########################################
#
# Traceroute local policy
#

allow traceroute_t self:capability { net_admin net_raw setuid setgid };
allow traceroute_t self:rawip_socket create_socket_perms;
allow traceroute_t self:packet_socket create_socket_perms;
allow traceroute_t self:udp_socket create_socket_perms;

kernel_read_system_state(traceroute_t)
kernel_read_network_state(traceroute_t)

corenet_all_recvfrom_unlabeled(traceroute_t)
corenet_all_recvfrom_netlabel(traceroute_t)
corenet_tcp_sendrecv_all_if(traceroute_t)
corenet_udp_sendrecv_all_if(traceroute_t)
corenet_raw_sendrecv_all_if(traceroute_t)
corenet_tcp_sendrecv_all_nodes(traceroute_t)
corenet_udp_sendrecv_all_nodes(traceroute_t)
corenet_raw_sendrecv_all_nodes(traceroute_t)
corenet_tcp_sendrecv_all_ports(traceroute_t)
corenet_udp_sendrecv_all_ports(traceroute_t)
corenet_udp_bind_all_nodes(traceroute_t)
corenet_tcp_bind_all_nodes(traceroute_t)
# traceroute needs this but not tracepath
corenet_raw_bind_all_nodes(traceroute_t)
corenet_udp_bind_traceroute_port(traceroute_t)
corenet_tcp_connect_all_ports(traceroute_t)
corenet_sendrecv_all_client_packets(traceroute_t)
corenet_sendrecv_traceroute_server_packets(traceroute_t)

fs_dontaudit_getattr_xattr_fs(traceroute_t)

domain_use_interactive_fds(traceroute_t)

files_read_etc_files(traceroute_t)
files_dontaudit_search_var(traceroute_t)

init_use_fds(traceroute_t)

auth_use_nsswitch(traceroute_t)

logging_send_syslog_msg(traceroute_t)

miscfiles_read_localization(traceroute_t)

userdom_use_user_terminals(traceroute_t)

#rules needed for nmap
dev_read_rand(traceroute_t)
dev_read_urand(traceroute_t)
files_read_usr_files(traceroute_t)

tunable_policy(`user_ping',`
	term_use_all_user_ttys(traceroute_t)
	term_use_all_user_ptys(traceroute_t)
')