Chris PeBenito bf080a
.TH  "samba_selinux"  "8"  "17 Jan 2005" "dwalsh@redhat.com" "Samba Selinux Policy documentation"
Chris PeBenito bf080a
.SH "NAME"
Chris PeBenito bf080a
samba_selinux \- Security Enhanced Linux Policy for Samba
Chris PeBenito bf080a
.SH "DESCRIPTION"
Chris PeBenito bf080a
Chris PeBenito bf080a
Security-Enhanced Linux secures the Samba server via flexible mandatory access
Chris PeBenito bf080a
control.  
Chris PeBenito bf080a
.SH FILE_CONTEXTS
Chris PeBenito bf080a
SELinux requires files to have an extended attribute to define the file type. 
Chris PeBenito bf080a
Policy governs the access daemons have to these files. 
Chris PeBenito bf080a
If you want to share files other than home directories, those files must be 
Chris PeBenito bf080a
labeled samba_share_t.  So if you created a special directory /var/eng, you 
Chris PeBenito bf080a
would need to label the directory with the chcon tool.
Chris PeBenito bf080a
.TP
Chris PeBenito bf080a
chcon -t samba_share_t /var/eng
Chris PeBenito bf080a
.TP
Chris PeBenito 60c395
To make this change permanent (survive a relabel), use the semanage command to add the change to file context configuration:
Chris PeBenito 60c395
.TP
Chris PeBenito 60c395
semanage fcontext -a -t samba_share_t "/var/eng(/.*)?"
Chris PeBenito 60c395
.TP
Chris PeBenito 60c395
This command adds the following entry to /etc/selinux/POLICYTYPE/contexts/files/file_contexts.local:
Chris PeBenito bf080a
.TP
Chris PeBenito da4332
/var/eng(/.*)? system_u:object_r:samba_share_t:s0
Chris PeBenito 60c395
.TP
Chris PeBenito 60c395
Run the restorecon command to apply the changes:
Chris PeBenito 60c395
.TP
Chris PeBenito 60c395
restorecon -R -v /var/eng/
Chris PeBenito bf080a
Chris PeBenito bf080a
.SH SHARING FILES
Chris PeBenito bf080a
If you want to share files with multiple domains (Apache, FTP, rsync, Samba), you can set a file context of public_content_t and public_content_rw_t.  These context allow any of the above domains to read the content.  If you want a particular domain to write to the public_content_rw_t domain, you must set the appropriate boolean.  allow_DOMAIN_anon_write.  So for samba you would execute:
Chris PeBenito bf080a
Chris PeBenito 724925
setsebool -P allow_smbd_anon_write=1
Chris PeBenito bf080a
Chris PeBenito bf080a
.SH BOOLEANS
Chris PeBenito bf080a
.br 
Chris PeBenito bf080a
SELinux policy is customizable based on least access required.  So by 
Chris PeBenito bf080a
default SElinux policy turns off SELinux sharing of home directories and 
Chris PeBenito bf080a
the use of Samba shares from a remote machine as a home directory.
Chris PeBenito bf080a
.TP
Chris PeBenito bf080a
If you are setting up this machine as a Samba server and wish to share the home directories, you need to set the samba_enable_home_dirs boolean. 
Chris PeBenito bf080a
.br
Chris PeBenito bf080a
Chris PeBenito bf080a
setsebool -P samba_enable_home_dirs 1
Chris PeBenito bf080a
.TP
Chris PeBenito bf080a
If you want to use a remote Samba server for the home directories on this machine, you must set the use_samba_home_dirs boolean.
Chris PeBenito bf080a
.br 
Chris PeBenito bf080a
Chris PeBenito bf080a
setsebool -P use_samba_home_dirs 1
Chris PeBenito bf080a
.TP
Chris PeBenito f4e2b1
system-config-selinux is a GUI tool available to customize SELinux policy settings.
Chris PeBenito bf080a
Chris PeBenito bf080a
.SH AUTHOR	
Chris PeBenito bf080a
This manual page was written by Dan Walsh <dwalsh@redhat.com>.
Chris PeBenito bf080a
Chris PeBenito bf080a
.SH "SEE ALSO"
Chris PeBenito da4332
selinux(8), samba(7), chcon(1), setsebool(8), semanage(8)