diff --git a/src/zmb-ad-join/install-service.sh b/src/zmb-ad-join/install-service.sh index ee0dae9..87b03e7 100644 --- a/src/zmb-ad-join/install-service.sh +++ b/src/zmb-ad-join/install-service.sh @@ -127,10 +127,24 @@ rm -f /etc/samba/smb.conf echo -e "$ZMB_ADMIN_PASS" | kinit -V $ZMB_ADMIN_USER samba-tool domain join $ZMB_REALM DC -k yes --backend-store=mdb -cat > /etc/cron.d/sysvol-sync << EOF -*/5 * * * * root /usr/bin/rsync -XAavz --delete-after root@$LXC_DNS:/var/lib/samba/sysvol/ /var/lib/samba/sysvol +mkdir -p /mnt/sysvol + +cat << EOF > /root/.smbcredentials +username=$ZMB_ADMIN_USER +password=$ZMB_ADMIN_PASS +domain=$ZMB_DOMAIN EOF +echo "//$LXC_DNS/sysvol /mnt/sysvol cifs credentials=/root/.smbcredentials 0 0" >> /etc/fstab + +mount.cifs //$LXC_DNS/sysvol /mnt/sysvol -o credentials=/root/.smbcredentials + +cat > /etc/cron.d/sysvol-sync << EOF +*/15 * * * * root /usr/bin/rsync -XAavz --delete-after /mnt/sysvol/ /var/lib/samba/sysvol +EOF + +/usr/bin/rsync -XAavz --delete-after /mnt/sysvol/ /var/lib/samba/sysvol + ssh-keygen -q -f "$HOME/.ssh/id_rsa" -N "" -b 4096 systemctl unmask samba-ad-dc