tor/src/config
Karsten Loesing 66a04a6ac3 Clarify who learns about ContactInfo.
Explicitly include bridges, and note that we archive and publish all
descriptors.

(We are not yet publishing ContactInfo lines contained in bridge
descriptors, but maybe we'll want to do that soon, so let's err on the
side of caution here.)

Related to #9854.
2013-10-09 09:43:18 -04:00
..
deanonymind.py Add script to fix "A1" entries in geoip file. 2012-11-27 21:24:07 -05:00
geoip Update to the September 2013 GeoIP database. 2013-09-10 15:00:06 +02:00
geoip6 Update geoip6. 2012-10-17 10:54:53 +02:00
geoip-manual Comment out now obsolete change in geoip-manual. 2013-02-08 14:42:07 +01:00
include.am Actually distribute the geoip6 file. 2012-11-13 21:24:28 -05:00
README.geoip Add script to fix "A1" entries in geoip file. 2012-11-27 21:24:07 -05:00
torrc.sample.in Clarify who learns about ContactInfo. 2013-10-09 09:43:18 -04:00

README.geoip -- information on the IP-to-country-code file shipped with tor
===========================================================================

The IP-to-country-code file in src/config/geoip is based on MaxMind's
GeoLite Country database with the following modifications:

 - Those "A1" ("Anonymous Proxy") entries lying inbetween two entries with
   the same country code are automatically changed to that country code.
   These changes can be overriden by specifying a different country code
   in src/config/geoip-manual.

 - Other "A1" entries are replaced with country codes specified in
   src/config/geoip-manual, or are left as is if there is no corresponding
   entry in that file.  Even non-"A1" entries can be modified by adding a
   replacement entry to src/config/geoip-manual.  Handle with care.


1. Updating the geoip file from a MaxMind database file
-------------------------------------------------------

Download the most recent MaxMind GeoLite Country database:
http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip

Run `python deanonymind.py` in the local directory.  Review the output to
learn about applied automatic/manual changes and watch out for any
warnings.

Possibly edit geoip-manual to make more/fewer/different manual changes and
re-run `python deanonymind.py`.

When done, prepend the new geoip file with a comment like this:

  # Last updated based on $DATE Maxmind GeoLite Country
  # See README.geoip for details on the conversion.


2. Verifying automatic and manual changes using diff
----------------------------------------------------

To unzip the original MaxMind file and look at the automatic changes, run:

  unzip GeoIPCountryCSV.zip
  diff -U1 GeoIPCountryWhois.csv AutomaticGeoIPCountryWhois.csv

To look at subsequent manual changes, run:

  diff -U1 AutomaticGeoIPCountryWhois.csv ManualGeoIPCountryWhois.csv

To manually generate the geoip file and compare it to the automatically
created one, run:

  cut -d, -f3-5 < ManualGeoIPCountryWhois.csv | sed 's/"//g' > mygeoip
  diff -U1 geoip mygeoip


3. Verifying automatic and manual changes using blockfinder
-----------------------------------------------------------

Blockfinder is a powerful tool to handle multiple IP-to-country data
sources.  Blockfinder has a function to specify a country code and compare
conflicting country code assignments in different data sources.

We can use blockfinder to compare A1 entries in the original MaxMind file
with the same or overlapping blocks in the file generated above and in the
RIR delegation files:

  git clone https://github.com/ioerror/blockfinder
  cd blockfinder/
  python blockfinder -i
  python blockfinder -r ../GeoIPCountryWhois.csv
  python blockfinder -r ../ManualGeoIPCountryWhois.csv
  python blockfinder -p A1 > A1-comparison.txt

The output marks conflicts between assignments using either '*' in case of
two different opinions or '#' for three or more different opinions about
the country code for a given block.

The '*' conflicts are most likely harmless, because there will always be
at least two opinions with the original MaxMind file saying A1 and the
other two sources saying something more meaningful.

However, watch out for '#' conflicts.  In these cases, the original
MaxMind file ("A1"), the updated MaxMind file (hopefully the correct
country code), and the RIR delegation files (some other country code) all
disagree.

There are perfectly valid cases where the updated MaxMind file and the RIR
delegation files don't agree.  But each of those cases must be verified
manually.