Added ZMB_DNS_BACKEND to support native and bind9

This commit is contained in:
Thorsten Spille 2021-04-12 22:35:03 +02:00
parent b2aebcc80e
commit ad31e85feb
3 changed files with 22 additions and 8 deletions

View File

@ -75,6 +75,9 @@ LXC_LOCALE="de_DE.utf8"
ZMB_REALM="ZMB.ROCKS" ZMB_REALM="ZMB.ROCKS"
ZMB_DOMAIN="ZMB" ZMB_DOMAIN="ZMB"
# Select the Zamba AD DNS backend, supported are INTERNAL_DNS or BIND9_DLZ
ZMB_DNS_BACKEND="INTERNAL_DNS"
# The Domain-Admin and password for zamba installation # The Domain-Admin and password for zamba installation
ZMB_ADMIN_USER="Administrator" ZMB_ADMIN_USER="Administrator"
ZMB_ADMIN_PASS="MYPASSWORD" ZMB_ADMIN_PASS="MYPASSWORD"

View File

@ -131,6 +131,11 @@ Defines the domain name in your Active Directory or Workgroup (AD DC, AD member,
```bash ```bash
ZMB_DOMAIN="ZMB" ZMB_DOMAIN="ZMB"
``` ```
### ZMB_DNS_BACKEND
Defines the desired DNS server backend, supported are `INTERNAL_DNS` and `BIND9_DLZ` for more advanced usage
```bash
ZMB_DNS_BACKEND="INTERNAL_DNS"
```
### ZMB_ADMIN_USER ### ZMB_ADMIN_USER
Defines the name of your domain administrator account (AD DC, AD member) Defines the name of your domain administrator account (AD DC, AD member)
```bash ```bash

View File

@ -7,6 +7,10 @@
source /root/zamba.conf source /root/zamba.conf
if [[ $ZMB_DNS_BACKEND == "BIND9_DLZ" ]]; then
BINDNINE=bind9
fi
# Set Timezone # Set Timezone
ln -sf /usr/share/zoneinfo/$LXC_TIMEZONE /etc/localtime ln -sf /usr/share/zoneinfo/$LXC_TIMEZONE /etc/localtime
@ -47,10 +51,11 @@ EOF
apt update apt update
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt -y -qq dist-upgrade
# install required packages # install required packages
DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" $LXC_TOOLSET acl attr ntpdate nginx-full rpl net-tools dnsutils ntp bind9 samba smbclient winbind libpam-winbind libnss-winbind krb5-user samba-dsdb-modules samba-vfs-modules lmdb-utils DEBIAN_FRONTEND=noninteractive DEBIAN_PRIORITY=critical apt install -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" $LXC_TOOLSET acl attr ntpdate nginx-full rpl net-tools dnsutils ntp samba smbclient winbind libpam-winbind libnss-winbind krb5-user samba-dsdb-modules samba-vfs-modules lmdb-utils $BINDNINE
# configure bind dns service if [[ $ZMB_DNS_BACKEND == "BIND9_DLZ" ]]; then
cat << EOF > /etc/default/bind9 # configure bind dns service
cat << EOF > /etc/default/bind9
# #
# run resolvconf? # run resolvconf?
RESOLVCONF=no RESOLVCONF=no
@ -72,7 +77,7 @@ dlz "$LXC_DOMAIN" {
}; };
EOF EOF
cat << EOF > /etc/bind/named.conf.options cat << EOF > /etc/bind/named.conf.options
options { options {
directory "/var/cache/bind"; directory "/var/cache/bind";
@ -92,7 +97,8 @@ options {
}; };
EOF EOF
mkdir -p /var/lib/samba/bind-dns/dns mkdir -p /var/lib/samba/bind-dns/dns
fi
# stop + disable samba services and remove default config # stop + disable samba services and remove default config
systemctl stop smbd nmbd winbind systemctl stop smbd nmbd winbind
@ -103,12 +109,12 @@ rm -f /etc/krb5.conf
source /root/zamba.conf source /root/zamba.conf
# provision zamba domain # provision zamba domain
samba-tool domain provision --use-rfc2307 --realm=$ZMB_REALM --domain=$ZMB_DOMAIN --adminpass=$ZMB_ADMIN_PASS --server-role=dc --backend-store=mdb --dns-backend=BIND9_DLZ samba-tool domain provision --use-rfc2307 --realm=$ZMB_REALM --domain=$ZMB_DOMAIN --adminpass=$ZMB_ADMIN_PASS --server-role=dc --backend-store=mdb --dns-backend=$ZMB_DNS_BACKEND
ln -sf /var/lib/samba/private/krb5.conf /etc/krb5.conf ln -sf /var/lib/samba/private/krb5.conf /etc/krb5.conf
systemctl unmask samba-ad-dc systemctl unmask samba-ad-dc
systemctl enable samba-ad-dc bind9 systemctl enable samba-ad-dc $BINDNINE
systemctl restart samba-ad-dc bind9 systemctl restart samba-ad-dc $BINDNINE
exit 0 exit 0