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