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