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. Disabled 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/corosync-qnetd(/.*)?
197 /var/run/corosync-qdevice(/.*)?
198 /var/run/corosync.pid
199 /var/run/cpglockd.pid
200 /var/run/rgmanager.pid
201 /var/run/cluster/rgmanager.sk
202
203 ctdbd_var_lib_t
204
205 /var/lib/ctdb(/.*)?
206 /var/lib/ctdbd(/.*)?
207
208 faillog_t
209
210 /var/log/btmp.*
211 /var/log/faillog.*
212 /var/log/tallylog.*
213 /var/run/faillock(/.*)?
214
215 fusefs_t
216
217 /var/run/user/[^/]*/gvfs
218
219 glusterd_var_lib_t
220
221 /var/lib/glusterd(/.*)?
222
223 glusterd_var_run_t
224
225 /var/run/gluster(/.*)?
226 /var/run/glusterd.*
227 /var/run/glusterd.*
228 /var/run/glusterd(/.*)?
229
230 httpd_user_content_t
231
232 /home/[^/]+/((www)|(web)|(public_html))(/.+)?
233
234 initrc_var_run_t
235
236 /var/run/utmp
237 /var/run/random-seed
238 /var/run/runlevel.dir
239 /var/run/setmixer_flag
240
241 nfs_t
242
243
244 nmbd_var_run_t
245
246 /var/run/nmbd(/.*)?
247 /var/run/samba/nmbd(/.*)?
248 /var/run/samba/nmbd.pid
249 /var/run/samba/messages.tdb
250 /var/run/samba/namelist.debug
251 /var/run/samba/unexpected.tdb
252
253 non_security_file_type
254
255
256 noxattrfs
257
258 all files on file systems which do not support extended attributes
259
260 root_t
261
262 /sysroot/ostree/deploy/.*-atomic/deploy(/.*)?
263 /
264 /initrd
265
266 samba_log_t
267
268 /var/log/samba(/.*)?
269
270 samba_secrets_t
271
272 /etc/samba/smbpasswd
273 /etc/samba/passdb.tdb
274 /etc/samba/MACHINE.SID
275 /etc/samba/secrets.tdb
276
277 samba_share_t
278
279 use this label for random content that will be shared using samba
280
281 samba_spool_t
282
283 /var/spool/samba(/.*)?
284
285 security_t
286
287 /selinux
288
289 smbd_tmpfs_t
290
291
292 smbd_var_run_t
293
294 /var/run/samba(/.*)?
295 /var/run/samba/smbd.pid
296 /var/run/samba/brlock.tdb
297 /var/run/samba/locking.tdb
298 /var/run/samba/gencache.tdb
299 /var/run/samba/sessionid.tdb
300 /var/run/samba/share_info.tdb
301 /var/run/samba/connections.tdb
302
303 user_home_type
304
305 all user home files
306
307 wtmp_t
308
309 /var/log/wtmp.*
310
311
313 SELinux requires files to have an extended attribute to define the file
314 type.
315
316 You can see the context of a file using the -Z option to ls
317
318 Policy governs the access confined processes have to these files.
319 SELinux smbd policy is very flexible allowing users to setup their smbd
320 processes in as secure a method as possible.
321
322 EQUIVALENCE DIRECTORIES
323
324
325 smbd policy stores data with multiple different file context types
326 under the /var/run/samba directory. If you would like to store the
327 data in a different directory you can use the semanage command to cre‐
328 ate an equivalence mapping. If you wanted to store this data under the
329 /srv directory you would execute the following command:
330
331 semanage fcontext -a -e /var/run/samba /srv/samba
332 restorecon -R -v /srv/samba
333
334 STANDARD FILE CONTEXT
335
336 SELinux defines the file context types for the smbd, if you wanted to
337 store files with these types in a diffent paths, you need to execute
338 the semanage command to sepecify alternate labeling and then use
339 restorecon to put the labels on disk.
340
341 semanage fcontext -a -t smbd_var_run_t '/srv/mysmbd_content(/.*)?'
342 restorecon -R -v /srv/mysmbd_content
343
344 Note: SELinux often uses regular expressions to specify labels that
345 match multiple files.
346
347 The following file types are defined for smbd:
348
349
350
351 smbd_exec_t
352
353 - Set files with the smbd_exec_t type, if you want to transition an
354 executable to the smbd_t domain.
355
356
357
358 smbd_keytab_t
359
360 - Set files with the smbd_keytab_t type, if you want to treat the files
361 as kerberos keytab files.
362
363
364
365 smbd_tmp_t
366
367 - Set files with the smbd_tmp_t type, if you want to store smbd tempo‐
368 rary files in the /tmp directories.
369
370
371
372 smbd_tmpfs_t
373
374 - Set files with the smbd_tmpfs_t type, if you want to store smbd files
375 on a tmpfs file system.
376
377
378
379 smbd_var_run_t
380
381 - Set files with the smbd_var_run_t type, if you want to store the smbd
382 files under the /run or /var/run directory.
383
384
385 Paths:
386 /var/run/samba(/.*)?, /var/run/samba/smbd.pid,
387 /var/run/samba/brlock.tdb, /var/run/samba/locking.tdb,
388 /var/run/samba/gencache.tdb, /var/run/samba/sessionid.tdb,
389 /var/run/samba/share_info.tdb, /var/run/samba/connections.tdb
390
391
392 Note: File context can be temporarily modified with the chcon command.
393 If you want to permanently change the file context you need to use the
394 semanage fcontext command. This will modify the SELinux labeling data‐
395 base. You will need to use restorecon to apply the labels.
396
397
399 If you want to share files with multiple domains (Apache, FTP, rsync,
400 Samba), you can set a file context of public_content_t and public_con‐
401 tent_rw_t. These context allow any of the above domains to read the
402 content. If you want a particular domain to write to the public_con‐
403 tent_rw_t domain, you must set the appropriate boolean.
404
405 Allow smbd servers to read the /var/smbd directory by adding the pub‐
406 lic_content_t file type to the directory and by restoring the file
407 type.
408
409 semanage fcontext -a -t public_content_t "/var/smbd(/.*)?"
410 restorecon -F -R -v /var/smbd
411
412 Allow smbd servers to read and write /var/smbd/incoming by adding the
413 public_content_rw_t type to the directory and by restoring the file
414 type. You also need to turn on the smbd_anon_write boolean.
415
416 semanage fcontext -a -t public_content_rw_t "/var/smbd/incoming(/.*)?"
417 restorecon -F -R -v /var/smbd/incoming
418 setsebool -P smbd_anon_write 1
419
420
421 If you want to allow samba to modify public files used for public file
422 transfer services. Files/Directories must be labeled public_con‐
423 tent_rw_t., you must turn on the smbd_anon_write boolean.
424
425 setsebool -P smbd_anon_write 1
426
427
429 semanage fcontext can also be used to manipulate default file context
430 mappings.
431
432 semanage permissive can also be used to manipulate whether or not a
433 process type is permissive.
434
435 semanage module can also be used to enable/disable/install/remove pol‐
436 icy modules.
437
438 semanage port can also be used to manipulate the port definitions
439
440 semanage boolean can also be used to manipulate the booleans
441
442
443 system-config-selinux is a GUI tool available to customize SELinux pol‐
444 icy settings.
445
446
448 This manual page was auto-generated using sepolicy manpage .
449
450
452 selinux(8), smbd(8), semanage(8), restorecon(8), chcon(1), sepolicy(8),
453 setsebool(8)
454
455
456
457smbd 20-05-05 smbd_selinux(8)