User Tools

Site Tools


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.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style [2019/02/05 11:57]
admin
convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style [2020/04/08 21:28] (current)
admin
Line 1: Line 1:
 ====== Convert tinydns data format to zone file format described by RFC 1035 (bind-style) ====== ====== Convert tinydns data format to zone file format described by RFC 1035 (bind-style) ======
 +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+===== 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
  
-Script+===== 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
Line 20: Line 26:
      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   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 
- 
-== zone-list-master.tpl == 
-  <zone> 
-     domain      XXX 
-     file        masters/XXX.zone 
-     type        master 
-     #dnssec-policy           "normal-policy" 
-  </zone> 
-   
-== zone-list-slave.tpl == 
-  <zone> 
-     domain      XXX 
-     file        slaves/XXX.zone 
-     type        slave 
-     master      10.0.0.1 
-  </zone> 
-   
  
convert_tinydns_data_format_to_zone_file_format_described_by_rfc_1035_bind-style.1549364271.txt.gz · Last modified: 2020/04/08 21:22 (external edit)