]> git.ipfire.org Git - people/stevee/selinux-policy.git/blame_incremental - refpolicy/policy/modules/services/ssh.te
clean up unused booleans
[people/stevee/selinux-policy.git] / refpolicy / policy / modules / services / ssh.te
... / ...
CommitLineData
1
2policy_module(ssh,1.0)
3
4########################################
5#
6# Declarations
7#
8
9attribute ssh_server;
10
11# Type for the ssh-agent executable.
12type ssh_agent_exec_t;
13files_type(ssh_agent_exec_t)
14
15# ssh client executable.
16type ssh_exec_t;
17files_type(ssh_exec_t)
18
19type ssh_keygen_t;
20type ssh_keygen_exec_t;
21init_system_domain(ssh_keygen_t,ssh_keygen_exec_t)
22role system_r types ssh_keygen_t;
23
24type ssh_keysign_exec_t;
25files_type(ssh_keysign_exec_t)
26
27# real declaration moved to mls until
28# range_transition works in loadable modules
29gen_require(`
30 type sshd_exec_t;
31')
32files_type(sshd_exec_t)
33
34ssh_server_template(sshd)
35ssh_server_template(sshd_extern)
36
37# cjp: commenting this out until typeattribute works in a conditional
38#optional_policy(`inetd.te',`
39# tunable_policy(`run_ssh_inetd',`
40# inetd_tcp_service_domain(sshd_t,sshd_exec_t)
41# ',`
42# init_daemon_domain(sshd_t,sshd_exec_t)
43# ')
44#',`
45 # These rules should match the else block
46 # of the run_ssh_inetd tunable directly above
47 init_daemon_domain(sshd_t,sshd_exec_t)
48#')
49
50type sshd_key_t;
51files_type(sshd_key_t)
52
53type sshd_tmp_t;
54files_tmp_file(sshd_tmp_t)
55
56#################################
57#
58# sshd local policy
59#
60# sshd_t is the domain for the sshd program.
61#
62
63# so a tunnel can point to another ssh tunnel
64allow sshd_t self:tcp_socket { acceptfrom connectto recvfrom };
65
66allow sshd_t sshd_tmp_t:dir create_dir_perms;
67allow sshd_t sshd_tmp_t:file create_file_perms;
68allow sshd_t sshd_tmp_t:sock_file create_file_perms;
69files_create_tmp_files(sshd_t, sshd_tmp_t, { dir file sock_file })
70
71# for X forwarding
72corenet_tcp_bind_xserver_port(sshd_t)
73
74auth_exec_pam(sshd_t)
75
76seutil_read_config(sshd_t)
77
78ifdef(`targeted_policy',`
79 unconfined_domain_template(sshd_t)
80')
81
82tunable_policy(`ssh_sysadm_login',`
83 # Relabel and access ptys created by sshd
84 # ioctl is necessary for logout() processing for utmp entry and for w to
85 # display the tty.
86 # some versions of sshd on the new SE Linux require setattr
87 term_use_all_user_ptys(sshd_t)
88 term_setattr_all_user_ptys(sshd_t)
89 term_relabelto_all_user_ptys(sshd_t)
90
91 userdom_spec_domtrans_all_users(sshd_t)
92 userdom_signal_all_users(sshd_t)
93',`
94 userdom_spec_domtrans_unpriv_users(sshd_t)
95 userdom_signal_unpriv_users(sshd_t)
96')
97
98optional_policy(`rpm.te',`
99 rpm_use_script_fd(sshd_t)
100')
101
102ifdef(`TODO',`
103tunable_policy(`ssh_sysadm_login',`
104 # Relabel and access ptys created by sshd
105 # ioctl is necessary for logout() processing for utmp entry and for w to
106 # display the tty.
107 # some versions of sshd on the new SE Linux require setattr
108 allow sshd_t ptyfile:chr_file relabelto;
109
110 optional_policy(`xauth.te',`
111 domain_trans(sshd_t, xauth_exec_t, userdomain)
112 ')
113',`
114 optional_policy(`xauth.te',`
115 domain_trans(sshd_t, xauth_exec_t, unpriv_userdomain)
116 ')
117 # Relabel and access ptys created by sshd
118 # ioctl is necessary for logout() processing for utmp entry and for w to
119 # display the tty.
120 # some versions of sshd on the new SE Linux require setattr
121 allow sshd_t userpty_type:chr_file { relabelto read write getattr ioctl setattr };
122')
123') dnl endif TODO
124
125#################################
126#
127# sshd_extern local policy
128#
129# sshd_extern_t is the domain for ssh from outside our network
130#
131
132ifdef(`TODO',`
133domain_trans(sshd_extern_t, shell_exec_t, user_mini_domain)
134# Signal the user domains.
135allow sshd_extern_t user_mini_domain:process signal;
136
137ifdef(`xauth.te', `
138domain_trans(sshd_extern_t, xauth_exec_t, user_mini_domain)
139')
140
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
145allow sshd_extern_t user_mini_domain:chr_file { relabelto read write getattr ioctl setattr };
146
147# inheriting stream sockets is needed for "ssh host command" as no pty
148# is allocated
149allow user_mini_domain sshd_extern_t:unix_stream_socket rw_stream_socket_perms;
150
151optional_policy(`inetd.te',`
152 tunable_policy(`run_ssh_inetd',`
153 domain_trans(inetd_t, sshd_exec_t, sshd_extern_t)
154 ',`
155 domain_trans(initrc_t, sshd_exec_t, sshd_extern_t)
156 ')
157',`
158 # These rules should match the else block
159 # of the run_ssh_inetd tunable directly above
160 domain_trans(initrc_t, sshd_exec_t, sshd_extern_t)
161')
162
163ifdef(`direct_sysadm_daemon', `
164# Direct execution by sysadm_r.
165domain_auto_trans(sysadm_t, sshd_exec_t, sshd_t)
166role_transition sysadm_r sshd_exec_t system_r;
167')
168
169# for port forwarding
170allow userdomain sshd_t:tcp_socket { connectto recvfrom };
171allow sshd_t userdomain:tcp_socket { acceptfrom recvfrom };
172allow userdomain kernel_t:tcp_socket recvfrom;
173allow sshd_t kernel_t:tcp_socket recvfrom;
174') dnl endif TODO
175
176########################################
177#
178# ssh_keygen local policy
179#
180
181# ssh_keygen_t is the type of the ssh-keygen program when run at install time
182# and by sysadm_t
183
184dontaudit ssh_keygen_t self:capability sys_tty_config;
185allow ssh_keygen_t self:process { sigchld sigkill sigstop signull signal };
186
187allow ssh_keygen_t self:unix_stream_socket create_stream_socket_perms;
188
189allow ssh_keygen_t sshd_key_t:file create_file_perms;
190files_create_etc_config(ssh_keygen_t,sshd_key_t,file)
191
192kernel_read_kernel_sysctl(ssh_keygen_t)
193
194fs_search_auto_mountpoints(ssh_keygen_t)
195
196dev_read_sysfs(ssh_keygen_t)
197dev_read_urand(ssh_keygen_t)
198
199term_dontaudit_use_console(ssh_keygen_t)
200
201domain_use_wide_inherit_fd(ssh_keygen_t)
202
203files_read_etc_files(ssh_keygen_t)
204
205init_use_fd(ssh_keygen_t)
206init_use_script_pty(ssh_keygen_t)
207
208libs_use_ld_so(ssh_keygen_t)
209libs_use_shared_libs(ssh_keygen_t)
210
211logging_send_syslog_msg(ssh_keygen_t)
212
213allow ssh_keygen_t proc_t:dir r_dir_perms;
214allow ssh_keygen_t proc_t:lnk_file read;
215
216userdom_use_sysadm_tty(ssh_keygen_t)
217userdom_dontaudit_use_unpriv_user_fd(ssh_keygen_t)
218
219# cjp: with the old daemon_(base_)domain being broken up into
220# a daemon and system interface, this probably is not needed:
221ifdef(`direct_sysadm_daemon',`
222 userdom_dontaudit_use_sysadm_terms(ssh_keygen_t)
223')
224
225ifdef(`targeted_policy', `
226 term_dontaudit_use_unallocated_tty(ssh_keygen_t)
227 term_dontaudit_use_generic_pty(ssh_keygen_t)
228 files_dontaudit_read_root_file(ssh_keygen_t)
229')
230
231optional_policy(`selinuxutil.te',`
232 seutil_sigchld_newrole(ssh_keygen_t)
233')
234
235optional_policy(`udev.te', `
236 udev_read_db(ssh_keygen_t)
237')
238
239ifdef(`TODO',`
240optional_policy(`rhgb.te', `
241 rhgb_domain(ssh_keygen_t)
242')
243')