Skip to main content

anonymiseip: A web service to anonymise IP addresses

Copyright (c) 2011, Canonical Ltd

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

anonymiseip anonymises IPv4 addresses using the MaxMind GeoIP database. Source addresses are mapped to country level, then assigned a different address from within that pool. To avoid known address back-mapping, the source address is hashed, and the hash taken mod pool-size to pick the new address. As IPv4 address space is very small, this is still vulnerable to brute forcing - its feasible to generate every single mapping, and if a single mapping is found it would be possible to cater for salted hashes as well. As such, this is not suitable for protecting against malicious attacks, it is however suitable to use when ensuring employees do not have casual access to the IP address from weblogs, which count as personally identifying information, while still giving employees access to the same logs so they can look at usage patterns and troubleshoot slow requests etc.

To anonymise an IPv4 address, perform a GET to /ipv4/x.y.z.a, the response will be a 200 OK + the new ip address, or a 5xx error.

Dependencies

  • Python 2.6+

  • Maxmind GeoIP Python library and a country level database.

Installation

Run python -m anonymiseip.main in an environment with all the dependencies available. Alternatively run ./bootstrap.py to create bin/buildout, then bin/buildout to create a bin/py and finally bin/py -m gpverify.main.

Note that the GeoIP Python library and database may have to be installed by hand. On Ubuntu systems they are available in the python-geoip and geoip-database packages respectively. Anonymiseip looks for the database in ‘/usr/share/GeoIP/GeoIP.dat’.

Testing

anonymiseip is stateless and fast, so just use it directly for testing.

Pass –host 0.0.0.0 –port 0 will cause a port to be dynamically allocated and printed out, which your test driver can then use.

Release files for anonymiseip 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for anonymiseip 0.0.1
File Size Uploaded
anonymiseip-0.0.1.tar.gz 3.3 kB Details

Release files / anonymiseip-0.0.1.tar.gz

Download URL anonymiseip-0.0.1.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b65d23cc4be638b3e425cd9e1148960e6698ef02f0583cb314d26d2c423df275
BLAKE2b-256 checksum
How to use checksums
d9c7a382ce43dd7c0da645ce42d921b028251405dac31bb03042e6df7e6d2b9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page