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