I've built a simple File Server with Samba and Netatalk running on CentOS 7.2. Everything is working as expected except for SELinux that's denying Samba to authenticate due to a policy of denying writes on /var/tmp
for the Kerberos Ticket.
This is cleary a SELinux problem since everything works as expected if SELinux is disabled and those entries appeared on audit.log
when trying to mount the SMB with SELinux on permissive mode:
type=AVC msg=audit(1466917992.944:493): avc: denied { write } for pid=3902 comm="smbd" name="DALARAN-044_0" dev="dm-0" ino=50452330 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=file
type=AVC msg=audit(1466917992.944:493): avc: denied { open } for pid=3902 comm="smbd" path="/var/tmp/DALARAN-044_0" dev="dm-0" ino=50452330 scontext=system_u:system_r:smbd_t:s0 tcontext=system_u:object_r:tmp_t:s0 tclass=file
type=SYSCALL msg=audit(1466917992.944:493): arch=c000003e syscall=2 success=yes exit=39 a0=7fa840d08290 a1=2 a2=180 a3=7ffc93307cb0 items=0 ppid=3578 pid=3902 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="smbd" exe="/usr/sbin/smbd" subj=system_u:system_r:smbd_t:s0 key=(null)
I checked online but I was unable to find a solution. Already have some SELinux bits set like those:
getsebool -a | grep -iP "samba|smb|nmb|kerberos|krb|tmp"
gssd_read_tmp --> on
httpd_tmp_exec --> off
kerberos_enabled --> on
samba_create_home_dirs --> off
samba_domain_controller --> off
samba_enable_home_dirs --> on
samba_export_all_ro --> off
samba_export_all_rw --> off
samba_load_libgfapi --> off
samba_portmapper --> off
samba_run_unconfined --> off
samba_share_fusefs --> off
samba_share_nfs --> off
sanlock_use_samba --> off
smbd_anon_write --> off
tmpreaper_use_nfs --> off
tmpreaper_use_samba --> off
use_samba_home_dirs --> off
virt_sandbox_use_samba --> off
virt_use_samba --> off
So something is missing, and I would like to keep SELinux enabled.
Thanks,
Additional info:
File: /etc/krb5.conf
[logging]
default = FILE:/var/log/krb5libs.log
kdc = FILE:/var/log/krb5kdc.log
admin_server = FILE:/var/log/kadmind.log
[libdefaults]
dns_lookup_realm = false
ticket_lifetime = 24h
renew_lifetime = 7d
forwardable = true
rdns = false
# default_realm = EXAMPLE.COM
default_ccache_name = KEYRING:persistent:%{uid}
[realms]
# EXAMPLE.COM = {
# kdc = kerberos.example.com
# admin_server = kerberos.example.com
# }
[domain_realm]
# .example.com = EXAMPLE.COM
# example.com = EXAMPLE.COM
File: /etc/sssd/sssd.conf
[sssd]
domains = if.ufrj.br
config_file_version = 2
services = nss, pam
[domain/if.ufrj.br]
ad_domain = if.ufrj.br
krb5_realm = IF.UFRJ.BR
realmd_tags = manages-system joined-with-samba
cache_credentials = True
id_provider = ad
krb5_store_password_if_offline = True
default_shell = /bin/bash
ldap_id_mapping = True
#use_fully_qualified_names = True
fallback_homedir = /home/%u
access_provider = ad
File: /etc/samba/smb.conf
[global]
server string = Samba Server Version %v
workgroup = IF
log file = /var/log/samba/log.%m
max log size = 50
log level = 3
security = ads
realm = IF.UFRJ.BR
kerberos method = system keytab
load printers = no
cups options = raw
printing = bsd
printcap name = /dev/null
[homes]
comment = Home Directories
browseable = no
writable = yes
vfs objects = catia fruit streams_xattr
fruit:resource = file
fruit:metadata = netatalk
fruit:locking = netatalk
fruit:encoding = native