diff --git a/rootfs/tmp/etc/bind/named.conf b/rootfs/tmp/etc/bind/named.conf index 228da60..65a1c94 100644 --- a/rootfs/tmp/etc/bind/named.conf +++ b/rootfs/tmp/etc/bind/named.conf @@ -8,7 +8,7 @@ key "backup-key" { algorithm hmac-sha512; secret "REPLACE_KEY_BACKUP"; }; ##################################################################### # access settings acl "all" { 0.0.0.0/0; ::/0; }; -acl "secondary" { REPLACE_DNS_SERVER_SECONDARY; }; +acl "secondary" { REPLACE_DNS_SERVER_SECONDARY }; acl "trusted" { 10.0.0.0/8; 127.0.0.0/8; 172.16.0.0/12; 192.168.0.0/16; }; acl "updates" { key "dhcp-key"; key "certbot."; }; acl "transfers" {key "dhcp-key"; key "certbot."; key "backup-key"; secondary; }; @@ -27,9 +27,9 @@ options { max-ncache-ttl 10800; max-udp-size 4096; notify yes; - also-notify { REPLACE_DNS_SERVER_SECONDARY; }; + also-notify { REPLACE_DNS_SERVER_SECONDARY }; allow-update { updates; }; - allow-update-forwarding { REPLACE_DNS_SERVER_SECONDARY; }; + allow-update-forwarding { REPLACE_DNS_SERVER_SECONDARY }; allow-transfer { trusted; }; transfer-format many-answers; allow-query { any; }; diff --git a/rootfs/usr/local/etc/docker/init.d/02-named.sh b/rootfs/usr/local/etc/docker/init.d/02-named.sh index 92fa18d..72200f4 100755 --- a/rootfs/usr/local/etc/docker/init.d/02-named.sh +++ b/rootfs/usr/local/etc/docker/init.d/02-named.sh @@ -250,6 +250,7 @@ __run_pre_execute_checks() { __update_conf_files() { local exitCode=0 # default exit code local sysname="${SERVER_NAME:-${FULL_DOMAIN_NAME:-$HOSTNAME}}" # set hostname + local secondary_ip="" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # delete files #__rm "" @@ -262,6 +263,12 @@ __update_conf_files() { touch "$LOG_DIR/$logfile" chmod -Rf 777 "$logfile" done + if [ -n "$DNS_SERVER_SECONDARY" ]; then + for ip in ${DNS_SERVER_SECONDARY//;/ }; do + secondary_ip+="$ip; " + done + fi + DNS_SERVER_SECONDARY="$secondary_ip" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # replace variables __replace "REPLACE_KEY_RNDC" "$KEY_RNDC" "$ETC_DIR/rndc.key" @@ -269,9 +276,13 @@ __update_conf_files() { __replace "REPLACE_KEY_DHCP" "$KEY_DHCP" "$NAMED_CONFIG_FILE" __replace "REPLACE_KEY_BACKUP" "$KEY_BACKUP" "$NAMED_CONFIG_FILE" __replace "REPLACE_KEY_CERTBOT" "$KEY_CERTBOT" "$NAMED_CONFIG_FILE" - __replace "REPLACE_DNS_SERVER_SECONDARY" "$DNS_SERVER_SECONDARY" "$NAMED_CONFIG_FILE" __find_replace "REPLACE_DNS_SERIAL" "$DNS_SERIAL" "$DATA_DIR/primary" __find_replace "REPLACE_DNS_SERIAL" "$DNS_SERIAL" "$DATA_DIR/secondary" + if [ -n "$DNS_SERVER_SECONDARY" ]; then + __replace "REPLACE_DNS_SERVER_SECONDARY" "$DNS_SERVER_SECONDARY" "$NAMED_CONFIG_FILE" + else + sed -i '/REPLACE_DNS_SERVER_SECONDARY/d' "$NAMED_CONFIG_FILE" + fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # define actions if [ -f "$CONF_DIR/custom.conf" ]; then