Skip to content

enable transfer and NS server definition #66

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion envfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SHARED_SECRET=changeme
ZONE=example.org
RECORD_TTL=3600
RECORD_TTL=3600
NS=ns1.example.org,ns2.example.org
TRANSFERIP=192.168.100.5;192.168.100.6
33 changes: 31 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,19 @@ zone "$ZONE" {
type master;
file "$ZONE.zone";
allow-query { any; };
EOF

if [ ! -z $TRANSFERIP ]
then
cat >> /etc/bind/named.conf <<EOF
allow-transfer { $TRANSFERIP; };
EOF
else
cat >> /etc/bind/named.conf <<EOF
allow-transfer { none; };
EOF
fi
cat >> /etc/bind/named.conf <<EOF
allow-update { localhost; };
};
EOF
Expand All @@ -24,14 +36,31 @@ then
cat > /var/cache/bind/$ZONE.zone <<EOF
\$ORIGIN .
\$TTL 86400 ; 1 day
$ZONE IN SOA localhost. root.localhost. (
$ZONE IN SOA localhost. root.$ZONE. (
74 ; serial
3600 ; refresh (1 hour)
900 ; retry (15 minutes)
604800 ; expire (1 week)
86400 ; minimum (1 day)
)
NS localhost.
EOF

if [ ! -z $NS ]
then
array=(${NS//,/ })
for var in ${array[@]}
do
cat >> /var/cache/bind/$ZONE.zone <<EOF
NS $var
EOF
done
else
cat >> /var/cache/bind/$ZONE.zone <<EOF
NS localhost
EOF
fi

cat >> /var/cache/bind/$ZONE.zone <<EOF
\$ORIGIN ${ZONE}.
\$TTL ${RECORD_TTL}
EOF
Expand Down