]>
Commit | Line | Data |
---|---|---|
0404a390 | 1 | |
0a14f3ae | 2 | policy_module(ssh,1.10.0) |
0404a390 CP |
3 | |
4 | ######################################## | |
5 | # | |
6 | # Declarations | |
7 | # | |
8 | ||
56e1b3d2 CP |
9 | ## <desc> |
10 | ## <p> | |
11 | ## allow host key based authentication | |
12 | ## </p> | |
13 | ## </desc> | |
14 | gen_tunable(allow_ssh_keysign,false) | |
15 | ||
16 | ## <desc> | |
17 | ## <p> | |
18 | ## Allow ssh logins as sysadm_r:sysadm_t | |
19 | ## </p> | |
20 | ## </desc> | |
21 | gen_tunable(ssh_sysadm_login,false) | |
22 | ||
45239964 | 23 | attribute ssh_server; |
0404a390 | 24 | |
6b19be33 CP |
25 | # Type for the ssh-agent executable. |
26 | type ssh_agent_exec_t; | |
27 | files_type(ssh_agent_exec_t) | |
28 | ||
0404a390 CP |
29 | # ssh client executable. |
30 | type ssh_exec_t; | |
d46cfe45 | 31 | application_executable_file(ssh_exec_t) |
0404a390 | 32 | |
75beb950 | 33 | type ssh_keygen_t; |
0404a390 | 34 | type ssh_keygen_exec_t; |
75beb950 CP |
35 | init_system_domain(ssh_keygen_t,ssh_keygen_exec_t) |
36 | role system_r types ssh_keygen_t; | |
0404a390 | 37 | |
a0824843 | 38 | type ssh_keysign_exec_t; |
d46cfe45 | 39 | application_executable_file(ssh_keysign_exec_t) |
a0824843 | 40 | |
e070dd2d | 41 | type sshd_exec_t; |
fb63d0b5 | 42 | corecmd_executable_file(sshd_exec_t) |
c3812748 | 43 | |
6b19be33 CP |
44 | ssh_server_template(sshd) |
45 | init_daemon_domain(sshd_t,sshd_exec_t) | |
46 | ||
47 | ssh_server_template(sshd_extern) | |
48 | ||
375c2415 CP |
49 | type sshd_key_t; |
50 | files_type(sshd_key_t) | |
9ccd96df | 51 | |
6b19be33 CP |
52 | type sshd_tmp_t; |
53 | files_tmp_file(sshd_tmp_t) | |
54 | files_poly_parent(sshd_tmp_t) | |
e070dd2d | 55 | |
6b19be33 CP |
56 | ifdef(`enable_mcs',` |
57 | init_ranged_daemon_domain(sshd_t,sshd_exec_t,s0 - mcs_systemhigh) | |
375c2415 | 58 | ') |
0404a390 CP |
59 | |
60 | ################################# | |
61 | # | |
62 | # sshd local policy | |
63 | # | |
64 | # sshd_t is the domain for the sshd program. | |
65 | # | |
66 | ||
6b19be33 CP |
67 | # so a tunnel can point to another ssh tunnel |
68 | allow sshd_t self:netlink_route_socket r_netlink_socket_perms; | |
69 | allow sshd_t self:key { search link write }; | |
bbdbdb9e | 70 | |
6b19be33 CP |
71 | manage_dirs_pattern(sshd_t,sshd_tmp_t,sshd_tmp_t) |
72 | manage_files_pattern(sshd_t,sshd_tmp_t,sshd_tmp_t) | |
73 | manage_sock_files_pattern(sshd_t,sshd_tmp_t,sshd_tmp_t) | |
74 | files_tmp_filetrans(sshd_t, sshd_tmp_t, { dir file sock_file }) | |
44d5d93f | 75 | |
6b19be33 CP |
76 | kernel_search_key(sshd_t) |
77 | kernel_link_key(sshd_t) | |
78 | ||
79 | # for X forwarding | |
80 | corenet_tcp_bind_xserver_port(sshd_t) | |
81 | corenet_sendrecv_xserver_server_packets(sshd_t) | |
82 | ||
6b19be33 CP |
83 | tunable_policy(`ssh_sysadm_login',` |
84 | # Relabel and access ptys created by sshd | |
85 | # ioctl is necessary for logout() processing for utmp entry and for w to | |
86 | # display the tty. | |
87 | # some versions of sshd on the new SE Linux require setattr | |
88 | term_use_all_user_ptys(sshd_t) | |
89 | term_setattr_all_user_ptys(sshd_t) | |
90 | term_relabelto_all_user_ptys(sshd_t) | |
91 | ||
92 | userdom_spec_domtrans_all_users(sshd_t) | |
93 | userdom_signal_all_users(sshd_t) | |
94 | ',` | |
95 | userdom_spec_domtrans_unpriv_users(sshd_t) | |
96 | userdom_signal_unpriv_users(sshd_t) | |
97 | ||
98 | userdom_setattr_unpriv_users_ptys(sshd_t) | |
99 | userdom_relabelto_unpriv_users_ptys(sshd_t) | |
100 | userdom_use_unpriv_users_ptys(sshd_t) | |
101 | ') | |
102 | ||
103 | optional_policy(` | |
104 | daemontools_service_domain(sshd_t, sshd_exec_t) | |
105 | ') | |
106 | ||
107 | optional_policy(` | |
108 | inetd_tcp_service_domain(sshd_t, sshd_exec_t) | |
109 | ') | |
110 | ||
111 | optional_policy(` | |
112 | rpm_use_script_fds(sshd_t) | |
113 | ') | |
114 | ||
115 | optional_policy(` | |
116 | rssh_spec_domtrans_all_users(sshd_t) | |
117 | # For reading /home/user/.ssh | |
118 | rssh_read_all_users_ro_content(sshd_t) | |
119 | ') | |
120 | ||
350b6ab7 CP |
121 | optional_policy(` |
122 | unconfined_domain(sshd_t) | |
123 | unconfined_shell_domtrans(sshd_t) | |
124 | ') | |
125 | ||
6b19be33 CP |
126 | ifdef(`TODO',` |
127 | tunable_policy(`ssh_sysadm_login',` | |
128 | # Relabel and access ptys created by sshd | |
129 | # ioctl is necessary for logout() processing for utmp entry and for w to | |
130 | # display the tty. | |
131 | # some versions of sshd on the new SE Linux require setattr | |
132 | allow sshd_t ptyfile:chr_file relabelto; | |
375c2415 | 133 | |
5540e76a | 134 | optional_policy(` |
6b19be33 | 135 | domain_trans(sshd_t, xauth_exec_t, userdomain) |
5540e76a | 136 | ') |
6b19be33 CP |
137 | ',` |
138 | optional_policy(` | |
139 | domain_trans(sshd_t, xauth_exec_t, unpriv_userdomain) | |
0404a390 | 140 | ') |
6b19be33 CP |
141 | # Relabel and access ptys created by sshd |
142 | # ioctl is necessary for logout() processing for utmp entry and for w to | |
143 | # display the tty. | |
144 | # some versions of sshd on the new SE Linux require setattr | |
145 | allow sshd_t userpty_type:chr_file { relabelto read write getattr ioctl setattr }; | |
9ccd96df | 146 | ') |
6b19be33 | 147 | ') dnl endif TODO |
0404a390 CP |
148 | |
149 | ################################# | |
150 | # | |
151 | # sshd_extern local policy | |
152 | # | |
153 | # sshd_extern_t is the domain for ssh from outside our network | |
154 | # | |
0404a390 | 155 | |
350b6ab7 CP |
156 | ifdef(`TODO',` |
157 | domain_trans(initrc_t, sshd_exec_t, sshd_extern_t) | |
56e1b3d2 | 158 | |
350b6ab7 CP |
159 | domain_trans(sshd_extern_t, shell_exec_t, user_mini_domain) |
160 | # Signal the user domains. | |
161 | allow sshd_extern_t user_mini_domain:process signal; | |
0404a390 | 162 | |
350b6ab7 CP |
163 | ifdef(`xauth.te', ` |
164 | domain_trans(sshd_extern_t, xauth_exec_t, user_mini_domain) | |
165 | ') | |
0404a390 | 166 | |
350b6ab7 CP |
167 | # Relabel and access ptys created by sshd |
168 | # ioctl is necessary for logout() processing for utmp entry and for w to | |
169 | # display the tty. | |
170 | # some versions of sshd on the new SE Linux require setattr | |
171 | allow sshd_extern_t user_mini_domain:chr_file { relabelto read write getattr ioctl setattr }; | |
375c2415 | 172 | |
350b6ab7 CP |
173 | # inheriting stream sockets is needed for "ssh host command" as no pty |
174 | # is allocated | |
175 | allow user_mini_domain sshd_extern_t:unix_stream_socket rw_stream_socket_perms; | |
375c2415 | 176 | |
350b6ab7 CP |
177 | optional_policy(` |
178 | domain_trans(inetd_t, sshd_exec_t, sshd_extern_t) | |
179 | ') | |
0404a390 | 180 | |
350b6ab7 CP |
181 | ifdef(`direct_sysadm_daemon', ` |
182 | # Direct execution by sysadm_r. | |
183 | domain_auto_trans(sysadm_t, sshd_exec_t, sshd_t) | |
184 | role_transition sysadm_r sshd_exec_t system_r; | |
375c2415 | 185 | ') |
350b6ab7 | 186 | ') dnl endif TODO |
0404a390 CP |
187 | |
188 | ######################################## | |
189 | # | |
190 | # ssh_keygen local policy | |
191 | # | |
192 | ||
75beb950 CP |
193 | # ssh_keygen_t is the type of the ssh-keygen program when run at install time |
194 | # and by sysadm_t | |
0404a390 | 195 | |
75beb950 CP |
196 | dontaudit ssh_keygen_t self:capability sys_tty_config; |
197 | allow ssh_keygen_t self:process { sigchld sigkill sigstop signull signal }; | |
0404a390 | 198 | |
75beb950 | 199 | allow ssh_keygen_t self:unix_stream_socket create_stream_socket_perms; |
0404a390 | 200 | |
c0868a7a | 201 | allow ssh_keygen_t sshd_key_t:file manage_file_perms; |
75beb950 | 202 | files_etc_filetrans(ssh_keygen_t,sshd_key_t,file) |
0404a390 | 203 | |
75beb950 | 204 | kernel_read_kernel_sysctls(ssh_keygen_t) |
0404a390 | 205 | |
75beb950 | 206 | fs_search_auto_mountpoints(ssh_keygen_t) |
ab940a4c | 207 | |
75beb950 CP |
208 | dev_read_sysfs(ssh_keygen_t) |
209 | dev_read_urand(ssh_keygen_t) | |
0404a390 | 210 | |
75beb950 | 211 | term_dontaudit_use_console(ssh_keygen_t) |
0404a390 | 212 | |
75beb950 | 213 | domain_use_interactive_fds(ssh_keygen_t) |
0404a390 | 214 | |
75beb950 | 215 | files_read_etc_files(ssh_keygen_t) |
0404a390 | 216 | |
75beb950 CP |
217 | init_use_fds(ssh_keygen_t) |
218 | init_use_script_ptys(ssh_keygen_t) | |
0404a390 | 219 | |
75beb950 CP |
220 | libs_use_ld_so(ssh_keygen_t) |
221 | libs_use_shared_libs(ssh_keygen_t) | |
0404a390 | 222 | |
75beb950 | 223 | logging_send_syslog_msg(ssh_keygen_t) |
0404a390 | 224 | |
75beb950 | 225 | userdom_dontaudit_use_unpriv_user_fds(ssh_keygen_t) |
0404a390 | 226 | |
75beb950 CP |
227 | optional_policy(` |
228 | nscd_socket_use(ssh_keygen_t) | |
229 | ') | |
0404a390 | 230 | |
75beb950 CP |
231 | optional_policy(` |
232 | seutil_sigchld_newrole(ssh_keygen_t) | |
233 | ') | |
234 | ||
235 | optional_policy(` | |
236 | udev_read_db(ssh_keygen_t) | |
c0d1566a | 237 | ') |