configpolicy/roles
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
..
alertmanager r/alertmanager: Deploy AlertManager 2022-08-10 22:18:53 -05:00
ansible/tasks roles/ansible: Install python-netaddr 2018-04-08 12:33:54 -05:00
apache Add HTTPS certificate for hass2.p.b 2021-07-24 18:39:45 -05:00
aria2 aria2: Deploy aria2 download manager 2018-08-19 14:17:48 -05:00
base r/base: Set SSH authorized keys for root 2021-10-16 15:39:19 -05:00
bitwarden_rs r/bitwarden_rs: Remove dangling container at start 2022-08-22 20:06:02 -05:00
blackbox-exporter r/blackbox-exporter: Deploy blackbox_exporter 2022-08-10 22:18:53 -05:00
burp-client home-assistant: Omit history DB from backups 2022-01-02 12:07:12 -06:00
burp-server roles/burp-server: switch to version_compare test 2020-01-25 13:54:42 -06:00
cert/tasks roles/cert: Add handler topic notification 2020-12-26 10:38:17 -06:00
certbot roles/certbot: Ensure certbot is configured first 2019-09-19 19:50:35 -05:00
collectd r/collectd: Max unixsock plugin optional 2022-08-10 21:55:54 -05:00
collectd-nut r/collectd-nut: Configure nut plugin for collectd 2021-10-31 14:26:26 -05:00
collectd-prometheus r/collectd-prometheus: Work w/o firewalld, selinux 2022-08-10 19:47:12 -05:00
collectd-sensors/tasks r/collectd-sensors: Install collectd sensors plugin 2022-07-21 13:14:25 -05:00
collectd-version r/collectd-version: Fix handlers 2022-12-19 10:17:57 -06:00
cronie/tasks roles/cronie: Install cronie 2018-08-08 21:38:56 -05:00
dch-gw dch-gw: Restrict traffic from Management network 2018-07-15 12:16:43 -05:00
dch-openvpn-server dch-openvpn: Support road-warrior clients 2018-10-07 21:42:18 -05:00
dch-proxy websites: Add chmod777.sh 2020-03-09 20:29:52 -05:00
dch-storage-net roles/dch-storage-net: Add After device dependency 2018-07-29 10:14:00 -05:00
dch-vpn-server roles/strongswan: Update service name 2020-07-04 14:32:22 -05:00
dhcpcd roles/dhcpcd: Always send FQDN 2018-07-23 17:35:10 -05:00
dhcpd roles/dhcpd: Support UniFi DHCP option 43 2019-03-22 09:29:56 -05:00
docker roles/docker: Install and set up Docker daemon 2019-09-19 19:27:12 -05:00
elasticsearch roles/elasticsearch: Add Elasticsearch deployment 2019-10-28 18:33:37 -05:00
fileserver roles/fileserver: Deploy Samba file server 2018-08-01 22:04:07 -05:00
formsubmit r/formsubmit: Deploy formsubmit app 2022-02-27 17:42:15 -06:00
freeradius hosts: dc2: Add RADIUS server certificate 2021-10-17 14:03:52 -05:00
frigate r/frigate: Restart service if it fails 2022-08-22 20:08:09 -05:00
gitea r/gitea: Handle encoded / characters in HTTP paths 2022-11-27 17:21:03 -06:00
grafana r/grafana: Allow configuring LDAP CA cert 2022-08-11 21:40:19 -05:00
graylog roles/graylog: Update Graylog repository RPM URL 2021-01-31 15:33:42 -06:00
haproxy roles/haproxy: Fix undefined var on Fedora hosts 2020-03-03 19:27:19 -06:00
hass-dhcp r/hass-dhcp: Start dnsmasq after network is up 2022-08-21 08:03:00 -05:00
hassdb/tasks roles/hassdb: Deploy Home Assistant database 2020-07-14 11:38:30 -05:00
homeassistant r/homeassistant: Proxy for Zigbee2MQTT frontend 2022-12-12 17:47:05 -06:00
hostname hostname: Also write /etc/hosts 2018-04-08 10:11:43 -05:00
jenkins-slave jenkins-slave: Allow Jenkins to connect to Docker 2019-09-19 19:50:35 -05:00
kerberos roles/kerberos: Configure mit-krb5 2018-01-29 15:05:51 -06:00
koji-builder roles/koji-builder: Deploy the Koji builder 2018-08-12 10:14:25 -05:00
koji-client roles/koji-client: Configure the koji client 2018-08-12 10:05:56 -05:00
koji-gc roles/koji-gc: Deploy the Koji garbage collector 2018-08-12 09:58:56 -05:00
koji-hub roles/koji-hub: Deploy the Koji Hub 2018-08-12 09:33:08 -05:00
koji-web roles/koji-web: Deploy the Koji Web UI 2018-08-12 10:08:01 -05:00
kojira roles/kojira: Deploy the Koji repository agent 2018-08-12 10:04:23 -05:00
logrotate/tasks roles/logrotate: Install and enable logrotate 2020-12-08 20:59:40 -06:00
mongodb roles/mongodb: Add MongoDB deployment 2019-10-28 18:34:45 -05:00
mosquitto r/mosquitto: Support persistence 2022-05-29 11:25:25 -05:00
motioneye motioneye: Deploy motionEye camera software 2020-10-03 11:29:39 -05:00
named r/named: Fix typo in firewalld condition 2022-08-20 18:18:38 -05:00
nbd-server r/nbd-server: Deploy nbd-server 2022-08-15 16:55:36 -05:00
net-ifaces roles/net-ifaces: Update VLAN for pyrocufflink.blue 2020-05-25 09:17:24 -05:00
netboot r/netboot/basementhud: Configure NBD export 2022-08-15 17:18:48 -05:00
nextcloud r/nextcloud: Increase Apache timeout 2021-12-22 11:28:52 -06:00
nftables roles/nftables: Basic nftables configuration 2018-03-27 20:44:43 -05:00
nginx r/nginx: Fix applying on Buildroot systems 2022-08-10 21:55:54 -05:00
nsswitch roles/nsswitch: Configure glibc name service 2018-03-11 18:16:17 -05:00
ntpd ntp: Initial PB and role to set up ntpd 2018-04-22 11:19:22 -05:00
nut r/nut: Add role for Network UPS Tools 2021-10-31 14:25:59 -05:00
postfix roles/postfix: Vary shlib directory by arch 2018-08-07 19:51:09 -05:00
postgresql-server roles/postgresql-server: Remove postgresql-setup 2020-07-14 10:56:01 -05:00
protonvpn r/protonvpn: Move remote_addrs file to /var 2022-08-20 18:18:21 -05:00
pxe r/pxe: Set up a PXE server 2022-08-15 17:12:35 -05:00
rabbitmq/tasks roles/rabbitmq: Deploy RabbitMQ 2019-03-07 13:29:29 -06:00
radvd roles/radvd: Support multiple prefixes per network 2018-04-06 20:16:02 -05:00
redis/tasks roles/redis: Add role to deploy Redis 2021-06-25 11:10:10 -05:00
rhel-network roles/rhel-network: Add static route support 2018-03-27 20:44:43 -05:00
samba roles/samba: Support selecting interfaces 2018-06-23 14:42:45 -05:00
samba-dc samba-dc: Add sysvolsync script 2022-12-22 18:55:07 -06:00
scrape-collectd r/scrape-collectd: collectd scrape targets config 2022-08-11 21:40:19 -05:00
serial-console r/serial-console: Enable getty on serial console 2021-10-16 14:34:51 -05:00
squid squid: Add role and PB to deploy Squid 2018-08-12 16:00:32 -05:00
ssh-hostkeys hosts: Add dc-4k6s8e.p.b 2022-12-18 22:49:44 -06:00
sshd roles/sshd: Configure OpenSSH daemon 2018-06-06 21:44:28 -05:00
strongswan roles/strongswan: Update service name 2020-07-04 14:32:22 -05:00
strongswan-swanctl roles/strongswan-swanctl: Load esp4 module at boot 2021-02-17 20:33:41 -06:00
sudo roles/sudo: Configure sudo and policy 2018-03-11 18:16:17 -05:00
synapse r/synapse: Enable Prometheus metrics 2021-10-18 18:08:50 -05:00
system-auth r/system-auth: Disable authselect 2022-08-12 16:54:00 -05:00
systemd-networkd r/systemd-networkd: Enable and start the service 2021-10-31 14:29:30 -05:00
systemd-resolved r/systemd-resolved: Manage systemd resolver daemon 2022-08-12 14:35:14 -05:00
taiga roles/taiga: Fix HTTP->HTTPS redirect 2019-03-22 09:29:56 -05:00
tftp/tasks r/tftp: Deploy TFTP server 2022-08-15 17:06:20 -05:00
trustca roles/trustca: Generic role for adding CA certs 2018-06-04 20:03:55 -05:00
victoria-metrics r/v-m: Add role for Victoria Metrics 2022-08-10 19:47:12 -05:00
victoria-metrics-nginx r/v-m-nginx: Prevent requesting reload 2022-08-12 13:14:05 -05:00
vmagent r/vmagent: Deploy vmagent 2022-08-10 22:18:43 -05:00
vmalert vmalert: Allow configuring http.pathPrefix 2022-08-12 13:10:36 -05:00
vmhost r/vmhost: Add autostart script 2022-08-20 21:15:31 -05:00
websites websites: Add hatchlearningcenter.org 2022-11-30 22:04:29 -06:00
wheelhost wheelhost: Publish wheels built by Jenkins 2019-03-22 10:19:27 -05:00
winbind r/winbind: Add domain-join tag 2021-11-06 18:12:29 -05:00
zabbix-agent roles/zabbix: Add support for Debian 2019-03-22 09:29:56 -05:00
zabbix-server roles/zabbix-server: Redirect HTTP -> HTTPS 2018-06-09 14:35:22 -05:00
zezere zezere: role/playbook to deploy Zezere 2021-07-05 09:34:25 -05:00
zigbee2mqtt r/z*2mqtt: Restart services after unexpected stop 2022-08-21 22:25:12 -05:00
zwavejs2mqtt r/z*2mqtt: Restart services after unexpected stop 2022-08-21 22:25:12 -05:00