- I used Alpine Linux 3.60
- the Chrony NTP daemon in the system is sufficient for being a domain controller now.
- Ideally, the VM should have a static IP accessible to the clients so that it is easy to set the clients to access the domain server running on the VM. This isn't strictly necessary but may cause issues if the IP address changes.
- Replace SAMDOM and SAMDOM.EXAMPLE.COM with the names of your domain and realm.
apk add doas
adduser user wheel
echo "permit persist :wheel" > /etc/doas.conf
Now you can SSH in as user and run doas <command>
or doas -s
. You could also add the user and run the su
command.
- Install a base system, set a root password, a second local account is not required. The only required setup is to use chronyd as the NTP daemon (default).
- When the system reboots, install the required components.
apk update
apk upgrade
apk add samba samba-dc samba-client openrc
- Make a new Samba config file, and put the following info in.
mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
vi /etc/samba/smb.conf
[global]
workgroup = SAMDOM
realm = SAMDOM.EXAMPLE.COM
netbios name = DC1
server role = active directory domain controller
dns forwarder = 8.8.8.8
idmap_ldb:use rfc2307 = yes
[sysvol]
path = /var/lib/samba/sysvol
read only = no
[netlogon]
path = /var/lib/samba/sysvol/samdom.example.com/scripts
read only = no
- Provision the DC interactively:
samba-tool domain provision --use-rfc2307 --interactive
Use the SAMBA_INTERNAL dns to minimize headaches.
- configure DNS
vi /etc/resolv.conf
Set the nameserver to localhost:
nameserver 127.0.0.1
- Remove the default Samba service scripts since it doesn't work for a domain controller (these may fail):
rc-update del samba
rc-update del smbd
rc-update del nmbd
- Create a samba-ad-dc Init script
vi /etc/init.d/samba-ad-dc
Add the following
#!/sbin/openrc-run
description="Samba Active Directory Domain Controller"
command="/usr/sbin/samba"
command_background="yes"
pidfile="/var/run/samba/samba.pid"
depend() {
need net
use dns logger
after firewall
}
start_pre() {
checkpath --directory --owner root:root --mode 0755 /var/run/samba
}
stop() {
ebegin "Stopping Samba AD DC"
start-stop-daemon --stop --pidfile $pidfile
eend $?
}
Make the script executable, and add it. Reboot, confirm the service starts.
chmod +x /etc/init.d/samba-ad-dc
rc-update add samba-ad-dc
reboot
Add a config option to set the DC functional level to /etc/samba/smb.conf
:
ad dc functional level = 2016
rc-service samba-ad-dc stop
rc-service samba-ad-dc start
Restart samba or reboot. If you run samba-tool domain level show
, and there is only a single DC, you should see the DC running a 2016 functional level.
Then run:
samba-tool domain schemaupgrade --schema=2019
samba-tool domain functionalprep --function-level=2016
samba-tool domain level raise --domain-level=2016 --forest-level=2016
samba-tool domain level show
- Set the Windows computer's DNS server to the IP address of the domain controller.
- Run sysdm.cpl, and join the domain. Use the account "Administrator" with the password you set during the samba DC interactive provisioning.