Some Denglish modification, and a link to the patch
[mirror/dsa-wiki.git] / input / dsablog / 2009 / 06 / Howto_setup_GeoDNS_for_security.debian.org.mdwn
1 DSA is currently playing 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 to only present a list of security mirrors to
12 you which are located on the continent you live on. We are aware that
13 this won't work for all continents at the moment. For this reason we
14 are also currently moving machines around the globe.
15
16 ## How to test
17
18 The easiest way for you to test is using bind9's dig command.
19
20 When trying from Germany one should get:
21 <pre>
22 zobel@lunar:~% dig -ttxt +short security.geo.debian.org
23 "Europe view"
24 </pre>
25
26 When trying from US one should get:
27 <pre>
28 zobel@gluck:~% dig -ttxt +short security.geo.debian.org
29 "North America view"
30 </pre>
31
32 ## Technique
33
34 The patch we used for bind9 uses
35 [libgeoip](http://packages.debian.org/geoip) and [MaxMind's GeoLite
36 Country database](http://www.maxmind.com/app/geolitecountry).
37 [This](http://vancouver.yorkcabal.org.uk/~steve/.bind/geoip.patch)
38 patch was necessary to get bind to play nicely.
39
40 As we don't want to break security.debian.org at this stage of our
41 testing, we decided to add a new subdomain security.geo.debian.org with
42 which we are currently playing.
43
44 Having an ACL for EU defining all the countries belonging to the
45 European Subcontinent, a config sniplet for security.debian.org's zone
46 looks like this:
47
48 <pre>
49 // Europe
50 acl EU {
51         country_AD;
52         country_AL;
53         country_AT;
54         country_AX;
55         country_BA;
56         country_BE;
57         country_BG;
58         country_BY;
59         country_CH;
60         country_CZ;
61         country_DE;
62         country_DK;
63         country_EE;
64         country_ES;
65         country_FI;
66         country_FO;
67         ...
68 }
69 </pre>
70
71 <pre>
72 view "EU" {
73         match-clients {
74                 EU;
75         };
76         zone "security.geo.debian.org" {
77                 type master;
78                 file "/etc/bind/zones/security.debian.org.EU.zone";
79                 notify no;
80         };
81 };
82 </pre>
83
84 To be sure we don't miss any contries, we added an additional view
85 default, to catch what we didn't catch with the country codes:
86
87 <pre>
88 view "other" {
89         match-clients { any; };
90         zone "security.geo.debian.org" {
91                 type master;
92                 file "/etc/bind/db.security.debian.org";
93                 notify no;
94         };
95 };
96 </pre>