Ansible configuration policy for the private network/home lab of Dustin C. Hatch http://dustin.hatch.name/
 
 
 
 
Go to file
Dustin 5661910a21 samba-dc: Add sysvolsync script
Samba AD DC does not implement [DFS-R for replication of the SYSVOL][0]
contents.  This does not make much of a difference to me, since
the SYSVOL is really only used for Group Policy.  Windows machines may
log an error if they cannot access the (basically empty) GPO files, but
that's pretty much the only effect if the SYSVOL is in sync between
domain controllers.

Unfortunately, there is one side-effect of the missing DFS-R
functionality that does matter.  On domain controllers, all user,
computer, and group accounts need to have Unix UID/GID numbers mapped.
This is different than regular member machines, which only need UID/GID
numbers for users that will/are allowed to log into them.  LDAP entries
only have ID numbers mapped for the latter class of users, which does
not include machine accounts.  As a result, Samba falls back to
generating local ID numbers for the rest of the accounts.  Those ID
numbers are stored in a local database file,
`/var/lib/samba/private/idmap.ldb`.  It would seem that it wouldn't
actually matter if accounts have different ID numbers on different
domain controllers, but there are evidently [situations][1] where DCs
refuse to allocate ID numbers at all, which can cause authentication to
fail.  As such, the `idmap.ldb` file needs to be kept in sync.

If we're going to go through the effort of synchronizing `idmap.ldb`, we
might as well keep the SYSVOL in sync as well.  To that end, I've
written a script to synchronize both the SYSVOL contents and the
`idmap.ldb` file.  It performs a simple one-way synchronization using
`rsync` from the DC with the PDC emulator role, as discovered using DNS
SRV records.  To ensure the `idmap.ldb` file is in a consistent state,
it only copies the most recent backup file.  If the copied file differs
from the local one, the script stops Samba and restores the local
database from the backup.  It then flushes Samba's caches and restarts
the service.  Finally, it fixes the NT ACLs on the contents of the
SYSVOL.

Since the contents of the SYSVOL are owned by root, naturally the
synchronization process has to run as root as well.  To attempt to limit
the scope of control this would give the process, we use as much of the
systemd sandbox capabilities as possible.  Further, the SSH key pairs
the DCs use to authenticate to one another are restricted to only
running rsync.  As such, the `sysvolsync` script itself cannot run
`tdbbackup` to back up `idmap.ldb`.  To handle that, I've created a
systemd service and corresponding timer unit to run `tdbbackup`
periodically.

I considered for a long time how to best implement this process, and
although I chose this naïve implementation, I am not exactly happy with
it.  Since I do not fully understand *why* keeping
the `idmap.ldb` file in sync is necessary, there are undoubtedly cases
where blindly copying it from the PDC emulator is not correct.  There
are definitely cases where the contents of the SYSVOL can be updated on
a DC besides the PDC emulator, but again, we should not run into them
because we don't really use the SYSVOL at all.  In the end, I think this
solution is good enough for our needs, without being so complicated

