Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
michael@556 | 1 | <file name="named.conf"> |
michael@556 | 2 | ## |
michael@556 | 3 | ## @l_prefix@/etc/bind/named.conf -- BIND configuration |
michael@556 | 4 | ## |
michael@556 | 5 | |
michael@556 | 6 | controls { |
michael@556 | 7 | unix "@l_prefix@/var/bind/named.ctl" |
michael@556 | 8 | perm 0600 owner @l_ruid@ group @l_rgid@ |
michael@556 | 9 | keys { "rndc-key"; }; |
michael@556 | 10 | #inet 127.0.0.1 port 953 |
michael@556 | 11 | #allow { 127.0.0.1; } |
michael@556 | 12 | #keys { "rndc-key"; }; |
michael@556 | 13 | }; |
michael@556 | 14 | |
michael@556 | 15 | include "@l_prefix@/etc/bind/rndc.key"; |
michael@556 | 16 | |
michael@556 | 17 | logging { |
michael@556 | 18 | channel logfile { |
michael@556 | 19 | file "@l_prefix@/var/bind/named.log"; |
michael@556 | 20 | severity info; |
michael@556 | 21 | print-category yes; |
michael@556 | 22 | print-severity no; |
michael@556 | 23 | print-time yes; |
michael@556 | 24 | }; |
michael@556 | 25 | category "default" { "logfile"; }; |
michael@556 | 26 | category "client" { "logfile"; }; |
michael@556 | 27 | category "config" { "logfile"; }; |
michael@556 | 28 | category "database" { "logfile"; }; |
michael@556 | 29 | category "delegation-only" { "logfile"; }; |
michael@556 | 30 | category "dispatch" { "logfile"; }; |
michael@556 | 31 | category "dnssec" { "logfile"; }; |
michael@556 | 32 | category "general" { "logfile"; }; |
michael@556 | 33 | category "lame-servers" { "logfile"; }; |
michael@556 | 34 | category "network" { "logfile"; }; |
michael@556 | 35 | category "notify" { "logfile"; }; |
michael@556 | 36 | category "queries" { "logfile"; }; |
michael@556 | 37 | category "resolver" { "logfile"; }; |
michael@556 | 38 | category "security" { "logfile"; }; |
michael@556 | 39 | category "update" { "logfile"; }; |
michael@556 | 40 | category "xfer-in" { "logfile"; }; |
michael@556 | 41 | category "xfer-out" { "logfile"; }; |
michael@556 | 42 | category "unmatched" { "null"; }; |
michael@556 | 43 | }; |
michael@556 | 44 | |
michael@556 | 45 | options { |
michael@556 | 46 | pid-file "@l_prefix@/var/bind/named.pid"; |
michael@556 | 47 | directory "@l_prefix@/etc/bind/named.db"; |
michael@556 | 48 | statistics-file "@l_prefix@/var/bind/named.stats"; |
michael@556 | 49 | allow-query { any; }; |
michael@556 | 50 | allow-transfer { any; }; |
michael@556 | 51 | allow-recursion { 127.0.0.0/8; }; |
michael@556 | 52 | recursion yes; |
michael@556 | 53 | transfers-in 10; |
michael@556 | 54 | transfers-per-ns 2; |
michael@556 | 55 | max-transfer-time-in 120; |
michael@556 | 56 | transfer-format one-answer; |
michael@556 | 57 | cleaning-interval 60; |
michael@556 | 58 | interface-interval 60; |
michael@556 | 59 | listen-on port 53 { 127.0.0.1; }; |
michael@556 | 60 | #query-source address 127.0.0.1 port *; |
michael@556 | 61 | #transfer-source 127.0.0.1; |
michael@556 | 62 | #notify-source 127.0.0.1; |
michael@556 | 63 | }; |
michael@556 | 64 | |
michael@556 | 65 | zone "." IN { |
michael@556 | 66 | type hint; |
michael@556 | 67 | file "db.root"; |
michael@556 | 68 | }; |
michael@556 | 69 | |
michael@556 | 70 | zone "localhost" IN { |
michael@556 | 71 | type master; |
michael@556 | 72 | file "db.localhost"; |
michael@556 | 73 | notify no; |
michael@556 | 74 | allow-update { none; }; |
michael@556 | 75 | allow-transfer { any; }; |
michael@556 | 76 | }; |
michael@556 | 77 | |
michael@556 | 78 | zone "0.0.127.in-addr.arpa" IN { |
michael@556 | 79 | type master; |
michael@556 | 80 | file "db.localhost.ipv4"; |
michael@556 | 81 | notify no; |
michael@556 | 82 | allow-update { none; }; |
michael@556 | 83 | allow-transfer { any; }; |
michael@556 | 84 | }; |
michael@556 | 85 | |
michael@556 | 86 | zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" { |
michael@556 | 87 | type master; |
michael@556 | 88 | file "db.localhost.ipv6"; |
michael@556 | 89 | notify no; |
michael@556 | 90 | allow-update { none; }; |
michael@556 | 91 | allow-transfer { any; }; |
michael@556 | 92 | }; |
michael@556 | 93 | |
michael@556 | 94 | </file> |
michael@556 | 95 | <file name="rndc.conf"> |
michael@556 | 96 | ## |
michael@556 | 97 | ## @l_prefix@/etc/bind/rndc.conf -- BIND rndc configuration |
michael@556 | 98 | ## |
michael@556 | 99 | |
michael@556 | 100 | options { |
michael@556 | 101 | default-server localhost-unix; |
michael@556 | 102 | }; |
michael@556 | 103 | |
michael@556 | 104 | server localhost-unix { |
michael@556 | 105 | addresses { "@l_prefix@/var/bind/named.ctl"; }; |
michael@556 | 106 | key "rndc-key"; |
michael@556 | 107 | }; |
michael@556 | 108 | |
michael@556 | 109 | server localhost-inet { |
michael@556 | 110 | addresses { 127.0.0.1; }; |
michael@556 | 111 | port 953; |
michael@556 | 112 | key "rndc-key"; |
michael@556 | 113 | }; |
michael@556 | 114 | |
michael@556 | 115 | include "@l_prefix@/etc/bind/rndc.key"; |
michael@556 | 116 | |
michael@556 | 117 | </file> |
michael@556 | 118 | <file name="named.db/db.root"> |
michael@556 | 119 | ;; |
michael@556 | 120 | ;; db.root -- Internet Root Nameservers |
michael@556 | 121 | ;; DO NOT EDIT, IT WAS AUTOMATICALLY CREATED ON 2011-02-06 BY db.root.sh! |
michael@556 | 122 | ;; |
michael@556 | 123 | |
michael@556 | 124 | . 99999999 IN NS A.ROOT-SERVERS.NET. |
michael@556 | 125 | . 99999999 IN NS B.ROOT-SERVERS.NET. |
michael@556 | 126 | . 99999999 IN NS C.ROOT-SERVERS.NET. |
michael@556 | 127 | . 99999999 IN NS D.ROOT-SERVERS.NET. |
michael@556 | 128 | . 99999999 IN NS E.ROOT-SERVERS.NET. |
michael@556 | 129 | . 99999999 IN NS F.ROOT-SERVERS.NET. |
michael@556 | 130 | . 99999999 IN NS G.ROOT-SERVERS.NET. |
michael@556 | 131 | . 99999999 IN NS H.ROOT-SERVERS.NET. |
michael@556 | 132 | . 99999999 IN NS I.ROOT-SERVERS.NET. |
michael@556 | 133 | . 99999999 IN NS J.ROOT-SERVERS.NET. |
michael@556 | 134 | . 99999999 IN NS K.ROOT-SERVERS.NET. |
michael@556 | 135 | . 99999999 IN NS L.ROOT-SERVERS.NET. |
michael@556 | 136 | . 99999999 IN NS M.ROOT-SERVERS.NET. |
michael@556 | 137 | A.ROOT-SERVERS.NET. 99999999 IN A 198.41.0.4 |
michael@556 | 138 | A.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:503:ba3e::2:30 |
michael@556 | 139 | B.ROOT-SERVERS.NET. 99999999 IN A 192.228.79.201 |
michael@556 | 140 | C.ROOT-SERVERS.NET. 99999999 IN A 192.33.4.12 |
michael@556 | 141 | D.ROOT-SERVERS.NET. 99999999 IN A 128.8.10.90 |
michael@556 | 142 | E.ROOT-SERVERS.NET. 99999999 IN A 192.203.230.10 |
michael@556 | 143 | F.ROOT-SERVERS.NET. 99999999 IN A 192.5.5.241 |
michael@556 | 144 | F.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:500:2f::f |
michael@556 | 145 | G.ROOT-SERVERS.NET. 99999999 IN A 192.112.36.4 |
michael@556 | 146 | H.ROOT-SERVERS.NET. 99999999 IN A 128.63.2.53 |
michael@556 | 147 | H.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:500:1::803f:235 |
michael@556 | 148 | I.ROOT-SERVERS.NET. 99999999 IN A 192.36.148.17 |
michael@556 | 149 | I.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:7fe::53 |
michael@556 | 150 | J.ROOT-SERVERS.NET. 99999999 IN A 192.58.128.30 |
michael@556 | 151 | J.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:503:c27::2:30 |
michael@556 | 152 | K.ROOT-SERVERS.NET. 99999999 IN A 193.0.14.129 |
michael@556 | 153 | K.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:7fd::1 |
michael@556 | 154 | L.ROOT-SERVERS.NET. 99999999 IN A 199.7.83.42 |
michael@556 | 155 | L.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:500:3::42 |
michael@556 | 156 | M.ROOT-SERVERS.NET. 99999999 IN A 202.12.27.33 |
michael@556 | 157 | M.ROOT-SERVERS.NET. 99999999 IN AAAA 2001:dc3::35 |
michael@556 | 158 | |
michael@556 | 159 | </file> |
michael@556 | 160 | <file name="named.db/db.root.sh"> |
michael@556 | 161 | #!/bin/sh |
michael@556 | 162 | |
michael@556 | 163 | ROOTFILE=./db.root |
michael@556 | 164 | |
michael@556 | 165 | echo '@l_prefix@' | egrep '^@l_' | egrep 'prefix@$' >/dev/null |
michael@556 | 166 | if [ $? -eq 0 ]; then |
michael@556 | 167 | CURL='curl' |
michael@556 | 168 | DIG='dig' |
michael@556 | 169 | else |
michael@556 | 170 | CURL='@l_prefix@/bin/openpkg curl' |
michael@556 | 171 | DIG='@l_prefix@/bin/dig' |
michael@556 | 172 | fi |
michael@556 | 173 | |
michael@556 | 174 | date=`date '+%Y-%m-%d'` |
michael@556 | 175 | cat >$ROOTFILE <<EOT |
michael@556 | 176 | ;; |
michael@556 | 177 | ;; db.root -- Internet Root Nameservers |
michael@556 | 178 | ;; DO NOT EDIT, IT WAS AUTOMATICALLY CREATED ON $date BY db.root.sh! |
michael@556 | 179 | ;; |
michael@556 | 180 | |
michael@556 | 181 | EOT |
michael@556 | 182 | |
michael@556 | 183 | $CURL -s -L ftp://ftp.internic.net/domain/named.root >$ROOTFILE.raw |
michael@556 | 184 | for i in A B C D E F G H I J K L M; do |
michael@556 | 185 | ${DIG} @$i.ROOT-SERVERS.NET . NS >>$ROOTFILE.raw |
michael@556 | 186 | done |
michael@556 | 187 | [ -f $ROOTFILE.raw ] || exit 1 |
michael@556 | 188 | awk <$ROOTFILE.raw ' |
michael@556 | 189 | /[ ]NS[ ]/ { printf("%-20s 99999999 IN NS %s\n", $1, toupper($NF)); } |
michael@556 | 190 | /[ ]AAAA[ ]/ { printf("%-20s 99999999 IN AAAA %s\n", toupper($1), tolower($NF)); } |
michael@556 | 191 | /[ ]A[ ]/ { printf("%-20s 99999999 IN A %s\n", toupper($1), tolower($NF)); } |
michael@556 | 192 | ' |\ |
michael@556 | 193 | egrep -v '^;' |\ |
michael@556 | 194 | sort -u >>$ROOTFILE |
michael@556 | 195 | echo "" >>$ROOTFILE |
michael@556 | 196 | rm $ROOTFILE.raw |
michael@556 | 197 | |
michael@556 | 198 | </file> |
michael@556 | 199 | <file name="named.db/db.localhost"> |
michael@556 | 200 | ;; |
michael@556 | 201 | ;; db.localhost -- zonefile for the forward mapping of the loopback network |
michael@556 | 202 | ;; |
michael@556 | 203 | |
michael@556 | 204 | $TTL 86400 |
michael@556 | 205 | |
michael@556 | 206 | @ IN SOA localhost. root.localhost. ( |
michael@556 | 207 | 2001010101 ; SERIAL |
michael@556 | 208 | 6H ; REFRESH: Secondaries refresh |
michael@556 | 209 | 60M ; RETRY: Secondaries retry |
michael@556 | 210 | 1W ; EXPIRE: Maximum TTL of data (expiry) |
michael@556 | 211 | 1D ; MINTTL: Minimum TTL of data (expiry) |
michael@556 | 212 | ) |
michael@556 | 213 | |
michael@556 | 214 | IN NS @ |
michael@556 | 215 | IN A 127.0.0.1 |
michael@556 | 216 | |
michael@556 | 217 | </file> |
michael@556 | 218 | <file name="named.db/db.localhost.ipv4"> |
michael@556 | 219 | ;; |
michael@556 | 220 | ;; db.localhost.ipv4 -- zonefile for the IPv4 reverse mapping of the loopback network |
michael@556 | 221 | ;; |
michael@556 | 222 | |
michael@556 | 223 | $TTL 86400 |
michael@556 | 224 | |
michael@556 | 225 | @ IN SOA localhost. root.localhost. ( |
michael@556 | 226 | 2001010101 ; SERIAL |
michael@556 | 227 | 6H ; REFRESH: Secondaries refresh |
michael@556 | 228 | 60M ; RETRY: Secondaries retry |
michael@556 | 229 | 1W ; EXPIRE: Maximum TTL of data (expiry) |
michael@556 | 230 | 1D ; MINTTL: Minimum TTL of data (expiry) |
michael@556 | 231 | ) |
michael@556 | 232 | |
michael@556 | 233 | IN NS @ |
michael@556 | 234 | 1 IN PTR localhost. |
michael@556 | 235 | |
michael@556 | 236 | </file> |
michael@556 | 237 | <file name="named.db/db.localhost.ipv6"> |
michael@556 | 238 | ;; |
michael@556 | 239 | ;; db.localhost.ipv6 -- zonefile for the IPv6 reverse mapping of the loopback network |
michael@556 | 240 | ;; |
michael@556 | 241 | |
michael@556 | 242 | $TTL 86400 |
michael@556 | 243 | |
michael@556 | 244 | @ IN SOA localhost. root.localhost. ( |
michael@556 | 245 | 2001010101 ; SERIAL |
michael@556 | 246 | 6H ; REFRESH: Secondaries refresh |
michael@556 | 247 | 60M ; RETRY: Secondaries retry |
michael@556 | 248 | 1W ; EXPIRE: Maximum TTL of data (expiry) |
michael@556 | 249 | 1D ; MINTTL: Minimum TTL of data (expiry) |
michael@556 | 250 | ) |
michael@556 | 251 | |
michael@556 | 252 | IN NS @ |
michael@556 | 253 | IN PTR localhost. |
michael@556 | 254 | |
michael@556 | 255 | </file> |