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. Disabled 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. Disabled 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/motd.d(/.*)?
261 /var/run/sepermit(/.*)?
262 /var/run/pam_mount(/.*)?
263 /var/run/motd
264
265 root_t
266
267 /sysroot/ostree/deploy/.*-atomic/deploy(/.*)?
268 /
269 /initrd
270
271 security_t
272
273 /selinux
274
275 ssh_home_t
276
277 /var/lib/[^/]+/.ssh(/.*)?
278 /root/.ssh(/.*)?
279 /var/lib/one/.ssh(/.*)?
280 /var/lib/pgsql/.ssh(/.*)?
281 /var/lib/openshift/[^/]+/.ssh(/.*)?
282 /var/lib/amanda/.ssh(/.*)?
283 /var/lib/stickshift/[^/]+/.ssh(/.*)?
284 /var/lib/gitolite/.ssh(/.*)?
285 /var/lib/nocpulse/.ssh(/.*)?
286 /var/lib/gitolite3/.ssh(/.*)?
287 /var/lib/openshift/gear/[^/]+/.ssh(/.*)?
288 /root/.shosts
289 /home/[^/]+/.ssh(/.*)?
290 /home/[^/]+/.ansible/cp/.*
291 /home/[^/]+/.shosts
292
293 sshd_var_run_t
294
295 /var/run/sshd.pid
296 /var/run/sshd.init.pid
297
298 systemd_passwd_var_run_t
299
300 /var/run/systemd/ask-password(/.*)?
301 /var/run/systemd/ask-password-block(/.*)?
302
303 user_tmp_t
304
305 /dev/shm/mono.*
306 /var/run/user(/.*)?
307 /tmp/.ICE-unix(/.*)?
308 /tmp/.X11-unix(/.*)?
309 /dev/shm/pulse-shm.*
310 /tmp/.X0-lock
311 /tmp/hsperfdata_root
312 /var/tmp/hsperfdata_root
313 /home/[^/]+/tmp
314 /home/[^/]+/.tmp
315 /tmp/gconfd-[^/]+
316
317 user_tmp_type
318
319 all user tmp files
320
321 var_auth_t
322
323 /var/ace(/.*)?
324 /var/rsa(/.*)?
325 /var/lib/abl(/.*)?
326 /var/lib/rsa(/.*)?
327 /var/lib/pam_ssh(/.*)?
328 /var/run/pam_ssh(/.*)?
329 /var/lib/pam_shield(/.*)?
330 /var/opt/quest/vas/vasd(/.*)?
331 /var/lib/google-authenticator(/.*)?
332
333 wtmp_t
334
335 /var/log/wtmp.*
336
337
339 SELinux requires files to have an extended attribute to define the file
340 type.
341
342 You can see the context of a file using the -Z option to ls
343
344 Policy governs the access confined processes have to these files.
345 SELinux sshd policy is very flexible allowing users to setup their sshd
346 processes in as secure a method as possible.
347
348 STANDARD FILE CONTEXT
349
350 SELinux defines the file context types for the sshd, if you wanted to
351 store files with these types in a diffent paths, you need to execute
352 the semanage command to sepecify alternate labeling and then use
353 restorecon to put the labels on disk.
354
355 semanage fcontext -a -t sshd_keytab_t '/srv/mysshd_content(/.*)?'
356 restorecon -R -v /srv/mysshd_content
357
358 Note: SELinux often uses regular expressions to specify labels that
359 match multiple files.
360
361 The following file types are defined for sshd:
362
363
364
365 sshd_exec_t
366
367 - Set files with the sshd_exec_t type, if you want to transition an
368 executable to the sshd_t domain.
369
370
371 Paths:
372 /usr/sbin/sshd, /usr/sbin/gsisshd
373
374
375 sshd_initrc_exec_t
376
377 - Set files with the sshd_initrc_exec_t type, if you want to transition
378 an executable to the sshd_initrc_t domain.
379
380
381
382 sshd_key_t
383
384 - Set files with the sshd_key_t type, if you want to treat the files as
385 sshd key data.
386
387
388 Paths:
389 /etc/ssh/ssh_host.*_key, /etc/ssh/ssh_host.*_key.pub,
390 /etc/ssh/primes
391
392
393 sshd_keygen_exec_t
394
395 - Set files with the sshd_keygen_exec_t type, if you want to transition
396 an executable to the sshd_keygen_t domain.
397
398
399 Paths:
400 /usr/sbin/sshd-keygen, /usr/libexec/openssh/sshd-keygen
401
402
403 sshd_keygen_unit_file_t
404
405 - Set files with the sshd_keygen_unit_file_t type, if you want to treat
406 the files as sshd keygen unit content.
407
408
409
410 sshd_keytab_t
411
412 - Set files with the sshd_keytab_t type, if you want to treat the files
413 as kerberos keytab files.
414
415
416
417 sshd_tmpfs_t
418
419 - Set files with the sshd_tmpfs_t type, if you want to store sshd files
420 on a tmpfs file system.
421
422
423
424 sshd_unit_file_t
425
426 - Set files with the sshd_unit_file_t type, if you want to treat the
427 files as sshd unit content.
428
429
430
431 sshd_var_run_t
432
433 - Set files with the sshd_var_run_t type, if you want to store the sshd
434 files under the /run or /var/run directory.
435
436
437 Paths:
438 /var/run/sshd.pid, /var/run/sshd.init.pid
439
440
441 Note: File context can be temporarily modified with the chcon command.
442 If you want to permanently change the file context you need to use the
443 semanage fcontext command. This will modify the SELinux labeling data‐
444 base. You will need to use restorecon to apply the labels.
445
446
448 semanage fcontext can also be used to manipulate default file context
449 mappings.
450
451 semanage permissive can also be used to manipulate whether or not a
452 process type is permissive.
453
454 semanage module can also be used to enable/disable/install/remove pol‐
455 icy modules.
456
457 semanage port can also be used to manipulate the port definitions
458
459 semanage boolean can also be used to manipulate the booleans
460
461
462 system-config-selinux is a GUI tool available to customize SELinux pol‐
463 icy settings.
464
465
467 This manual page was auto-generated using sepolicy manpage .
468
469
471 selinux(8), sshd(8), semanage(8), restorecon(8), chcon(1), sepolicy(8),
472 setsebool(8), ssh_keygen_selinux(8), ssh_keysign_selinux(8), sshd_key‐
473 gen_selinux(8), sshd_net_selinux(8), sshd_sandbox_selinux(8)
474
475
476
477sshd 19-12-02 sshd_selinux(8)