1sshd_selinux(8) SELinux Policy sshd sshd_selinux(8)
2
3
4
6 sshd_selinux - Security Enhanced Linux Policy for the sshd processes
7
9 Security-Enhanced Linux secures the sshd processes via flexible manda‐
10 tory access control.
11
12 The sshd processes execute with the sshd_t SELinux type. You can check
13 if you have these processes running by executing the ps command with
14 the -Z qualifier.
15
16 For example:
17
18 ps -eZ | grep sshd_t
19
20
21
23 The sshd_t SELinux type can be entered via the sshd_exec_t file type.
24
25 The default entrypoint paths for the sshd_t domain are the following:
26
27 /usr/sbin/sshd
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 sshd policy is very flexible allowing users to setup their sshd pro‐
37 cesses in as secure a method as possible.
38
39 The following process types are defined for sshd:
40
41 ssh_keysign_t, ssh_keygen_t, ssh_t, sshd_t
42
43 Note: semanage permissive -a sshd_t can be used to make the process
44 type sshd_t permissive. SELinux does not deny access to permissive
45 process types, but the AVC (SELinux denials) messages are still gener‐
46 ated.
47
48
50 SELinux policy is customizable based on least access required. sshd
51 policy is extremely flexible and has several booleans that allow you to
52 manipulate the policy and run sshd with the tightest access possible.
53
54
55
56 If you want to allow ssh logins as sysadm_r:sysadm_t, you must turn on
57 the ssh_sysadm_login boolean. Disabled by default.
58
59 setsebool -P ssh_sysadm_login 1
60
61
62
63 If you want to allow all daemons to write corefiles to /, you must turn
64 on the allow_daemons_dump_core boolean. Disabled by default.
65
66 setsebool -P allow_daemons_dump_core 1
67
68
69
70 If you want to allow all daemons to use tcp wrappers, you must turn on
71 the allow_daemons_use_tcp_wrapper boolean. Disabled by default.
72
73 setsebool -P allow_daemons_use_tcp_wrapper 1
74
75
76
77 If you want to allow all daemons the ability to read/write terminals,
78 you must turn on the allow_daemons_use_tty boolean. Disabled by
79 default.
80
81 setsebool -P allow_daemons_use_tty 1
82
83
84
85 If you want to allow all domains to use other domains file descriptors,
86 you must turn on the allow_domain_fd_use boolean. Enabled by default.
87
88 setsebool -P allow_domain_fd_use 1
89
90
91
92 If you want to allow confined applications to run with kerberos, you
93 must turn on the allow_kerberos boolean. Enabled by default.
94
95 setsebool -P allow_kerberos 1
96
97
98
99 If you want to enable polyinstantiated directory support, you must turn
100 on the allow_polyinstantiation boolean. Enabled by default.
101
102 setsebool -P allow_polyinstantiation 1
103
104
105
106 If you want to allow sysadm to debug or ptrace all processes, you must
107 turn on the allow_ptrace boolean. Disabled by default.
108
109 setsebool -P allow_ptrace 1
110
111
112
113 If you want to allow system to run with NIS, you must turn on the
114 allow_ypbind boolean. Disabled by default.
115
116 setsebool -P allow_ypbind 1
117
118
119
120 If you want to allow users to login using a radius server, you must
121 turn on the authlogin_radius boolean. Disabled by default.
122
123 setsebool -P authlogin_radius 1
124
125
126
127 If you want to allow users login programs to access /etc/shadow, you
128 must turn on the authlogin_shadow boolean. Disabled by default.
129
130 setsebool -P authlogin_shadow 1
131
132
133
134 If you want to enable cluster mode for daemons, you must turn on the
135 daemons_enable_cluster_mode boolean. Disabled by default.
136
137 setsebool -P daemons_enable_cluster_mode 1
138
139
140
141 If you want to allow all domains to have the kernel load modules, you
142 must turn on the domain_kernel_load_modules boolean. Disabled by
143 default.
144
145 setsebool -P domain_kernel_load_modules 1
146
147
148
149 If you want to allow all domains to execute in fips_mode, you must turn
150 on the fips_mode boolean. Enabled by default.
151
152 setsebool -P fips_mode 1
153
154
155
156 If you want to enable reading of urandom for all domains, you must turn
157 on the global_ssp boolean. Disabled by default.
158
159 setsebool -P global_ssp 1
160
161
162
163 If you want to enable support for upstart as the init program, you must
164 turn on the init_upstart boolean. Enabled by default.
165
166 setsebool -P init_upstart 1
167
168
169
170 If you want to allow confined applications to use nscd shared memory,
171 you must turn on the nscd_use_shm boolean. Enabled by default.
172
173 setsebool -P nscd_use_shm 1
174
175
176
177 If you want to allow a user to login as an unconfined domain, you must
178 turn on the unconfined_login boolean. Enabled by default.
179
180 setsebool -P unconfined_login 1
181
182
183
184 If you want to support fusefs home directories, you must turn on the
185 use_fusefs_home_dirs boolean. Disabled by default.
186
187 setsebool -P use_fusefs_home_dirs 1
188
189
190
191 If you want to support NFS home directories, you must turn on the
192 use_nfs_home_dirs boolean. Disabled by default.
193
194 setsebool -P use_nfs_home_dirs 1
195
196
197
198 If you want to support SAMBA home directories, you must turn on the
199 use_samba_home_dirs boolean. Disabled by default.
200
201 setsebool -P use_samba_home_dirs 1
202
203
204
206 SELinux defines port types to represent TCP and UDP ports.
207
208 You can see the types associated with a port by using the following
209 command:
210
211 semanage port -l
212
213
214 Policy governs the access confined processes have to these ports.
215 SELinux sshd policy is very flexible allowing users to setup their sshd
216 processes in as secure a method as possible.
217
218 The following port types are defined for sshd:
219
220
221 ssh_port_t
222
223
224
225 Default Defined Ports:
226 tcp 22
227
229 The SELinux process type sshd_t can manage files labeled with the fol‐
230 lowing file types. The paths listed are the default paths for these
231 file types. Note the processes UID still need to have DAC permissions.
232
233 auth_cache_t
234
235 /var/cache/coolkey(/.*)?
236
237 cgroup_t
238
239 /cgroup(/.*)?
240
241 cluster_conf_t
242
243 /etc/cluster(/.*)?
244
245 cluster_var_lib_t
246
247 /var/lib(64)?/openais(/.*)?
248 /var/lib(64)?/pengine(/.*)?
249 /var/lib(64)?/corosync(/.*)?
250 /usr/lib(64)?/heartbeat(/.*)?
251 /var/lib(64)?/heartbeat(/.*)?
252 /var/lib(64)?/pacemaker(/.*)?
253 /var/lib/cluster(/.*)?
254
255 cluster_var_run_t
256
257 /var/run/crm(/.*)?
258 /var/run/cman_.*
259 /var/run/rsctmp(/.*)?
260 /var/run/aisexec.*
261 /var/run/heartbeat(/.*)?
262 /var/run/cpglockd.pid
263 /var/run/corosync.pid
264 /var/run/rgmanager.pid
265 /var/run/cluster/rgmanager.sk
266
267 condor_var_lib_t
268
269 /var/lib/condor(/.*)?
270 /var/lib/condor/spool(/.*)?
271 /var/lib/condor/execute(/.*)?
272
273 faillog_t
274
275 /var/log/btmp.*
276 /var/log/faillog.*
277 /var/log/tallylog.*
278 /var/run/faillock(/.*)?
279
280 fusefs_t
281
282
283 gitosis_var_lib_t
284
285 /var/lib/gitosis(/.*)?
286 /var/lib/gitolite(3)?(/.*)?
287
288 initrc_tmp_t
289
290
291 initrc_var_run_t
292
293 /var/run/utmp
294 /var/run/random-seed
295 /var/run/runlevel.dir
296 /var/run/setmixer_flag
297
298 krb5_host_rcache_t
299
300 /var/cache/krb5rcache(/.*)?
301 /var/tmp/host_0
302 /var/tmp/HTTP_23
303
304 lastlog_t
305
306 /var/log/lastlog.*
307
308 mnt_t
309
310 /mnt(/[^/]*)
311 /mnt(/[^/]*)?
312 /rhev(/[^/]*)?
313 /media(/[^/]*)
314 /media(/[^/]*)?
315 /etc/rhgb(/.*)?
316 /media/.hal-.*
317 /net
318 /afs
319 /rhev
320 /misc
321
322 openshift_tmp_t
323
324 /var/lib/openshift/.*/.tmp(/.*)?
325 /var/lib/openshift/.*/.sandbox(/.*)?
326 /var/lib/stickshift/.*/.tmp(/.*)?
327 /var/lib/stickshift/.*/.sandbox(/.*)?
328
329 pam_var_run_t
330
331 /var/(db|adm)/sudo(/.*)?
332 /var/run/sudo(/.*)?
333 /var/lib/sudo(/.*)?
334 /var/run/sepermit(/.*)?
335 /var/run/pam_mount(/.*)?
336
337 pcscd_var_run_t
338
339 /var/run/pcscd.events(/.*)?
340 /var/run/pcscd.pid
341 /var/run/pcscd.pub
342 /var/run/pcscd.comm
343
344 root_t
345
346 /
347 /initrd
348
349 security_t
350
351
352 ssh_home_t
353
354 /root/.ssh(/.*)?
355 /var/lib/gitolite(3)?/.ssh(/.*)?
356 /var/lib/pgsql/.ssh(/.*)?
357 /var/lib/openshift/[^/]+/.ssh(/.*)?
358 /var/lib/amanda/.ssh(/.*)?
359 /var/lib/stickshift/[^/]+/.ssh(/.*)?
360 /root/.shosts
361 /home/[^/]*/.ssh(/.*)?
362 /home/[^/]*/.shosts
363 /home/staff/.ssh(/.*)?
364 /home/staff/.shosts
365
366 sshd_tmpfs_t
367
368
369 sshd_var_run_t
370
371 /var/run/sshd.init.pid
372
373 tmp_t
374
375 /tmp
376 /usr/tmp
377 /var/tmp
378 /tmp-inst
379 /var/tmp-inst
380 /var/tmp/vi.recover
381
382 user_home_t
383
384 /home/[^/]*/.+
385 /home/staff/.+
386
387 user_tmp_t
388
389 /tmp/gconfd-.*
390 /tmp/gconfd-staff
391
392 var_auth_t
393
394 /var/ace(/.*)?
395 /var/rsa(/.*)?
396 /var/lib/rsa(/.*)?
397 /var/lib/abl(/.*)?
398 /var/run/pam_ssh(/.*)?
399 /var/lib/pam_ssh(/.*)?
400 /var/lib/pam_shield(/.*)?
401 /var/opt/quest/vas/vasd(/.*)?
402 /var/lib/google-authenticator(/.*)?
403
404 wtmp_t
405
406 /var/log/wtmp.*
407
408
410 SELinux requires files to have an extended attribute to define the file
411 type.
412
413 You can see the context of a file using the -Z option to ls
414
415 Policy governs the access confined processes have to these files.
416 SELinux sshd policy is very flexible allowing users to setup their sshd
417 processes in as secure a method as possible.
418
419 STANDARD FILE CONTEXT
420
421 SELinux defines the file context types for the sshd, if you wanted to
422 store files with these types in a diffent paths, you need to execute
423 the semanage command to sepecify alternate labeling and then use
424 restorecon to put the labels on disk.
425
426 semanage fcontext -a -t sshd_var_run_t '/srv/mysshd_content(/.*)?'
427 restorecon -R -v /srv/mysshd_content
428
429 Note: SELinux often uses regular expressions to specify labels that
430 match multiple files.
431
432 The following file types are defined for sshd:
433
434
435
436 sshd_exec_t
437
438 - Set files with the sshd_exec_t type, if you want to transition an
439 executable to the sshd_t domain.
440
441
442
443 sshd_initrc_exec_t
444
445 - Set files with the sshd_initrc_exec_t type, if you want to transition
446 an executable to the sshd_initrc_t domain.
447
448
449
450 sshd_key_t
451
452 - Set files with the sshd_key_t type, if you want to treat the files as
453 sshd key data.
454
455
456 Paths:
457 /etc/ssh/ssh_host_key.pub, /etc/ssh/ssh_host_dsa_key.pub,
458 /etc/ssh/ssh_host_rsa_key.pub, /etc/ssh/primes,
459 /etc/ssh/ssh_host_key, /etc/ssh/ssh_host_dsa_key,
460 /etc/ssh/ssh_host_rsa_key
461
462
463 sshd_keytab_t
464
465 - Set files with the sshd_keytab_t type, if you want to treat the files
466 as kerberos keytab files.
467
468
469
470 sshd_tmpfs_t
471
472 - Set files with the sshd_tmpfs_t type, if you want to store sshd files
473 on a tmpfs file system.
474
475
476
477 sshd_var_run_t
478
479 - Set files with the sshd_var_run_t type, if you want to store the sshd
480 files under the /run or /var/run directory.
481
482
483
484 Note: File context can be temporarily modified with the chcon command.
485 If you want to permanently change the file context you need to use the
486 semanage fcontext command. This will modify the SELinux labeling data‐
487 base. You will need to use restorecon to apply the labels.
488
489
491 semanage fcontext can also be used to manipulate default file context
492 mappings.
493
494 semanage permissive can also be used to manipulate whether or not a
495 process type is permissive.
496
497 semanage module can also be used to enable/disable/install/remove pol‐
498 icy modules.
499
500 semanage port can also be used to manipulate the port definitions
501
502 semanage boolean can also be used to manipulate the booleans
503
504
505 system-config-selinux is a GUI tool available to customize SELinux pol‐
506 icy settings.
507
508
510 This manual page was auto-generated using sepolicy manpage .
511
512
514 selinux(8), sshd(8), semanage(8), restorecon(8), chcon(1) , setse‐
515 bool(8), ssh_keygen_selinux(8), ssh_keysign_selinux(8)
516
517
518
519sshd 15-06-03 sshd_selinux(8)