The nethserver-dc package runs a systemd-nspawn container (
nsdc) with a vanilla
Samba 4 inside of it. It downloads, installs, configures and provision an Active
Directory domain controller based on Samba.
nsdc container needs an IP address in a green network, different from the
host machine one. It enslaves its network interface to a host bridge, with green
role. If needed, this bridge is created automatically.
This is a typical configuration:
# config show nsdc nsdc=service ProvisionType=newdomain IpAddress=192.168.122.50 bridge=br0 status=enabled
- it creates and configures systemd-nspawn machine (nethserver-dc-install
action). The Samba domain is provisioned by the
samba-provision.serviceunit, according to the
ProvisionTypeprop value. Supported values are:
newdomain(default): domain and realm are taken from local system and won’t be possible to change them anymore. For instance if system domain is nethserver.org domain will be NETHSERVER and realm nethserver.org.
ns6upgrade: connect the LDAP service running on the host machine and migrate the WS/PDC domain from ns6 backup to an Active Directory domain. The realm and domain name are set as described in the
sme8migration: this provision procedure is driven by
nethserver-dc-migrateaction. It requires a running NSDC, provisioned as
newdomain. It copies Samba 3 files from the migration source directory to the NSDC chroot, then restarts the
sambaservices in the running NSDC container.
- it creates a network bridge if needed, or select an existing one and save it in nsdc bridge db prop (nethserver-dc-create-bridge action)
- it waits for the machine to come up (nethserver-dc-waitstart)
- it joins the domain of new machine using default credentials (nethserver-dc-join).
- it sets the password policy (nethserver-dc-password-policy)
Realmd writes a lot of information on the system journal. See journalctl command.
Running commands in
To get a shell inside the
nsdc container, you can run
# systemd-run -M nsdc -t /bin/bash
As alternative, run a specific command in the container with the
# nsdc-run cat /etc/hostname
-- string helps to separate the argument list:
# nsdc-run -- ls --help
For more information:
# nsdc-run --help
Always make sure to close interactive sessions to avoid errors like:
Failed to get machine PTY: No such file or directory
To get a list of sessions run
nethserver-dc-join action joins automatically to domain. If for any reason the join is invalid you can attempt a manual join following this procedure
Check nsdc is running:
systemctl status nsdc
Check the DNS is responding:
# host -t SRV _ldap._tcp.$(config getprop sssd Realm) _ldap._tcp.nethsever.org has SRV record 0 100 389 nsdc-vm8.nethsever.org.
Clean up any previous join state:
config setprop sssd Provider none signal-event nethserver-sssd-leave
Join the domain:
realm join -v -U admin $(config getprop sssd Realm)
You can replace
admin with any other administrative account name. The
command above prompts for a password. When join is successful:
config setprop sssd Provider ad signal-event nethserver-sssd-save
If everything goes well
Once domain is joined, you can manage users from interface. From command line, you can use net command
# net ads info
The “Start DC” procedure from the “Accounts provider” page is designed for a single run. If it fails, re-installing the whole server can be avoided by running the following command
The command cleans up the DC state and prepare it for new provisioning run. Any existing user and group account is erased.
If a full DC re-install is desired, after factory reset event, run also
rm -rf /var/lib/machines/nsdc
Upgrade the container¶
The upgrade procedure will:
- stop the container
- upgrade the chroot base system
- upgrade samba
- restart the container
To upgrade, execute:
Changing the IP address of DC¶
Before applying this procedure, read carefully the official Samba wiki page.
The IP address of nsdc container must be in the same network of the bridged green interface. If needed, first change the address of the green interface, then proceed with the following.
Example, change the network address:
- current host IP: 192.168.101.7
- current nsdc container IP: 192.168.122.77
- new nsdc container IP: 192.168.101.77
nethserver-dc-change-ip with the new ip address:
signal-event nethserver-dc-change-ip <new_ip_address>
signal-event nethserver-dc-change-ip 192.168.101.77
Note that the event will fail if the new nsdc ip address is not in the same network of the green interface.
Alternate UPN suffix¶
The default UPN (User Principal Name) suffix for a user account is the SSSD realm, but the nsdc container is configured to use also an extra UPN suffix set to the FQDN of the host machine.
- Host FQDN: nethserver.org
- SSSD realm: ad.nethserver.org
- Default UPN: ad.nethserver.org
- Extra UPN: nethserver.org
If required, the administrator can use RSAT tools to select the extra UPN for a specific user.
ns-samba binary build¶
Clone the git repo at https://github.com/NethServer/ns-samba, enter its directory
Download pristine sources from the Samba project
wget https://download.samba.org/pub/samba/stable/samba-4.8.6.tar.gz https://download.samba.org/pub/samba/stable/samba-4.8.6.tar.asc
Check the sources signature
gunzip -c samba-4.8.6.tar.gz | gpg --verify samba-4.8.6.tar.asc -
Bump the source hash sum
sha1sum samba-4.8.6.tar.gz > SHA1SUM
ns-samba.specto fix version references and
- Commit changes and add (signed) tag (i.e.
- Push commit and tag to remote git repository to start the automated x86_64 build
- Once the automated build has finished successfully, fill the new relase page here: https://github.com/NethServer/ns-samba/releases
- Copy the RPM URL to the local
- Update SHA1SUM with the new RPM hash sum