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