premier commit
This commit is contained in:
commit
8a606a3209
8
README.md
Normal file
8
README.md
Normal file
@ -0,0 +1,8 @@
|
||||
# BTS SIO - Scripts divers
|
||||
|
||||
## bind
|
||||
* script bash **mkzone** : crée les fichiers suivants
|
||||
* **named.conf.local**,
|
||||
* **db.zone** : fichier de zone directe
|
||||
* **db.zone.rev** : fichier de zone inverse
|
||||
|
89
bind/mkzone
Executable file
89
bind/mkzone
Executable file
@ -0,0 +1,89 @@
|
||||
#/bin/bash
|
||||
set -u
|
||||
set -e
|
||||
|
||||
readonly zone="domaine.lan"
|
||||
readonly zonerev="1.168.192.in-addr.arpa"
|
||||
readonly nsname="ns"
|
||||
readonly nsip="192.168.1.10"
|
||||
readonly nsiprev=$(echo ${nsip}|cut -d. -f4)
|
||||
readonly nsname2="ns2"
|
||||
readonly nsip2="192.168.1.11"
|
||||
readonly nsiprev2=$(echo ${nsip2}|cut -d. -f4)
|
||||
readonly ttl="86400"
|
||||
|
||||
readonly nsfqdn="${nsname}.${zone}"
|
||||
readonly nsfqdnp="${nsfqdn}."
|
||||
readonly zonep="${zone}."
|
||||
readonly date=$(date +%Y%m%d00)
|
||||
|
||||
|
||||
cat <<EOT > "named.conf.local"
|
||||
|
||||
; fichier zone ${zone}
|
||||
; le $(date)
|
||||
|
||||
zone "${zone}" {
|
||||
type master;
|
||||
file "/etc/bind/db.${zone}"; # zone dircete
|
||||
};
|
||||
|
||||
zone "${zonerev}" {
|
||||
type master;
|
||||
file "/etc/bind/db.${zone}.rev"; # zone inverse
|
||||
};
|
||||
|
||||
EOT
|
||||
|
||||
|
||||
cat <<EOT > "db.${zone}"
|
||||
; fichier zone ${zone}
|
||||
; le $(date)
|
||||
\$TTL ${ttl} ; (1 day)
|
||||
\$ORIGIN ${zonep}
|
||||
@ IN SOA ${nsfqdnp} root.${nsfqdnp} (
|
||||
${date} ; serial YYYYMMDDnn
|
||||
14400 ; refresh (4 hours)
|
||||
1800 ; retry (30 minutes)
|
||||
1209600 ; expire (2 weeks)
|
||||
3600 ; minimum (1 hour)
|
||||
)
|
||||
|
||||
IN NS ${nsname}
|
||||
IN NS ${nsname2}
|
||||
|
||||
IN A 203.0.113.10
|
||||
IN AAAA 2001:DB8:BEEF:113::10
|
||||
www IN CNAME ${nsfqdnp}
|
||||
ftp IN CNAME ${nsfqdnp}
|
||||
|
||||
${nsname} IN A ${nsip}
|
||||
IN AAAA 2001:DB8:BEEF:2::22
|
||||
${nsname2} IN A ${nsip2}
|
||||
IN AAAA 2001:DB8:BEEF:100::22
|
||||
|
||||
EOT
|
||||
|
||||
cat <<EOT > "db.${zone}.rev"
|
||||
; fichier zone inverse ${zone}
|
||||
; le $(date)
|
||||
\$TTL ${ttl} ; (1 day)
|
||||
\$ORIGIN ${zonep}
|
||||
@ IN SOA ${nsfqdnp} root.${nsfqdnp} (
|
||||
${date} ; serial YYYYMMDDnn
|
||||
14400 ; refresh (4 hours)
|
||||
1800 ; retry (30 minutes)
|
||||
1209600 ; expire (2 weeks)
|
||||
3600 ; minimum (1 hour)
|
||||
)
|
||||
|
||||
IN NS ${nsname}
|
||||
IN NS ${nsname2}
|
||||
|
||||
10 IN PTR
|
||||
|
||||
${nsiprev} IN PTR ${nsname}
|
||||
${nsiprev2} IN PTR ${nsname2}
|
||||
|
||||
EOT
|
||||
|
Loading…
x
Reference in New Issue
Block a user