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