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, /usr/sbin/gsisshd
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 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 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 users to resolve user passwd entries directly from
64 ldap rather then using a sssd server, you must turn on the authlo‐
65 gin_nsswitch_use_ldap boolean. Disabled by default.
66
67 setsebool -P authlogin_nsswitch_use_ldap 1
68
69
70
71 If you want to allow users to login using a radius server, you must
72 turn on the authlogin_radius boolean. Disabled by default.
73
74 setsebool -P authlogin_radius 1
75
76
77
78 If you want to allow users to login using a yubikey OTP server or chal‐
79 lenge response mode, you must turn on the authlogin_yubikey boolean.
80 Disabled by default.
81
82 setsebool -P authlogin_yubikey 1
83
84
85
86 If you want to allow all daemons to write corefiles to /, you must turn
87 on the daemons_dump_core boolean. Disabled by default.
88
89 setsebool -P daemons_dump_core 1
90
91
92
93 If you want to enable cluster mode for daemons, you must turn on the
94 daemons_enable_cluster_mode boolean. Enabled by default.
95
96 setsebool -P daemons_enable_cluster_mode 1
97
98
99
100 If you want to allow all daemons to use tcp wrappers, you must turn on
101 the daemons_use_tcp_wrapper boolean. Disabled by default.
102
103 setsebool -P daemons_use_tcp_wrapper 1
104
105
106
107 If you want to allow all daemons the ability to read/write terminals,
108 you must turn on the daemons_use_tty boolean. Disabled by default.
109
110 setsebool -P daemons_use_tty 1
111
112
113
114 If you want to deny any process from ptracing or debugging any other
115 processes, you must turn on the deny_ptrace boolean. Enabled by
116 default.
117
118 setsebool -P deny_ptrace 1
119
120
121
122 If you want to allow any process to mmap any file on system with
123 attribute file_type, you must turn on the domain_can_mmap_files bool‐
124 ean. Enabled by default.
125
126 setsebool -P domain_can_mmap_files 1
127
128
129
130 If you want to allow all domains write to kmsg_device, while kernel is
131 executed with systemd.log_target=kmsg parameter, you must turn on the
132 domain_can_write_kmsg boolean. Disabled by default.
133
134 setsebool -P domain_can_write_kmsg 1
135
136
137
138 If you want to allow all domains to use other domains file descriptors,
139 you must turn on the domain_fd_use boolean. Enabled by default.
140
141 setsebool -P domain_fd_use 1
142
143
144
145 If you want to allow all domains to have the kernel load modules, you
146 must turn on the domain_kernel_load_modules boolean. Disabled by
147 default.
148
149 setsebool -P domain_kernel_load_modules 1
150
151
152
153 If you want to allow all domains to execute in fips_mode, you must turn
154 on the fips_mode boolean. Enabled by default.
155
156 setsebool -P fips_mode 1
157
158
159
160 If you want to enable reading of urandom for all domains, you must turn
161 on the global_ssp boolean. Disabled by default.
162
163 setsebool -P global_ssp 1
164
165
166
167 If you want to allow confined applications to run with kerberos, you
168 must turn on the kerberos_enabled boolean. Enabled by default.
169
170 setsebool -P kerberos_enabled 1
171
172
173
174 If you want to allow system to run with NIS, you must turn on the
175 nis_enabled boolean. Disabled by default.
176
177 setsebool -P nis_enabled 1
178
179
180
181 If you want to allow confined applications to use nscd shared memory,
182 you must turn on the nscd_use_shm boolean. Disabled by default.
183
184 setsebool -P nscd_use_shm 1
185
186
187
188 If you want to enable polyinstantiated directory support, you must turn
189 on the polyinstantiation_enabled boolean. Disabled by default.
190
191 setsebool -P polyinstantiation_enabled 1
192
193
194
195 If you want to allow a user to login as an unconfined domain, you must
196 turn on the unconfined_login boolean. Enabled by default.
197
198 setsebool -P unconfined_login 1
199
200
201
202 If you want to support ecryptfs home directories, you must turn on the
203 use_ecryptfs_home_dirs boolean. Disabled by default.
204
205 setsebool -P use_ecryptfs_home_dirs 1
206
207
208
209 If you want to support fusefs home directories, you must turn on the
210 use_fusefs_home_dirs boolean. Disabled by default.
211
212 setsebool -P use_fusefs_home_dirs 1
213
214
215
216 If you want to support NFS home directories, you must turn on the
217 use_nfs_home_dirs boolean. Disabled by default.
218
219 setsebool -P use_nfs_home_dirs 1
220
221
222
223 If you want to support SAMBA home directories, you must turn on the
224 use_samba_home_dirs boolean. Disabled by default.
225
226 setsebool -P use_samba_home_dirs 1
227
228
229
231 SELinux defines port types to represent TCP and UDP ports.
232
233 You can see the types associated with a port by using the following
234 command:
235
236 semanage port -l
237
238
239 Policy governs the access confined processes have to these ports.
240 SELinux sshd policy is very flexible allowing users to setup their sshd
241 processes in as secure a method as possible.
242
243 The following port types are defined for sshd:
244
245
246 ssh_port_t
247
248
249
250 Default Defined Ports:
251 tcp 22
252
254 The SELinux process type sshd_t can manage files labeled with the fol‐
255 lowing file types. The paths listed are the default paths for these
256 file types. Note the processes UID still need to have DAC permissions.
257
258 auth_cache_t
259
260 /var/cache/coolkey(/.*)?
261
262 auth_home_t
263
264 /root/.yubico(/.*)?
265 /root/.google_authenticator
266 /root/.google_authenticator~
267 /home/[^/]+/.yubico(/.*)?
268 /home/[^/]+/.google_authenticator
269 /home/[^/]+/.google_authenticator~
270
271 cgroup_t
272
273 /sys/fs/cgroup
274
275 cifs_t
276
277
278 cluster_conf_t
279
280 /etc/cluster(/.*)?
281
282 cluster_var_lib_t
283
284 /var/lib/pcsd(/.*)?
285 /var/lib/cluster(/.*)?
286 /var/lib/openais(/.*)?
287 /var/lib/pengine(/.*)?
288 /var/lib/corosync(/.*)?
289 /usr/lib/heartbeat(/.*)?
290 /var/lib/heartbeat(/.*)?
291 /var/lib/pacemaker(/.*)?
292
293 cluster_var_run_t
294
295 /var/run/crm(/.*)?
296 /var/run/cman_.*
297 /var/run/rsctmp(/.*)?
298 /var/run/aisexec.*
299 /var/run/heartbeat(/.*)?
300 /var/run/corosync-qnetd(/.*)?
301 /var/run/corosync-qdevice(/.*)?
302 /var/run/cpglockd.pid
303 /var/run/corosync.pid
304 /var/run/rgmanager.pid
305 /var/run/cluster/rgmanager.sk
306
307 condor_var_lib_t
308
309 /var/lib/condor(/.*)?
310 /var/lib/condor/spool(/.*)?
311 /var/lib/condor/execute(/.*)?
312
313 ecryptfs_t
314
315 /home/[^/]+/.Private(/.*)?
316 /home/[^/]+/.ecryptfs(/.*)?
317
318 faillog_t
319
320 /var/log/btmp.*
321 /var/log/faillog.*
322 /var/log/tallylog.*
323 /var/run/faillock(/.*)?
324
325 fusefs_t
326
327 /var/run/user/[^/]*/gvfs
328
329 gitosis_var_lib_t
330
331 /srv/lib/gitosis(/.*)?
332 /var/lib/gitosis(/.*)?
333 /var/lib/gitolite(3)?(/.*)?
334
335 initrc_var_run_t
336
337 /var/run/utmp
338 /var/run/random-seed
339 /var/run/runlevel.dir
340 /var/run/setmixer_flag
341
342 krb5_host_rcache_t
343
344 /var/cache/krb5rcache(/.*)?
345 /var/tmp/nfs_0
346 /var/tmp/DNS_25
347 /var/tmp/host_0
348 /var/tmp/imap_0
349 /var/tmp/HTTP_23
350 /var/tmp/HTTP_48
351 /var/tmp/ldap_55
352 /var/tmp/ldap_487
353 /var/tmp/ldapmap1_0
354
355 lastlog_t
356
357 /var/log/lastlog.*
358
359 nfs_t
360
361
362 openshift_tmp_t
363
364 /var/lib/openshift/.*/.tmp(/.*)?
365 /var/lib/openshift/.*/.sandbox(/.*)?
366 /var/lib/stickshift/.*/.tmp(/.*)?
367 /var/lib/stickshift/.*/.sandbox(/.*)?
368
369 pam_var_run_t
370
371 /var/(db|adm)/sudo(/.*)?
372 /var/run/sudo(/.*)?
373 /var/lib/sudo(/.*)?
374 /var/run/sepermit(/.*)?
375 /var/run/pam_mount(/.*)?
376
377 root_t
378
379 /sysroot/ostree/deploy/.*-atomic.*/deploy(/.*)?
380 /
381 /initrd
382
383 security_t
384
385 /selinux
386
387 ssh_home_t
388
389 /var/lib/[^/]+/.ssh(/.*)?
390 /root/.ssh(/.*)?
391 /var/lib/one/.ssh(/.*)?
392 /var/lib/pgsql/.ssh(/.*)?
393 /var/lib/openshift/[^/]+/.ssh(/.*)?
394 /var/lib/amanda/.ssh(/.*)?
395 /var/lib/stickshift/[^/]+/.ssh(/.*)?
396 /var/lib/gitolite/.ssh(/.*)?
397 /var/lib/nocpulse/.ssh(/.*)?
398 /var/lib/gitolite3/.ssh(/.*)?
399 /var/lib/openshift/gear/[^/]+/.ssh(/.*)?
400 /root/.shosts
401 /home/[^/]+/.ssh(/.*)?
402 /home/[^/]+/.ansible/cp/.*
403 /home/[^/]+/.shosts
404
405 sshd_var_run_t
406
407 /var/run/sshd.pid
408 /var/run/sshd.init.pid
409
410 systemd_passwd_var_run_t
411
412 /var/run/systemd/ask-password(/.*)?
413 /var/run/systemd/ask-password-block(/.*)?
414
415 user_tmp_t
416
417 /dev/shm/mono.*
418 /var/run/user(/.*)?
419 /tmp/.X11-unix(/.*)?
420 /tmp/.ICE-unix(/.*)?
421 /dev/shm/pulse-shm.*
422 /tmp/.X0-lock
423 /tmp/hsperfdata_root
424 /var/tmp/hsperfdata_root
425 /home/[^/]+/tmp
426 /home/[^/]+/.tmp
427 /tmp/gconfd-[^/]+
428
429 user_tmp_type
430
431 all user tmp files
432
433 var_auth_t
434
435 /var/ace(/.*)?
436 /var/rsa(/.*)?
437 /var/lib/abl(/.*)?
438 /var/lib/rsa(/.*)?
439 /var/lib/pam_ssh(/.*)?
440 /var/run/pam_ssh(/.*)?
441 /var/lib/pam_shield(/.*)?
442 /var/opt/quest/vas/vasd(/.*)?
443 /var/lib/google-authenticator(/.*)?
444
445 wtmp_t
446
447 /var/log/wtmp.*
448
449
451 SELinux requires files to have an extended attribute to define the file
452 type.
453
454 You can see the context of a file using the -Z option to ls
455
456 Policy governs the access confined processes have to these files.
457 SELinux sshd policy is very flexible allowing users to setup their sshd
458 processes in as secure a method as possible.
459
460 STANDARD FILE CONTEXT
461
462 SELinux defines the file context types for the sshd, if you wanted to
463 store files with these types in a diffent paths, you need to execute
464 the semanage command to sepecify alternate labeling and then use
465 restorecon to put the labels on disk.
466
467 semanage fcontext -a -t sshd_var_run_t '/srv/mysshd_content(/.*)?'
468 restorecon -R -v /srv/mysshd_content
469
470 Note: SELinux often uses regular expressions to specify labels that
471 match multiple files.
472
473 The following file types are defined for sshd:
474
475
476
477 sshd_exec_t
478
479 - Set files with the sshd_exec_t type, if you want to transition an
480 executable to the sshd_t domain.
481
482
483 Paths:
484 /usr/sbin/sshd, /usr/sbin/gsisshd
485
486
487 sshd_initrc_exec_t
488
489 - Set files with the sshd_initrc_exec_t type, if you want to transition
490 an executable to the sshd_initrc_t domain.
491
492
493
494 sshd_key_t
495
496 - Set files with the sshd_key_t type, if you want to treat the files as
497 sshd key data.
498
499
500 Paths:
501 /etc/ssh/ssh_host.*_key, /etc/ssh/ssh_host.*_key.pub,
502 /etc/ssh/primes
503
504
505 sshd_keygen_exec_t
506
507 - Set files with the sshd_keygen_exec_t type, if you want to transition
508 an executable to the sshd_keygen_t domain.
509
510
511
512 sshd_keygen_unit_file_t
513
514 - Set files with the sshd_keygen_unit_file_t type, if you want to treat
515 the files as sshd keygen unit content.
516
517
518
519 sshd_keytab_t
520
521 - Set files with the sshd_keytab_t type, if you want to treat the files
522 as kerberos keytab files.
523
524
525
526 sshd_tmpfs_t
527
528 - Set files with the sshd_tmpfs_t type, if you want to store sshd files
529 on a tmpfs file system.
530
531
532
533 sshd_unit_file_t
534
535 - Set files with the sshd_unit_file_t type, if you want to treat the
536 files as sshd unit content.
537
538
539
540 sshd_var_run_t
541
542 - Set files with the sshd_var_run_t type, if you want to store the sshd
543 files under the /run or /var/run directory.
544
545
546 Paths:
547 /var/run/sshd.pid, /var/run/sshd.init.pid
548
549
550 Note: File context can be temporarily modified with the chcon command.
551 If you want to permanently change the file context you need to use the
552 semanage fcontext command. This will modify the SELinux labeling data‐
553 base. You will need to use restorecon to apply the labels.
554
555
557 semanage fcontext can also be used to manipulate default file context
558 mappings.
559
560 semanage permissive can also be used to manipulate whether or not a
561 process type is permissive.
562
563 semanage module can also be used to enable/disable/install/remove pol‐
564 icy modules.
565
566 semanage port can also be used to manipulate the port definitions
567
568 semanage boolean can also be used to manipulate the booleans
569
570
571 system-config-selinux is a GUI tool available to customize SELinux pol‐
572 icy settings.
573
574
576 This manual page was auto-generated using sepolicy manpage .
577
578
580 selinux(8), sshd(8), semanage(8), restorecon(8), chcon(1), sepolicy(8)
581 , setsebool(8), ssh_keygen_selinux(8), ssh_keysign_selinux(8),
582 sshd_keygen_selinux(8), sshd_net_selinux(8), sshd_sandbox_selinux(8)
583
584
585
586sshd 19-04-25 sshd_selinux(8)