2023-09-07 17:50:05 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
. driglibash-base
|
2023-09-13 08:46:02 +00:00
|
|
|
. "$(where)/helper_functions.sh"
|
2023-09-07 17:50:05 +00:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
# Working variables
|
|
|
|
debian_bind_confdir="/etc/bind"
|
2023-09-13 08:46:02 +00:00
|
|
|
autoconf_separator=";;; Autogeneration. Do not write under this line! ;;;"
|
2023-09-07 17:50:05 +00:00
|
|
|
|
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
# File that contain "service target" lines
|
|
|
|
# With service a symbolic dns name and target an existing server hostname
|
2023-09-07 17:50:05 +00:00
|
|
|
servicefile="/docker/services.txt"
|
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
# The bind file containing server declarations
|
|
|
|
server_zone_file="template.db.jean-cloud.org"
|
2023-09-07 17:50:05 +00:00
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
# Where you want your DNS keys stored
|
|
|
|
keydir="$DATA_DIR/keys"
|
2023-09-07 17:50:05 +00:00
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
# IP of primary servers
|
|
|
|
primary_ips=""
|
2023-09-07 17:50:05 +00:00
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
# IP of secondary servers (for zone transfer)
|
|
|
|
secondary_ips="37.65.119.74"
|
2023-09-07 17:50:05 +00:00
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
# NS name
|
|
|
|
default_dns_name="shlago.jean-cloud.org."
|
2023-09-07 17:50:05 +00:00
|
|
|
|
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
run () {
|
|
|
|
if [ "$#" -ne 1 ] ; then
|
|
|
|
die "Usage: run <primary|secondary>"
|
|
|
|
fi
|
2023-09-07 17:50:05 +00:00
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
prepare
|
|
|
|
primary_ips="$primary_ips;$(fakeresolve_ip_list raku)"
|
|
|
|
secondary_ips="$secondary_ips;$(fakeresolve_ip_list shlago)"
|
2023-09-07 17:50:05 +00:00
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
if [ "$1" = "primary" ] ; then
|
|
|
|
create_primary_files
|
2023-09-07 17:50:05 +00:00
|
|
|
else
|
2023-09-13 08:46:02 +00:00
|
|
|
create_secondary_files
|
2023-09-07 17:50:05 +00:00
|
|
|
fi
|
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
restart
|
2023-09-07 17:50:05 +00:00
|
|
|
}
|
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
main () {
|
|
|
|
run primary
|
|
|
|
}
|
2023-09-07 17:50:05 +00:00
|
|
|
|
2023-09-13 08:46:02 +00:00
|
|
|
# Do not execute main if script is sourced
|
|
|
|
! (return 0 2>/dev/null) && main "$@" || true # return 0 whatever happends
|