1smbd_selinux(8) SELinux Policy smbd smbd_selinux(8)
2
3
4
6 smbd_selinux - Security Enhanced Linux Policy for the smbd processes
7
9 Security-Enhanced Linux secures the smbd processes via flexible manda‐
10 tory access control.
11
12 The smbd processes execute with the smbd_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 smbd_t
19
20
21
23 The smbd_t SELinux type can be entered via the smbd_exec_t file type.
24
25 The default entrypoint paths for the smbd_t domain are the following:
26
27 /usr/sbin/smbd
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 smbd policy is very flexible allowing users to setup their smbd pro‐
37 cesses in as secure a method as possible.
38
39 The following process types are defined for smbd:
40
41 smbd_t
42
43 Note: semanage permissive -a smbd_t can be used to make the process
44 type smbd_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. smbd
51 policy is extremely flexible and has several booleans that allow you to
52 manipulate the policy and run smbd with the tightest access possible.
53
54
55
56 If you want to allow all domains to execute in fips_mode, you must turn
57 on the fips_mode boolean. Enabled by default.
58
59 setsebool -P fips_mode 1
60
61
62
63 If you want to allow confined applications to run with kerberos, you
64 must turn on the kerberos_enabled boolean. Enabled by default.
65
66 setsebool -P kerberos_enabled 1
67
68
69
70 If you want to allow samba to create new home directories (e.g. via
71 PAM), you must turn on the samba_create_home_dirs boolean. Disabled by
72 default.
73
74 setsebool -P samba_create_home_dirs 1
75
76
77
78 If you want to allow samba to act as the domain controller, add users,
79 groups and change passwords, you must turn on the samba_domain_con‐
80 troller boolean. Disabled by default.
81
82 setsebool -P samba_domain_controller 1
83
84
85
86 If you want to allow samba to share users home directories, you must
87 turn on the samba_enable_home_dirs boolean. Disabled by default.
88
89 setsebool -P samba_enable_home_dirs 1
90
91
92
93 If you want to allow samba to share any file/directory read only, you
94 must turn on the samba_export_all_ro boolean. Disabled by default.
95
96 setsebool -P samba_export_all_ro 1
97
98
99
100 If you want to allow samba to share any file/directory read/write, you
101 must turn on the samba_export_all_rw boolean. Disabled by default.
102
103 setsebool -P samba_export_all_rw 1
104
105
106
107 If you want to allow smbd to load libgfapi from gluster, you must turn
108 on the samba_load_libgfapi boolean. Disabled by default.
109
110 setsebool -P samba_load_libgfapi 1
111
112
113
114 If you want to allow samba to act as a portmapper, you must turn on the
115 samba_portmapper boolean. Disabled by default.
116
117 setsebool -P samba_portmapper 1
118
119
120
121 If you want to allow samba to run unconfined scripts, you must turn on
122 the samba_run_unconfined boolean. Disabled by default.
123
124 setsebool -P samba_run_unconfined 1
125
126
127
128 If you want to allow samba to export ntfs/fusefs volumes, you must turn
129 on the samba_share_fusefs boolean. Disabled by default.
130
131 setsebool -P samba_share_fusefs 1
132
133
134
135 If you want to allow samba to export NFS volumes, you must turn on the
136 samba_share_nfs boolean. Disabled by default.
137
138 setsebool -P samba_share_nfs 1
139
140
141
143 SELinux defines port types to represent TCP and UDP ports.
144
145 You can see the types associated with a port by using the following
146 command:
147
148 semanage port -l
149
150
151 Policy governs the access confined processes have to these ports.
152 SELinux smbd policy is very flexible allowing users to setup their smbd
153 processes in as secure a method as possible.
154
155 The following port types are defined for smbd:
156
157
158 smbd_port_t
159
160
161
162 Default Defined Ports:
163 tcp 445,137-139
164
166 The SELinux process type smbd_t can manage files labeled with the fol‐
167 lowing file types. The paths listed are the default paths for these
168 file types. Note the processes UID still need to have DAC permissions.
169
170 auth_cache_t
171
172 /var/cache/coolkey(/.*)?
173
174 cluster_conf_t
175
176 /etc/cluster(/.*)?
177
178 cluster_var_lib_t
179
180 /var/lib/pcsd(/.*)?
181 /var/lib/cluster(/.*)?
182 /var/lib/openais(/.*)?
183 /var/lib/pengine(/.*)?
184 /var/lib/corosync(/.*)?
185 /usr/lib/heartbeat(/.*)?
186 /var/lib/heartbeat(/.*)?
187 /var/lib/pacemaker(/.*)?
188
189 cluster_var_run_t
190
191 /var/run/crm(/.*)?
192 /var/run/cman_.*
193 /var/run/rsctmp(/.*)?
194 /var/run/aisexec.*
195 /var/run/heartbeat(/.*)?
196 /var/run/pcsd-ruby.socket
197 /var/run/corosync-qnetd(/.*)?
198 /var/run/corosync-qdevice(/.*)?
199 /var/run/corosync.pid
200 /var/run/cpglockd.pid
201 /var/run/rgmanager.pid
202 /var/run/cluster/rgmanager.sk
203
204 ctdbd_var_lib_t
205
206 /var/lib/ctdb(/.*)?
207 /var/lib/ctdbd(/.*)?
208
209 faillog_t
210
211 /var/log/btmp.*
212 /var/log/faillog.*
213 /var/log/tallylog.*
214 /var/run/faillock(/.*)?
215
216 fusefs_t
217
218 /var/run/user/[^/]*/gvfs
219
220 glusterd_var_lib_t
221
222 /var/lib/glusterd(/.*)?
223
224 glusterd_var_run_t
225
226 /var/run/gluster(/.*)?
227 /var/run/glusterd.*
228 /var/run/glusterd.*
229 /var/run/glusterd(/.*)?
230
231 httpd_user_content_t
232
233 /home/[^/]+/((www)|(web)|(public_html))(/.+)?
234
235 initrc_var_run_t
236
237 /var/run/utmp
238 /var/run/random-seed
239 /var/run/runlevel.dir
240 /var/run/setmixer_flag
241
242 krb5_host_rcache_t
243
244 /var/tmp/krb5_0.rcache2
245 /var/cache/krb5rcache(/.*)?
246 /var/tmp/nfs_0
247 /var/tmp/DNS_25
248 /var/tmp/host_0
249 /var/tmp/imap_0
250 /var/tmp/HTTP_23
251 /var/tmp/HTTP_48
252 /var/tmp/ldap_55
253 /var/tmp/ldap_487
254 /var/tmp/ldapmap1_0
255
256 nfs_t
257
258
259 nmbd_var_run_t
260
261 /var/run/nmbd(/.*)?
262 /var/run/samba/nmbd(/.*)?
263 /var/run/samba/nmbd.pid
264 /var/run/samba/messages.tdb
265 /var/run/samba/namelist.debug
266 /var/run/samba/unexpected.tdb
267
268 non_security_file_type
269
270
271 noxattrfs
272
273 all files on file systems which do not support extended attributes
274
275 root_t
276
277 /sysroot/ostree/deploy/.*-atomic/deploy(/.*)?
278 /
279 /initrd
280
281 samba_log_t
282
283 /var/log/samba(/.*)?
284
285 samba_secrets_t
286
287 /etc/samba/smbpasswd
288 /etc/samba/passdb.tdb
289 /etc/samba/MACHINE.SID
290 /etc/samba/secrets.tdb
291
292 samba_share_t
293
294 use this label for random content that will be shared using samba
295
296 samba_spool_t
297
298 /var/spool/samba(/.*)?
299
300 security_t
301
302 /selinux
303
304 smbd_tmp_t
305
306
307 smbd_tmpfs_t
308
309
310 smbd_var_run_t
311
312 /var/run/samba(/.*)?
313 /var/run/samba/smbd.pid
314 /var/run/samba/brlock.tdb
315 /var/run/samba/locking.tdb
316 /var/run/samba/gencache.tdb
317 /var/run/samba/sessionid.tdb
318 /var/run/samba/share_info.tdb
319 /var/run/samba/connections.tdb
320
321 user_home_type
322
323 all user home files
324
325 wtmp_t
326
327 /var/log/wtmp.*
328
329
331 SELinux requires files to have an extended attribute to define the file
332 type.
333
334 You can see the context of a file using the -Z option to ls
335
336 Policy governs the access confined processes have to these files.
337 SELinux smbd policy is very flexible allowing users to setup their smbd
338 processes in as secure a method as possible.
339
340 EQUIVALENCE DIRECTORIES
341
342
343 smbd policy stores data with multiple different file context types un‐
344 der the /var/run/samba directory. If you would like to store the data
345 in a different directory you can use the semanage command to create an
346 equivalence mapping. If you wanted to store this data under the /srv
347 directory you would execute the following command:
348
349 semanage fcontext -a -e /var/run/samba /srv/samba
350 restorecon -R -v /srv/samba
351
352 STANDARD FILE CONTEXT
353
354 SELinux defines the file context types for the smbd, if you wanted to
355 store files with these types in a diffent paths, you need to execute
356 the semanage command to specify alternate labeling and then use re‐
357 storecon to put the labels on disk.
358
359 semanage fcontext -a -t smbd_var_run_t '/srv/mysmbd_content(/.*)?'
360 restorecon -R -v /srv/mysmbd_content
361
362 Note: SELinux often uses regular expressions to specify labels that
363 match multiple files.
364
365 The following file types are defined for smbd:
366
367
368
369 smbd_exec_t
370
371 - Set files with the smbd_exec_t type, if you want to transition an ex‐
372 ecutable to the smbd_t domain.
373
374
375
376 smbd_keytab_t
377
378 - Set files with the smbd_keytab_t type, if you want to treat the files
379 as kerberos keytab files.
380
381
382
383 smbd_tmp_t
384
385 - Set files with the smbd_tmp_t type, if you want to store smbd tempo‐
386 rary files in the /tmp directories.
387
388
389
390 smbd_tmpfs_t
391
392 - Set files with the smbd_tmpfs_t type, if you want to store smbd files
393 on a tmpfs file system.
394
395
396
397 smbd_var_run_t
398
399 - Set files with the smbd_var_run_t type, if you want to store the smbd
400 files under the /run or /var/run directory.
401
402
403 Paths:
404 /var/run/samba(/.*)?, /var/run/samba/smbd.pid, /var/run/samba/br‐
405 lock.tdb, /var/run/samba/locking.tdb, /var/run/samba/gencache.tdb,
406 /var/run/samba/sessionid.tdb, /var/run/samba/share_info.tdb,
407 /var/run/samba/connections.tdb
408
409
410 Note: File context can be temporarily modified with the chcon command.
411 If you want to permanently change the file context you need to use the
412 semanage fcontext command. This will modify the SELinux labeling data‐
413 base. You will need to use restorecon to apply the labels.
414
415
417 If you want to share files with multiple domains (Apache, FTP, rsync,
418 Samba), you can set a file context of public_content_t and public_con‐
419 tent_rw_t. These context allow any of the above domains to read the
420 content. If you want a particular domain to write to the public_con‐
421 tent_rw_t domain, you must set the appropriate boolean.
422
423 Allow smbd servers to read the /var/smbd directory by adding the pub‐
424 lic_content_t file type to the directory and by restoring the file
425 type.
426
427 semanage fcontext -a -t public_content_t "/var/smbd(/.*)?"
428 restorecon -F -R -v /var/smbd
429
430 Allow smbd servers to read and write /var/smbd/incoming by adding the
431 public_content_rw_t type to the directory and by restoring the file
432 type. You also need to turn on the smbd_anon_write boolean.
433
434 semanage fcontext -a -t public_content_rw_t "/var/smbd/incoming(/.*)?"
435 restorecon -F -R -v /var/smbd/incoming
436 setsebool -P smbd_anon_write 1
437
438
439 If you want to allow samba to modify public files used for public file
440 transfer services. Files/Directories must be labeled public_con‐
441 tent_rw_t., you must turn on the smbd_anon_write boolean.
442
443 setsebool -P smbd_anon_write 1
444
445
447 semanage fcontext can also be used to manipulate default file context
448 mappings.
449
450 semanage permissive can also be used to manipulate whether or not a
451 process type is permissive.
452
453 semanage module can also be used to enable/disable/install/remove pol‐
454 icy modules.
455
456 semanage port can also be used to manipulate the port definitions
457
458 semanage boolean can also be used to manipulate the booleans
459
460
461 system-config-selinux is a GUI tool available to customize SELinux pol‐
462 icy settings.
463
464
466 This manual page was auto-generated using sepolicy manpage .
467
468
470 selinux(8), smbd(8), semanage(8), restorecon(8), chcon(1), sepolicy(8),
471 setsebool(8)
472
473
474
475smbd 21-11-19 smbd_selinux(8)