convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style
Differences
This shows you the differences between two versions of the page.
Next revision
|
Previous revision
|
convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style [2019/02/05 11:52] admin created |
convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style [2020/04/08 21:28] admin |
Requirements | ====== Convert tinydns data format to zone file format described by RFC 1035 (bind-style) ====== |
* Access to tinydns' data file | This simple script converts the content of tinydns' data file into separate zone files - one zone file per domain. The major conversion is done by the axfrdns program which is part of [[https://cr.yp.to/djbdns.html|djbdns]]. |
| |
| |
| ===== Requirements ===== |
| * Access to tinydns' data file - the script below assumes its location in /etc/tinydns/root. If it is located in a different path simply adjust the script. |
* [[https://cr.yp.to/djbdns/axfrdns.html|axfrdns program]] running | * [[https://cr.yp.to/djbdns/axfrdns.html|axfrdns program]] running |
| |
| ===== Setting up axfrdns ===== |
| Use [[https://cr.yp.to/djbdns/axfrdns-conf.html|axfrdns-conf]]. Make sure that the user account //gaxfrdns// and the group //gdnslog// exists. The following lines will set up axfrdns to listen on 127.0.0.1 and to control the process via daemontools. |
| axfrdns-conf gaxfrdns gdnslog /etc/axfrdns /etc/tinydns 127.0.0.1 |
| ln -s /etc/axfrdns /etc/service |
| |
| ===== Conversion Script ===== |
#!/bin/bash | #!/bin/bash |
| |
set -e | set -e |
cd /etc/tinydns/root | cd /etc/tinydns/root |
dig +nostats +onesoa +nocmd @127.0.0.1 AXFR $domain | \ | 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 | 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 | done |
| |
convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style.txt · Last modified: 2020/04/08 21:28 by admin