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