Samba domain controller
100K+
Samba domain controller.
The most-common directives can be specified in environment variables as shown below. If you need further customizations, put them in one or more files under mount point /etc/samba.d.
Basic requirements:
The directories /etc/samba and /var/lib/samba must be mounted as persistent volumes. If /var/lib/samba is empty, the "provision" or "join" action specified in DOMAIN_ACTION variable will be taken.
The most-common directives can be specified in environment variables as shown below. If you need further customizations, put them in one or more files under mount point /etc/samba/conf.d. If you want to add global settings, put those into the first file with a name like 0globals.conf -- they will be appended in alphabetical-sort sequence.
Test your configuration and/or manage contents of your directory using Apache Directory Studio. Make a connection on port 636 with method SSL encryption (ldaps); specify simple authentication with username <your name>. The ldaps certificate is self-signed so you'll need to accept it first.
This repo has complete instructions for building a kubernetes cluster where you can launch with helm or kubernetes.yaml using make and customizing Makefile.vars after cloning this repo:
git clone https://github.com/instantlinux/docker-tools.git
cd docker-tools/k8s
# This take target is defined in Makefile.instances
make dc03
| Variable | Default | Description |
|---|---|---|
| ADMIN_PASSWORD_SECRET | samba-admin-password | name of admin secret, see below |
| ALLOW_DNS_UPDATES | secure | enable DNS updates |
| BIND_INTERFACES_ONLY | yes | specify IP addresses or interfaces |
| DNS_FORWARDER | (none) | value to place in dns forwarder in smb.conf |
| DOMAIN_ACTION | provision | set to 'join' if existing domain |
| DOMAIN_LOGONS | yes | support workgroup login |
| DOMAIN_MASTER | no | "WAN-wide browse list collation"--haha, see man page |
| INTERFACES | lo eth0 | list of IP addresses or interfaces |
| LOG_LEVEL | 1 | log verbosity |
| MODEL | standard | process model: single, standard, thread |
| NETBIOS_NAME | (hostname -s) | the NETBIOS name |
| REALM | ad.example.com | active-directory DNS realm (use lowercase) |
| SERVER_STRING | Samba Domain Controller | server identity |
| TZ | UTC | local timezone |
| WINBIND_USE_DEFAULT_DOMAIN | yes | allow username without domain component |
| WORKGROUP | AD | workgroup (realm prefix - poorly documented) |
This is only needed at first run, for samba domain provision or join. Do NOT leave your domain-controller administrator secret activated at any other time. For clarity, this is a docker-secret with the initial Samba admin password, not the password itself. It must contain a passphrase of sufficient complexity.
| Secret | Description |
|---|---|
| samba-admin-password | domain-administrator pw |
Secrets can be specified as kubernetes secrets, files (see the secrets section of the example docker-compose.yml provided in this repo), or as swarm secrets.
Getting a domain-controller cluster up and running properly requires a lot of correctly-configured trust relationships established between domain controllers, and Samba's documentation of error messages and problem-resolutions is pretty thin. If you're only running this version of samba, it's likely there will be few problems. But in a mixed environment with Microsoft Active Directory servers and/or older versions of samba4, you're bound to run into problems that require tweaking. A few diagnostic commands are available within this container; here are notes that might help you get up and running more quickly:
export LDB_MODULES_PATH=/usr/lib/samba/ldb
ldbsearch -H /var/lib/samba/private/sam.ldb '(invocationid=*)' \
--cross-ncs objectguid|grep -i -B 1 -A 1 <new dc hostname>
samba-tool dns add dc01 _msdcs.ether.ci.net <guid from above> \
CNAME <new dc fqdn> -UAdministrator
ldap server require strong auth = no
samba-tool drs showrepl
samba-tool dbcheck
samba-tool drs kcc
./samba-tool drs replicate dc1 dc2 dc=<foo...>,dc=<suffix> --full-sync
./samba-tool drs replicate dc2 dc1 dc=<foo...>,dc=<suffix> --full-sync
samba-tool dns add <dc> <domain> <dc> A <ip> -Uadministrator
samba-tool dns delete <dc> <domain> <dc> A <ip> -Uadministrator
samba_dnsupdate --all-names --use-samba-tool
for DC in dc1 dc2 dc3 etc; do
samba-tool dns delete $DC _msdcs.<domain> abcdef-abc-xxx CNAME <host> -Uadministrator
done
samba-tool domain demote --remove-other-dead-server=<badhost>
samba-tool dbcheck --cross-ncs --fix
Then restart the secondary with DOMAIN_ACTION=join.
With docker it's real easy to get a bunch of stale entries in your domain controller list. The latest version of samba4 provides a way to prune them: {noformat} samba-tool domain demote --remove-other-dead-server=xxx {noformat}
If you get the error message shown here, check that the samba-admin-password secret contains a value.
ERROR(ldb): uncaught exception - Element clearTextPassword has empty attribute in ldb
message (CN=Administrator,CN=Users,DC=ad,DC=***,DC=nl)
If you want to make improvements to this image, see CONTRIBUTING.
Content type
Image
Digest
sha256:9dc7a3a60…
Size
66.1 MB
Last updated
15 days ago
docker pull instantlinux/samba-dc