gen_dns.sh 1.41 KB
Newer Older
1 2
#! /bin/sh

3
SAP_TXT="/tmp/chaines_recup_sap.txt"
4 5 6 7 8 9 10

DB_TV="/etc/bind/generated/db.tv.crans.org"
DB_239="/etc/bind/generated/db.239.in-addr.arpa"

cat > $DB_TV <<EOF
\$ORIGIN tv.crans.org.
\$TTL 86400
11
@       IN      SOA mdr.crans.org. root.crans.org. (
12 13 14 15 16 17 18 19
$(date +%s) ; numero de serie
21600 ; refresh (s)
3600 ; retry (s)
1209600 ; expire (s)
86400 ; TTL (s)
)

; DNS de la zone par ordre de priorit
20
@       IN      NS mdr.crans.org.
21
@       IN      NS charybde.crans.org.
22 23
@       IN      NS freebox.crans.org.

24
@       IN      A  138.231.136.243
25 26 27

EOF

28
sed -r 's/(fra|eng|ger|ara|rom|rad|rus|ned|ita|vo|x-ero|autres|sport|TNT[0-9]{2})//g' $SAP_TXT | sed "s/[ _()'\"]//g" | tr A-Z a-z | awk -F ':' '{ gsub("\\.","",$1 ); print $1 "\tIN\tA\t" $NF }' >> $DB_TV
29 30 31 32

cat > $DB_239 <<EOF
\$ORIGIN 239.in-addr.arpa.
\$TTL 86400
33
@       IN      SOA mdr.crans.org. root.crans.org. (
34 35 36 37 38 39 40 41
$(date +%s) ; numero de serie
21600 ; refresh (s)
3600 ; retry (s)
1209600 ; expire (s)
86400 ; TTL (s)
)

; DNS de la zone par ordre de priorit
42
@       IN      NS mdr.crans.org.
43
@       IN      NS charybde.crans.org.
44 45 46 47
@       IN      NS freebox.crans.org.

EOF

48
sed -r 's/(fra|eng|ger|ara|rom|rad|rus|ned|ita|vo|x-ero|autres|sport|TNT[0-9]{2})//g' \
49 50
      $SAP_TXT | sed "s/[ _()'\"]//g" | tr A-Z a-z \
      | awk -F ':' '{gsub("\\.","",$1 ); split($NF,ip,"."); print ip[4]"."ip[3]"."ip[2] "\tIN\tPTR\t" $1 ".tv.crans.org."}' >> $DB_239
51

52
/etc/init.d/bind9 reload 1> /dev/null