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. Disabled 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/.google_authenticator
134 /root/.google_authenticator~
135 /home/[^/]+/.yubico(/.*)?
136 /home/[^/]+/.google_authenticator
137 /home/[^/]+/.google_authenticator~
138
139 cgroup_t
140
141 /sys/fs/cgroup
142
143 cifs_t
144
145
146 cluster_conf_t
147
148 /etc/cluster(/.*)?
149
150 cluster_var_lib_t
151
152 /var/lib/pcsd(/.*)?
153 /var/lib/cluster(/.*)?
154 /var/lib/openais(/.*)?
155 /var/lib/pengine(/.*)?
156 /var/lib/corosync(/.*)?
157 /usr/lib/heartbeat(/.*)?
158 /var/lib/heartbeat(/.*)?
159 /var/lib/pacemaker(/.*)?
160
161 cluster_var_run_t
162
163 /var/run/crm(/.*)?
164 /var/run/cman_.*
165 /var/run/rsctmp(/.*)?
166 /var/run/aisexec.*
167 /var/run/heartbeat(/.*)?
168 /var/run/corosync-qnetd(/.*)?
169 /var/run/corosync-qdevice(/.*)?
170 /var/run/corosync.pid
171 /var/run/cpglockd.pid
172 /var/run/rgmanager.pid
173 /var/run/cluster/rgmanager.sk
174
175 condor_var_lib_t
176
177 /var/lib/condor(/.*)?
178 /var/lib/condor/spool(/.*)?
179 /var/lib/condor/execute(/.*)?
180
181 ecryptfs_t
182
183 /home/[^/]+/.Private(/.*)?
184 /home/[^/]+/.ecryptfs(/.*)?
185
186 faillog_t
187
188 /var/log/btmp.*
189 /var/log/faillog.*
190 /var/log/tallylog.*
191 /var/run/faillock(/.*)?
192
193 fusefs_t
194
195 /var/run/user/[^/]*/gvfs
196
197 gitosis_var_lib_t
198
199 /srv/lib/gitosis(/.*)?
200 /var/lib/gitosis(/.*)?
201 /var/lib/gitolite(3)?(/.*)?
202
203 initrc_var_run_t
204
205 /var/run/utmp
206 /var/run/random-seed
207 /var/run/runlevel.dir
208 /var/run/setmixer_flag
209
210 kdbusfs_t
211
212
213 lastlog_t
214
215 /var/log/lastlog.*
216
217 nfs_t
218
219
220 pam_var_run_t
221
222 /var/(db|adm)/sudo(/.*)?
223 /var/lib/sudo(/.*)?
224 /var/run/sudo(/.*)?
225 /var/run/motd.d(/.*)?
226 /var/run/pam_ssh(/.*)?
227 /var/run/sepermit(/.*)?
228 /var/run/pam_mount(/.*)?
229 /var/run/pam_timestamp(/.*)?
230 /var/run/motd
231
232 root_t
233
234 /sysroot/ostree/deploy/.*-atomic/deploy(/.*)?
235 /
236 /initrd
237
238 security_t
239
240 /selinux
241
242 sshd_var_run_t
243
244 /var/run/sshd.pid
245 /var/run/sshd.init.pid
246
247 systemd_passwd_var_run_t
248
249 /var/run/systemd/ask-password(/.*)?
250 /var/run/systemd/ask-password-block(/.*)?
251
252 var_auth_t
253
254 /var/ace(/.*)?
255 /var/rsa(/.*)?
256 /var/lib/abl(/.*)?
257 /var/lib/rsa(/.*)?
258 /var/lib/pam_ssh(/.*)?
259 /var/lib/pam_shield(/.*)?
260 /var/opt/quest/vas/vasd(/.*)?
261 /var/lib/google-authenticator(/.*)?
262
263 wtmp_t
264
265 /var/log/wtmp.*
266
267
269 SELinux requires files to have an extended attribute to define the file
270 type.
271
272 You can see the context of a file using the -Z option to ls
273
274 Policy governs the access confined processes have to these files.
275 SELinux sshd policy is very flexible allowing users to setup their sshd
276 processes in as secure a method as possible.
277
278 STANDARD FILE CONTEXT
279
280 SELinux defines the file context types for the sshd, if you wanted to
281 store files with these types in a diffent paths, you need to execute
282 the semanage command to sepecify alternate labeling and then use
283 restorecon to put the labels on disk.
284
285 semanage fcontext -a -t sshd_keytab_t '/srv/mysshd_content(/.*)?'
286 restorecon -R -v /srv/mysshd_content
287
288 Note: SELinux often uses regular expressions to specify labels that
289 match multiple files.
290
291 The following file types are defined for sshd:
292
293
294
295 sshd_exec_t
296
297 - Set files with the sshd_exec_t type, if you want to transition an
298 executable to the sshd_t domain.
299
300
301 Paths:
302 /usr/sbin/sshd, /usr/sbin/gsisshd
303
304
305 sshd_initrc_exec_t
306
307 - Set files with the sshd_initrc_exec_t type, if you want to transition
308 an executable to the sshd_initrc_t domain.
309
310
311
312 sshd_key_t
313
314 - Set files with the sshd_key_t type, if you want to treat the files as
315 sshd key data.
316
317
318 Paths:
319 /etc/ssh/ssh_host.*_key, /etc/ssh/ssh_host.*_key.pub,
320 /etc/ssh/primes
321
322
323 sshd_keygen_exec_t
324
325 - Set files with the sshd_keygen_exec_t type, if you want to transition
326 an executable to the sshd_keygen_t domain.
327
328
329 Paths:
330 /usr/sbin/sshd-keygen, /usr/libexec/openssh/sshd-keygen
331
332
333 sshd_keygen_unit_file_t
334
335 - Set files with the sshd_keygen_unit_file_t type, if you want to treat
336 the files as sshd keygen unit content.
337
338
339
340 sshd_keytab_t
341
342 - Set files with the sshd_keytab_t type, if you want to treat the files
343 as kerberos keytab files.
344
345
346
347 sshd_tmpfs_t
348
349 - Set files with the sshd_tmpfs_t type, if you want to store sshd files
350 on a tmpfs file system.
351
352
353
354 sshd_unit_file_t
355
356 - Set files with the sshd_unit_file_t type, if you want to treat the
357 files as sshd unit content.
358
359
360
361 sshd_var_run_t
362
363 - Set files with the sshd_var_run_t type, if you want to store the sshd
364 files under the /run or /var/run directory.
365
366
367 Paths:
368 /var/run/sshd.pid, /var/run/sshd.init.pid
369
370
371 Note: File context can be temporarily modified with the chcon command.
372 If you want to permanently change the file context you need to use the
373 semanage fcontext command. This will modify the SELinux labeling data‐
374 base. You will need to use restorecon to apply the labels.
375
376
378 semanage fcontext can also be used to manipulate default file context
379 mappings.
380
381 semanage permissive can also be used to manipulate whether or not a
382 process type is permissive.
383
384 semanage module can also be used to enable/disable/install/remove pol‐
385 icy modules.
386
387 semanage port can also be used to manipulate the port definitions
388
389 semanage boolean can also be used to manipulate the booleans
390
391
392 system-config-selinux is a GUI tool available to customize SELinux pol‐
393 icy settings.
394
395
397 This manual page was auto-generated using sepolicy manpage .
398
399
401 selinux(8), sshd(8), semanage(8), restorecon(8), chcon(1), sepolicy(8),
402 setsebool(8), ssh_keygen_selinux(8), ssh_keysign_selinux(8), sshd_key‐
403 gen_selinux(8), sshd_net_selinux(8), sshd_sandbox_selinux(8)
404
405
406
407sshd 20-05-05 sshd_selinux(8)