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/[0-9]+/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 /var/run/user
281 /tmp/hsperfdata_root
282 /var/tmp/hsperfdata_root
283 /home/[^/]+/tmp
284 /home/[^/]+/.tmp
285 /var/run/user/[0-9]+
286 /tmp/gconfd-[^/]+
287
288 user_tmp_type
289
290 all user tmp files
291
292 var_auth_t
293
294 /var/ace(/.*)?
295 /var/rsa(/.*)?
296 /var/lib/abl(/.*)?
297 /var/lib/rsa(/.*)?
298 /var/lib/pam_ssh(/.*)?
299 /var/lib/pam_shield(/.*)?
300 /var/opt/quest/vas/vasd(/.*)?
301 /var/lib/google-authenticator(/.*)?
302
303 wtmp_t
304
305 /var/log/wtmp.*
306
307
309 SELinux requires files to have an extended attribute to define the file
310 type.
311
312 You can see the context of a file using the -Z option to ls
313
314 Policy governs the access confined processes have to these files.
315 SELinux sshd policy is very flexible allowing users to setup their sshd
316 processes in as secure a method as possible.
317
318 STANDARD FILE CONTEXT
319
320 SELinux defines the file context types for the sshd, if you wanted to
321 store files with these types in a diffent paths, you need to execute
322 the semanage command to specify alternate labeling and then use re‐
323 storecon to put the labels on disk.
324
325 semanage fcontext -a -t sshd_keytab_t '/srv/mysshd_content(/.*)?'
326 restorecon -R -v /srv/mysshd_content
327
328 Note: SELinux often uses regular expressions to specify labels that
329 match multiple files.
330
331 The following file types are defined for sshd:
332
333
334
335 sshd_exec_t
336
337 - Set files with the sshd_exec_t type, if you want to transition an ex‐
338 ecutable to the sshd_t domain.
339
340
341 Paths:
342 /usr/sbin/sshd, /usr/sbin/gsisshd
343
344
345 sshd_initrc_exec_t
346
347 - Set files with the sshd_initrc_exec_t type, if you want to transition
348 an executable to the sshd_initrc_t domain.
349
350
351
352 sshd_key_t
353
354 - Set files with the sshd_key_t type, if you want to treat the files as
355 sshd key data.
356
357
358 Paths:
359 /etc/ssh/ssh_host.*_key, /etc/ssh/ssh_host.*_key.pub,
360 /etc/ssh/primes
361
362
363 sshd_keygen_exec_t
364
365 - Set files with the sshd_keygen_exec_t type, if you want to transition
366 an executable to the sshd_keygen_t domain.
367
368
369 Paths:
370 /usr/sbin/sshd-keygen, /usr/libexec/openssh/sshd-keygen
371
372
373 sshd_keygen_unit_file_t
374
375 - Set files with the sshd_keygen_unit_file_t type, if you want to treat
376 the files as sshd keygen unit content.
377
378
379
380 sshd_keytab_t
381
382 - Set files with the sshd_keytab_t type, if you want to treat the files
383 as kerberos keytab files.
384
385
386
387 sshd_tmpfs_t
388
389 - Set files with the sshd_tmpfs_t type, if you want to store sshd files
390 on a tmpfs file system.
391
392
393
394 sshd_unit_file_t
395
396 - Set files with the sshd_unit_file_t type, if you want to treat the
397 files as sshd unit content.
398
399
400
401 sshd_var_run_t
402
403 - Set files with the sshd_var_run_t type, if you want to store the sshd
404 files under the /run or /var/run directory.
405
406
407 Paths:
408 /var/run/sshd.pid, /var/run/sshd.init.pid
409
410
411 Note: File context can be temporarily modified with the chcon command.
412 If you want to permanently change the file context you need to use the
413 semanage fcontext command. This will modify the SELinux labeling data‐
414 base. You will need to use restorecon to apply the labels.
415
416
418 semanage fcontext can also be used to manipulate default file context
419 mappings.
420
421 semanage permissive can also be used to manipulate whether or not a
422 process type is permissive.
423
424 semanage module can also be used to enable/disable/install/remove pol‐
425 icy modules.
426
427 semanage port can also be used to manipulate the port definitions
428
429 semanage boolean can also be used to manipulate the booleans
430
431
432 system-config-selinux is a GUI tool available to customize SELinux pol‐
433 icy settings.
434
435
437 This manual page was auto-generated using sepolicy manpage .
438
439
441 selinux(8), sshd(8), semanage(8), restorecon(8), chcon(1), sepolicy(8),
442 setsebool(8), ssh_keygen_selinux(8), ssh_keysign_selinux(8), sshd_key‐
443 gen_selinux(8), sshd_net_selinux(8), sshd_sandbox_selinux(8)
444
445
446
447sshd 23-02-03 sshd_selinux(8)