Samba as an Active Directory Domain Controller
Purpose:
I have used SAMBA as an authentication method in other applications and to provide file and print services to a Windows network.
When I read that SAMBA4 could be used as a domain controller, I was intrigued.
I originally set out to see if it could be done and found that it actually would set up as a domain controller.
I was then determined to find other applications.
The first was to use a SAMBA server as a Read Only Domain Controller.
Originally this was a bit more difficult as I felt I had to break the service to make it act in Read-Only mode.
As the server does not require extra services and required minimal resources, I felt that it would be more secure.
I was in a situation where a customer did not want to add a Microsoft Server to their network; however, wanted to have the security offered by a central server.
We installed a FreeBSD server with SAMBA4 and had them up and running.
The customer manages the services from a Windows desktop, with the exception of DHCP which is managed through WEBMIN.
If you have not already set up a server and need some assistance, you may want to look at our document entitled FreeBSD from the menu on the left.
The following is a quick check list for setting up SAMBA 4 as an Active Directory Server;
- Prepare for Active Directory
- Install Samba
- Configure Samba
- Manage Samba from Microsoft Management Console
- Install and Configure DHCP
- Install and Configure Webmin
- Manage Samba from Webmin
- Manage Samba from Secure Shell
Preparing for Active Directory:
There are some things that need to be done to the server before it will be able to be used as a domain controller.
- We will need to get the latest ports.
The command to install or update the ports is:
portsnap fetch extract
- Update the system and package information
freebsd-update fetch install
pkg update -f
pkg upgrade
- Finally, change the file system to allow for Access Control List permissions.
Be careful eith the configuration as an error will force you to log on insingle user mode to fix the error.
When you have completed, you can apply the chages without rebooting.
sed -i '' "s/rw/rw,acls,noatime/g" /etc/fstab
mount -o acls /
Loading SAMBA:
This is the command to load it from ports.
The config-recursive option allows you to configure all the dependencies before build.
You will notice that we run the configuration at least twice during the build to allow the sub-dependencies to be configured.
I attempt to deselect any man page, help documents and similar as I will use the Internet as a reference.
cd /usr/ports/net/samba42
make config-recursive
make config-recursive&& make install clean
These are the options that I select for the SAMBA installation:
- ACL_SUPPORT
- ADS
- AD_DC
- AIO_SUPPORT
- DEBUG
- DNSUPDATE
- EXP_MODULES
- FAM
- LDAP
- PTHREADPOOL
- QUOTAS
- SYSLOG
- UTMP
- NSUPDATE
- MDNSRESPONDER
I have attempted to load SAMBA through the pkg system; however, I do not think it has everything required for active directory.
To install samba42 using the pkg system the command would be: pkg install samba42
Manage Samba from Microsoft Management Console:
Windows has a remote toolkit that can be run on computers with Windows 7 Professional or better.
To manage active directory, you will use these tools the same as if the server was a Windows 2008 R2.
The Users and Computer mmc snap in (dsa.msc) will allow you to manage users, groups and computers.
The Domain Name Service mmc snap in (dns.msc) allows configuration of domain names.
The Flexible Single Master Operation (FSMO) roles can be changed using the same snap ins that are used to change the roles in Windows environment.
I have not tried to utilize this system in an organization like in the tests; however, I have not found a method to set set DNS Scavenging and Aging from the mmc.
Managing with Webmin:
Webmin can be used to manage file shares, users and groups.
There is no distinction between a user account and computer account, so you will see the computer names mixed in with users.
The computer names all start with a $ sign.
The module will allow you to join the domain, if it is not a controller.
With time the Webmin module may provide more Domain management.
I still prefer the MMC snap-ins for managing.
Managing with Secure Shell:
You can manage many aspects of the Directory Service using the samba-tool command. The two examples are the ones that I use by default.
Version 4.1 defaulted to domain and forest functional level of 2003. You can raise the functional level of both by using the command:
samba-tool domain level raise --domain-level=2008_R2
samba-tool domain level raise --forest-level=2008_R2
Version 4.2 defaults to level 2008_R2 and 2012 is not available so you will not need to raise the level.
By default SAMBA requires complex passwords.
Some of the organizations that I work for do not require nor want complex passwords.
You can control the password complexity, history, minimum length and age with the command:
samba-tool domain passwordsettings set --complexity=off --history-length=0 --min-pwd-length=2 --min-pwd-age=0 --max-pwd-age=0
We are looking into PERL scripts that can be run on either Windows or FreeBSD to assist in the management of the SAMBA domain controller.
As we develop and test the scripts we will post them.