LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora
User Name
Password
Fedora This forum is for the discussion of the Fedora Project.

Notices


Reply
  Search this Thread
Old 05-03-2019, 05:04 PM   #1
Au_Squirrel
Member
 
Registered: Nov 2005
Location: Brisbane AU
Distribution: FC29
Posts: 52

Rep: Reputation: 17
Selinux Permissions for samba DC with bind backend on Fedora 29


Hi All,
Just posting a script I wrote to fix some reboot errors on my samba DC with bind backends. The symptoms were that bind would not start with selinux enabled. Log errors were:
Code:
May 04 05:09:15 example.com systemd[1]: Failed to start Berkeley Internet Name Domain (DNS).
May 04 05:09:15 example.com named[934]: exiting (due to fatal error)
May 04 05:09:15 example.com named[934]: loading configuration: failure
May 04 05:09:15 example.com named[934]: DLZ driver failed to load.
May 04 05:09:15 example.com systemd[1]: named.service: Failed with result 'exit-code'.
May 04 05:09:15 example.com named[934]: SDLZ driver failed to load.
May 04 05:09:15 example.com systemd[1]: named.service: Control process exited, code=exited status=1
May 04 05:09:15 example.com named[934]: dlz_dlopen of 'AD DNS Zone' failed
May 04 05:09:15 example.com named[934]: samba_dlz: Failed to connect to Failed to connect to /var/lib/samba/bind-dns/dns/sam.ldb: Unable to open tdb '/var/lib/samba/bind-dns/dns/sam.ldb': Permission denied: Operations error
When you disabled selinux, the system worked.

The follow script was based on the https://wiki.samba.org/index.php/BIN...ux_Integration policy modifications and updated for the Fedora 29 samba and samba-dc package installations.

Code:
#!/bin/bash
# A script to fix the samba persmission for Fedora 29.


chown named:named /var/lib/samba/bind-dns/dns
chgrp named /var/lib/samba/private/dns.keytab
chmod g+r /var/lib/samba/private/dns.keytab
chmod 775 /var/lib/samba/bind-dns/dns/

chcon -t named_conf_t /var/lib/samba/private/dns.keytab
chcon -t named_conf_t /var/lib/samba/bind-dns/named.conf.update
chcon -t named_var_run_t /var/lib/samba/bind-dns/dns
chcon -t named_var_run_t /var/lib/samba/bind-dns/dns/*
chcon -t named_var_run_t /var/lib/samba/bind-dns/dns/sam.ldb.d/*

semanage fcontext -a -t named_conf_t /var/lib/samba/private/dns.keytab
semanage fcontext -a -t named_conf_t /var/lib/samba/bind-dns/named.conf
semanage fcontext -a -t named_conf_t /var/lib/samba/bind-dns/named.conf.update
semanage fcontext -a -t named_var_run_t /var/lib/samba/bind-dns/dns
semanage fcontext -a -t named_var_run_t /var/lib/samba/bind-dns/dns/
semanage fcontext -a -t named_var_run_t "/var/lib/samba/bind-dns/dns/sam.ldb.d(/.*)?"

ls -laZ /var/lib/samba/private/
ls -laZ /var/lib/samba/bind-dns/dns
ls -laZ /var/lib/samba/bind-dns/dns/sam.ldb.d/

exit 0

Last edited by unSpawn; 05-05-2019 at 10:25 AM. Reason: added "exit 0" to end of script (best practice), fixed "code" tags (nicer reading).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Brother HL-2240-R Stopped - Backend /usr/lib/cups/backend/usb does not exist! jet222jet Linux - Hardware 2 12-28-2020 06:32 PM
Selinux-how do i find out what domains have permissions on what type?(selinux policy) vishyc88 Linux - Security 2 11-22-2010 04:27 AM
Strange problem with local permissions on WinXP using a Samba PDC with LDAP backend qtac Linux - Networking 2 09-08-2009 11:33 PM
Turn KnoppMyth backend/frontend into backend only nebbus Linux - General 0 09-09-2007 01:57 AM
Tutorial for BIND with mySQL backend mrEgg Red Hat 3 12-14-2004 03:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Fedora

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration