add a bit more content for GeoIP
[mirror/dsa-wiki.git] / input / dsablog / 2009 / 06 / GeoIP.mdwn
1 DSA is currently play around with a patched version of bind9 (based on a
2 patch we received from kernel.org people) to implement GeoDNS for
3 security.debian.org. You might have noticed, that we currently have a
4 round robin list of up to seven hosts in the security.debian.org
5 rotation. Depending on time and luck your apt currently might pick a
6 host which is located half around the globe for you, resulting in
7 sometimes really slow download rates. 
8
9 ## Idea
10
11 The current idea is only present a list of security mirrors to you which
12 is located on the continent you live on. That won't work for all
13 continents at the moment, we are aware of that. For that reason we are
14 in paralell currently moving machines around the globe, to get that
15 fixed in foreseeable future.
16
17 ## Technique
18
19 The patch we used for bind9 uses
20 [libgeoip](http://packages.debian.org/geoip) and [MaxMind's GeoLite
21 Country database](http://www.maxmind.com/app/geolitecountry).
22
23 As we don't want to break security.debian.org at this stage of our
24 testing, we decided to add a new subdomain security.geo.debian.org which
25 with we are currently playing.
26
27 Having an ACL for EU defining all the countries belonging to the
28 European Subcontinent, a config sniplet for security.debian.org's zone
29 looks like this:
30
31 <pre>
32 // Europe
33 acl Europe {
34         country_AD;
35         country_AL;
36         country_AT;
37         country_AX;
38         country_BA;
39         country_BE;
40         country_BG;
41         country_BY;
42         country_CH;
43         country_CZ;
44         country_DE;
45         country_DK;
46         country_EE;
47         country_ES;
48         country_FI;
49         country_FO;
50         ...
51 }
52 </pre>
53
54 <pre>
55 view "EU" {
56         match-clients {
57                 EU;
58         };
59         zone "security.geo.debian.org" {
60                 type master;
61                 file "/etc/bind/zones/security.debian.org.EU.zone";
62                 notify no;
63         };
64 };
65 </pre>
66
67 To be sure we don't miss any contries, we added an additional view
68 default, to catch what we didn't catch with the country codes:
69
70 <pre>
71 view "other" {
72         match-clients { any; };
73         zone "security.geo.debian.org" {
74                 type master;
75                 file "/etc/bind/db.security.debian.org";
76                 notify no;
77         };
78 };
79 </pre>