1ssh_selinux(8) SELinux Policy ssh ssh_selinux(8)
2
3
4
6 ssh_selinux - Security Enhanced Linux Policy for the ssh processes
7
9 Security-Enhanced Linux secures the ssh processes via flexible manda‐
10 tory access control.
11
12 The ssh processes execute with the ssh_t SELinux type. You can check if
13 you have these processes running by executing the ps command with the
14 -Z qualifier.
15
16 For example:
17
18 ps -eZ | grep ssh_t
19
20
21
23 The ssh_t SELinux type can be entered via the ssh_exec_t file type.
24
25 The default entrypoint paths for the ssh_t domain are the following:
26
27 /usr/bin/ssh, /usr/libexec/nm-ssh-service
28
30 SELinux defines process types (domains) for each process running on the
31 system
32
33 You can see the context of a process using the -Z option to ps
34
35 Policy governs the access confined processes have to files. SELinux
36 ssh policy is very flexible allowing users to setup their ssh processes
37 in as secure a method as possible.
38
39 The following process types are defined for ssh:
40
41 sshd_t, sshd_sandbox_t, sshd_net_t, ssh_keygen_t, sshd_keygen_t, ssh_t, ssh_keysign_t
42
43 Note: semanage permissive -a ssh_t can be used to make the process type
44 ssh_t permissive. SELinux does not deny access to permissive process
45 types, but the AVC (SELinux denials) messages are still generated.
46
47
49 SELinux policy is customizable based on least access required. ssh
50 policy is extremely flexible and has several booleans that allow you to
51 manipulate the policy and run ssh with the tightest access possible.
52
53
54
55 If you want to allow host key based authentication, you must turn on
56 the ssh_keysign boolean. Disabled by default.
57
58 setsebool -P ssh_keysign 1
59
60
61
62 If you want to allow users to resolve user passwd entries directly from
63 ldap rather then using a sssd server, you must turn on the authlo‐
64 gin_nsswitch_use_ldap boolean. Disabled by default.
65
66 setsebool -P authlogin_nsswitch_use_ldap 1
67
68
69
70 If you want to allow all domains to execute in fips_mode, you must turn
71 on the fips_mode boolean. Enabled by default.
72
73 setsebool -P fips_mode 1
74
75
76
77 If you want to allow confined applications to run with kerberos, you
78 must turn on the kerberos_enabled boolean. Enabled by default.
79
80 setsebool -P kerberos_enabled 1
81
82
83
84 If you want to allow system to run with NIS, you must turn on the
85 nis_enabled boolean. Disabled by default.
86
87 setsebool -P nis_enabled 1
88
89
90
91 If you want to allow confined applications to use nscd shared memory,
92 you must turn on the nscd_use_shm boolean. Enabled by default.
93
94 setsebool -P nscd_use_shm 1
95
96
97
98 If you want to allow regular users direct dri device access, you must
99 turn on the selinuxuser_direct_dri_enabled boolean. Enabled by default.
100
101 setsebool -P selinuxuser_direct_dri_enabled 1
102
103
104
105 If you want to allow users to run TCP servers (bind to ports and accept
106 connection from the same domain and outside users) disabling this
107 forces FTP passive mode and may change other protocols, you must turn
108 on the selinuxuser_tcp_server boolean. Disabled by default.
109
110 setsebool -P selinuxuser_tcp_server 1
111
112
113
114 If you want to allows clients to write to the X server shared memory
115 segments, you must turn on the xserver_clients_write_xshm boolean. Dis‐
116 abled by default.
117
118 setsebool -P xserver_clients_write_xshm 1
119
120
121
123 SELinux defines port types to represent TCP and UDP ports.
124
125 You can see the types associated with a port by using the following
126 command:
127
128 semanage port -l
129
130
131 Policy governs the access confined processes have to these ports.
132 SELinux ssh policy is very flexible allowing users to setup their ssh
133 processes in as secure a method as possible.
134
135 The following port types are defined for ssh:
136
137
138 ssh_port_t
139
140
141
142 Default Defined Ports:
143 tcp 22
144
146 The SELinux process type ssh_t can manage files labeled with the fol‐
147 lowing file types. The paths listed are the default paths for these
148 file types. Note the processes UID still need to have DAC permissions.
149
150 cifs_t
151
152
153 ecryptfs_t
154
155 /home/[^/]+/.Private(/.*)?
156 /home/[^/]+/.ecryptfs(/.*)?
157
158 fusefs_t
159
160 /var/run/user/[^/]*/gvfs
161
162 nfs_t
163
164
165 ssh_home_t
166
167 /var/lib/[^/]+/.ssh(/.*)?
168 /root/.ssh(/.*)?
169 /var/lib/one/.ssh(/.*)?
170 /var/lib/pgsql/.ssh(/.*)?
171 /var/lib/openshift/[^/]+/.ssh(/.*)?
172 /var/lib/amanda/.ssh(/.*)?
173 /var/lib/stickshift/[^/]+/.ssh(/.*)?
174 /var/lib/gitolite/.ssh(/.*)?
175 /var/lib/nocpulse/.ssh(/.*)?
176 /var/lib/gitolite3/.ssh(/.*)?
177 /var/lib/openshift/gear/[^/]+/.ssh(/.*)?
178 /root/.shosts
179 /home/[^/]+/.ssh(/.*)?
180 /home/[^/]+/.ansible/cp/.*
181 /home/[^/]+/.shosts
182
183 ssh_tmpfs_t
184
185
186 user_fonts_cache_t
187
188 /root/.fontconfig(/.*)?
189 /root/.fonts/auto(/.*)?
190 /root/.fonts.cache-.*
191 /home/[^/]+/.fontconfig(/.*)?
192 /home/[^/]+/.fonts/auto(/.*)?
193 /home/[^/]+/.fonts.cache-.*
194
195 user_tmp_t
196
197 /dev/shm/mono.*
198 /var/run/user(/.*)?
199 /tmp/.ICE-unix(/.*)?
200 /tmp/.X11-unix(/.*)?
201 /dev/shm/pulse-shm.*
202 /tmp/.X0-lock
203 /tmp/hsperfdata_root
204 /var/tmp/hsperfdata_root
205 /home/[^/]+/tmp
206 /home/[^/]+/.tmp
207 /tmp/gconfd-[^/]+
208
209 user_tmp_type
210
211 all user tmp files
212
213 xserver_tmpfs_t
214
215
216
218 SELinux requires files to have an extended attribute to define the file
219 type.
220
221 You can see the context of a file using the -Z option to ls
222
223 Policy governs the access confined processes have to these files.
224 SELinux ssh policy is very flexible allowing users to setup their ssh
225 processes in as secure a method as possible.
226
227 STANDARD FILE CONTEXT
228
229 SELinux defines the file context types for the ssh, if you wanted to
230 store files with these types in a diffent paths, you need to execute
231 the semanage command to sepecify alternate labeling and then use
232 restorecon to put the labels on disk.
233
234 semanage fcontext -a -t ssh_home_t '/srv/myssh_content(/.*)?'
235 restorecon -R -v /srv/myssh_content
236
237 Note: SELinux often uses regular expressions to specify labels that
238 match multiple files.
239
240 The following file types are defined for ssh:
241
242
243
244 ssh_agent_exec_t
245
246 - Set files with the ssh_agent_exec_t type, if you want to transition
247 an executable to the ssh_agent_t domain.
248
249
250
251 ssh_agent_tmp_t
252
253 - Set files with the ssh_agent_tmp_t type, if you want to store ssh
254 agent temporary files in the /tmp directories.
255
256
257
258 ssh_exec_t
259
260 - Set files with the ssh_exec_t type, if you want to transition an exe‐
261 cutable to the ssh_t domain.
262
263
264 Paths:
265 /usr/bin/ssh, /usr/libexec/nm-ssh-service
266
267
268 ssh_home_t
269
270 - Set files with the ssh_home_t type, if you want to store ssh files in
271 the users home directory.
272
273
274 Paths:
275 /var/lib/[^/]+/.ssh(/.*)?, /root/.ssh(/.*)?,
276 /var/lib/one/.ssh(/.*)?, /var/lib/pgsql/.ssh(/.*)?, /var/lib/open‐
277 shift/[^/]+/.ssh(/.*)?, /var/lib/amanda/.ssh(/.*)?,
278 /var/lib/stickshift/[^/]+/.ssh(/.*)?, /var/lib/gito‐
279 lite/.ssh(/.*)?, /var/lib/nocpulse/.ssh(/.*)?, /var/lib/gito‐
280 lite3/.ssh(/.*)?, /var/lib/openshift/gear/[^/]+/.ssh(/.*)?,
281 /root/.shosts, /home/[^/]+/.ssh(/.*)?, /home/[^/]+/.ansible/cp/.*,
282 /home/[^/]+/.shosts
283
284
285 ssh_keygen_exec_t
286
287 - Set files with the ssh_keygen_exec_t type, if you want to transition
288 an executable to the ssh_keygen_t domain.
289
290
291
292 ssh_keygen_tmp_t
293
294 - Set files with the ssh_keygen_tmp_t type, if you want to store ssh
295 keygen temporary files in the /tmp directories.
296
297
298
299 ssh_keysign_exec_t
300
301 - Set files with the ssh_keysign_exec_t type, if you want to transition
302 an executable to the ssh_keysign_t domain.
303
304
305 Paths:
306 /usr/lib/openssh/ssh-keysign, /usr/libexec/openssh/ssh-keysign
307
308
309 ssh_tmpfs_t
310
311 - Set files with the ssh_tmpfs_t type, if you want to store ssh files
312 on a tmpfs file system.
313
314
315
316 sshd_exec_t
317
318 - Set files with the sshd_exec_t type, if you want to transition an
319 executable to the sshd_t domain.
320
321
322 Paths:
323 /usr/sbin/sshd, /usr/sbin/gsisshd
324
325
326 sshd_initrc_exec_t
327
328 - Set files with the sshd_initrc_exec_t type, if you want to transition
329 an executable to the sshd_initrc_t domain.
330
331
332
333 sshd_key_t
334
335 - Set files with the sshd_key_t type, if you want to treat the files as
336 sshd key data.
337
338
339 Paths:
340 /etc/ssh/ssh_host.*_key, /etc/ssh/ssh_host.*_key.pub,
341 /etc/ssh/primes
342
343
344 sshd_keygen_exec_t
345
346 - Set files with the sshd_keygen_exec_t type, if you want to transition
347 an executable to the sshd_keygen_t domain.
348
349
350 Paths:
351 /usr/sbin/sshd-keygen, /usr/libexec/openssh/sshd-keygen
352
353
354 sshd_keygen_unit_file_t
355
356 - Set files with the sshd_keygen_unit_file_t type, if you want to treat
357 the files as sshd keygen unit content.
358
359
360
361 sshd_keytab_t
362
363 - Set files with the sshd_keytab_t type, if you want to treat the files
364 as kerberos keytab files.
365
366
367
368 sshd_tmpfs_t
369
370 - Set files with the sshd_tmpfs_t type, if you want to store sshd files
371 on a tmpfs file system.
372
373
374
375 sshd_unit_file_t
376
377 - Set files with the sshd_unit_file_t type, if you want to treat the
378 files as sshd unit content.
379
380
381
382 sshd_var_run_t
383
384 - Set files with the sshd_var_run_t type, if you want to store the sshd
385 files under the /run or /var/run directory.
386
387
388 Paths:
389 /var/run/sshd.pid, /var/run/sshd.init.pid
390
391
392 Note: File context can be temporarily modified with the chcon command.
393 If you want to permanently change the file context you need to use the
394 semanage fcontext command. This will modify the SELinux labeling data‐
395 base. You will need to use restorecon to apply the labels.
396
397
399 semanage fcontext can also be used to manipulate default file context
400 mappings.
401
402 semanage permissive can also be used to manipulate whether or not a
403 process type is permissive.
404
405 semanage module can also be used to enable/disable/install/remove pol‐
406 icy modules.
407
408 semanage port can also be used to manipulate the port definitions
409
410 semanage boolean can also be used to manipulate the booleans
411
412
413 system-config-selinux is a GUI tool available to customize SELinux pol‐
414 icy settings.
415
416
418 This manual page was auto-generated using sepolicy manpage .
419
420
422 selinux(8), ssh(8), semanage(8), restorecon(8), chcon(1), sepolicy(8),
423 setsebool(8), ssh_keygen_selinux(8), ssh_keygen_selinux(8),
424 ssh_keysign_selinux(8), ssh_keysign_selinux(8)
425
426
427
428ssh 19-10-08 ssh_selinux(8)