[0]: https://wiki.samba.org/index.php?title=SysVol_replication_(DFS-R)&oldid=18120
[1]: https://lists.samba.org/archive/samba/2021-November/238370.html
2022-12-22 18:55:07 -06:00
.certs@13f97e4fa1 websites: dustin.hatch.name: Deploy new site 2022-04-23 15:30:40 -05:00
certs hosts: Add dc-4k6s8e.p.b 2022-12-18 22:49:44 -06:00
ci ci: Add metricspi pipeline 2022-12-18 19:30:00 -06:00
group_vars Fedora37: Set collectd SELinux domain permissive 2022-12-19 10:22:00 -06:00
host_vars hosts: vmhost[01]: Update static DNS server address 2022-12-18 20:19:32 -06:00
passwords/kojiweb_secret hosts: Add koji0.pyrocufflink.blue 2018-08-12 10:27:20 -05:00
roles samba-dc: Add sysvolsync script 2022-12-22 18:55:07 -06:00
vars ci: lib: Update for latest ansible container image 2022-12-03 13:36:10 -06:00
vault burp: Add missing client password for hass2 2022-01-22 12:19:47 -06:00
.gitignore r/blackbox-exporter: Deploy blackbox_exporter 2022-08-10 22:18:53 -05:00
.gitmodules certs: Add certificates submodule 2020-02-22 16:28:06 -06:00
.vault-secret.sh Protect vault secret with GPG 2018-01-29 15:11:07 -06:00
alertmanager.yml r/alertmanager: Deploy AlertManager 2022-08-10 22:18:53 -05:00
ansible.cfg ansible.cfg: Disable stupid group name warning 2019-09-19 19:50:35 -05:00
ansible.yml ansible: Install Ansible 2018-04-08 12:20:03 -05:00
aria2.yml aria2: Deploy aria2 download manager 2018-08-19 14:17:48 -05:00
base.yml base: Enable serial console on KVM VMs 2021-10-16 14:34:51 -05:00
bitwarden_rs.yml bitwarden_rs: Deploy Bitwarden_rs using Docker 2019-09-19 19:27:29 -05:00
blackbox-exporter.yml r/blackbox-exporter: Deploy blackbox_exporter 2022-08-10 22:18:53 -05:00
burp-client.yml burp-client: Apply the cronie role 2019-09-19 19:27:30 -05:00
burp-server.yml burp-{client,server}: PBs to deploy BURP 2018-08-08 20:14:25 -05:00
certbot.yml certbot: Playbook to deploy certbot 2018-06-13 22:23:27 -05:00
collectd.yml collect: Import dyngroups.yml playbook 2022-12-19 10:20:57 -06:00
dch-gw.yml dch-gw: Initial commit 2018-03-27 20:44:43 -05:00
dch-proxy.yml dch-proxy: PB to deploy HAProxy 2018-07-01 15:19:20 -05:00
dch-root-ca.crt pyrocufflink: Trust DCH Root CA 2018-06-04 20:03:55 -05:00
dch-vpn.yml Move VPN server to dedicated VM 2018-10-07 21:42:18 -05:00
dhcpcd.yml dhcpcd: Install and configure dhcpcd 2018-03-13 23:19:50 -05:00
dhcpd.yml dhcpd: Install and configure ISC DHCPD 2018-03-27 20:44:43 -05:00
docker.yml roles/docker: Install and set up Docker daemon 2019-09-19 19:27:12 -05:00
domain-controller.yml domain-controller: Configure local AD authentication 2018-03-11 18:16:17 -05:00
dyngroups.yml dyngroups: Also group by distribution and version 2022-12-19 10:20:09 -06:00
fileserver.yml fileserver: Configure Apache ~user directories 2019-01-04 20:52:23 -06:00
firewalld.yml firewalld: Playbook to bootstrap firewalld 2018-01-29 15:11:07 -06:00
frigate.yml r/frigate: Add role to deploy Frigate 2021-08-21 17:16:58 -05:00
gitea.yml r/gitea: Update to 1.17.0 2022-09-01 17:29:34 -05:00
grafana.yml grafana: Redirect HTTP to HTTPS 2022-08-10 21:55:54 -05:00
graylog.yml graylog: Add PB to deploy Graylog server 2019-10-28 18:47:09 -05:00
hassdb.yml hassdb: Fix playbook 2020-08-29 14:22:17 -05:00
homeassistant.yml homeassistant: Split out Zigbee/Zwave playbooks 2021-12-18 16:45:52 -06:00
hostname.yml hostname: Also write /etc/hosts 2018-04-08 10:11:43 -05:00
hosts hosts: Add dc-4k6s8e.p.b 2022-12-18 22:49:44 -06:00
hosts.offline r/collectd-sensors: Install collectd sensors plugin 2022-07-21 13:14:25 -05:00
jenkins-slave.yml jenkins-slave: Apply ssh-hostkeys role 2018-04-08 12:32:02 -05:00
koji-builder.yml koji: Add playbooks for Koji 2018-08-12 10:14:25 -05:00
koji-hub.yml koji: Add playbooks for Koji 2018-08-12 10:14:25 -05:00
koji-web.yml koji: Add playbooks for Koji 2018-08-12 10:14:25 -05:00
koji.yml koji: Add playbooks for Koji 2018-08-12 10:14:25 -05:00
metricspi.yml metricspi: Apply victoria-metrics-nginx role 2022-08-12 13:14:41 -05:00
motioneye.yml motioneye: Deploy motionEye camera software 2020-10-03 11:29:39 -05:00
named-server.yml named-server: Playbook to deploy BIND 2018-01-29 15:10:04 -06:00
net-ifaces.yml net-ifaces: PB to apply net-ifaces role 2018-07-23 17:35:10 -05:00
network.yml network: Playbook to configure networking 2018-03-27 20:44:43 -05:00
nextcloud.yml roles/cert: Add handler topic notification 2020-12-26 10:38:17 -06:00
ntp.yml ntp: Initial PB and role to set up ntpd 2018-04-22 11:19:22 -05:00
nut.yml nut: Add playbook for NUT 2021-10-31 14:28:27 -05:00
postgresql.yml postgresql: PB to deploy PostgreSQL server 2018-04-14 15:28:46 -05:00
protonvpn.yml pyrocufflink-dns: Cloudflare over ProtonVPN 2020-09-06 11:06:58 -05:00
pxe.yml r/netboot/basementhud: Configure NBD export 2022-08-15 17:18:48 -05:00
pyrocufflink.yml pyrocufflink: Trust DCH Root CA 2018-06-04 20:03:55 -05:00
radius.yml radius: PB to configure RADIUS servers 2018-05-06 13:09:18 -05:00
radvd.yml radvd: Install and configure radvd 2018-03-27 20:44:43 -05:00
remount.yml remount: Do not remount SquashFS volumes 2022-08-12 13:40:06 -05:00
rngd.yml rngd: PB to set up rngd 2018-08-13 20:25:22 -05:00
samba-dc.yml samba-dc: Apply to one machine at a time 2021-11-07 16:20:03 -06:00
smtp-relay.yml smtp-relay: PB to deploy Postfix SMTP relay 2018-04-15 11:38:51 -05:00
squid.yml squid: Add role and PB to deploy Squid 2018-08-12 16:00:32 -05:00
synapse.yml roles/synapse: Add cert role dependency 2021-01-31 15:38:18 -06:00
systemd-networkd.yml r/systemd-networkd: Role to configure networkd 2021-10-10 16:09:15 -05:00
systemd-resolved.yml r/systemd-resolved: Manage systemd resolver daemon 2022-08-12 14:35:14 -05:00
taiga.yml taiga: Add playbook for Taiga 2019-09-19 19:51:45 -05:00
victoria-metrics.yml r/vmalert: Deploy vmalert 2022-08-11 21:40:19 -05:00
vmhost.yml r/vmhost: mount shared filesystems 2021-10-10 16:09:15 -05:00
websites.yml websites: Add hatchlearningcenter.org 2022-11-30 22:04:29 -06:00
wheelhost.yml wheelhost: Publish wheels built by Jenkins 2019-03-22 10:19:27 -05:00
zabbix-agent.yml zabbix: Playbooks for Zabbix server, agents 2018-04-14 15:31:17 -05:00
zabbix-server.yml zabbix: Playbooks for Zabbix server, agents 2018-04-14 15:31:17 -05:00
zabbix.yml zabbix: Playbooks for Zabbix server, agents 2018-04-14 15:31:17 -05:00
zezere.yml zezere: role/playbook to deploy Zezere 2021-07-05 09:34:25 -05:00
zigbee2mqtt.yml homeassistant: Split out Zigbee/Zwave playbooks 2021-12-18 16:45:52 -06:00
zwavejs2mqtt.yml homeassistant: Split out Zigbee/Zwave playbooks 2021-12-18 16:45:52 -06:00