User Tools

Site Tools


convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style

This is an old revision of the document!


Requirements

#!/bin/bash
set -e
cd /etc/tinydns/root
make
mkdir -p zone
SERIAL=$(date +%Y%m%d)01
grep "^\." data | cut -d: -f1 | uniq | cut -c2- | while read domain; do
   echo -e "; vim\\x3a ts=8" > zone/$domain.zone
   echo -e '$TTL 86400\n' >> zone/$domain.zone
   dig +nostats +onesoa +nocmd @127.0.0.1 AXFR $domain | \
   sed -e "s/\(.*\)2560\(.*SOA\t[^ ]\+ [^ ]\+ \)[0-9 ]\+/\1259200\2(\n\t$SERIAL ; serial\n\t3H         ; refresh\n\t1H         ; retry\n\t3W         ; expire\n\t600)       ; ttl neg caching/" >> zone/$domain.zone
done
rm -f zone/zones.conf
grep "^\." data | cut -d: -f1 | uniq | cut -c2- | while read domain; do
   sed -e "s/XXX/$domain/" zone-list-master.tpl >> zone/zones.conf.master
   sed -e "s/XXX/$domain/" zone-list-slave.tpl >> zone/zones.conf.slave
done
convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style.1549363953.txt.gz · Last modified: 2020/04/08 21:22 (external edit)