||4 years ago|
|demo||4 years ago|
|ipscrub||4 years ago|
|script||4 years ago|
|.gitignore||4 years ago|
|CNAME||4 years ago|
|Dockerfile||4 years ago|
|Makefile||4 years ago|
|README.md||4 years ago|
|_config.yml||4 years ago|
|docker-compose.yml||4 years ago|
ipscrub is an IP address anonymizer for nginx log files. It's an nginx module that generates an IP-based hash. You can use this hash to link requests from the same source, without identifying your users by IP address.
- On initialization, and again every
saltusing 128bits from
- On each request, generate masked IP address as
HASH(salt ++ IP address).
- Log masked IP address.
ALSO NOTE: the generated hash WILL change on each
PERIOD transition, so you will only have continuity within each
PERIOD. But because users can transition between networks at any time (e.g. wifi -> cellular), you'd have this type of issue even if you were storing raw IPs.
- Government presents you with an IP address and demands identification of user corresponding to that address.
- Government identifies a user e.g. by email address, and demands IP address they had at some point in time.
In threat scenario (1), the goal is to compute the masked IP corresponding to a target IP address. This will only be possible if the demand is made before the end of the current
Scenario (2) is defended against because the server operator does not know the salt, and cannot infer it based on the request timestamp, because the salt is generated from a nonce that is only stored in memory. The server operator would have to be an accomplice in this case, but that is more simply accomplished by the server operator just recording the unmasked IP. So this security/threat model does not defend against a malicious server operator, but that is not the point. It does defend against an honest server operator being compelled in threat scenarios (1) and (2).
Building From Source
ipscrub can be built statically with nginx or as a dynamic module. See the
Makefile for examples of both ways.
- At the top-level, load the module by adding the line
load_module ngx_ipscrub_module.so;(NOTE: only if you built as a dynamic module).
ipscrub_period_seconds <NUM SECONDS PER PERIOD>;(optional).
- In your
- Reload your nginx config.
NOTE: nginx may still leak IP addresses in the error log. If this is a concern, disable error logging or wipe the log regularly.
Checking for Updates
This will have a non-zero exit code if you aren't up-to-date, so you can automate regular checks.
- 1.0.1 fixed vulnerability to unmasking hashed IPs (thanks to @marcan)
- 1.0.0 initial release
GDPR goes into effect on May 25, 2018. It legislates the handling of personal data about your users, including IP addresses.
What constitutes personal data? Any information related to a natural person or ‘Data Subject’, that can be used to directly or indirectly identify the person. It can be anything from a name, a photo, [...], or a computer IP address.
The hashes generated by
ipscrub let you correlate nginx log entries by IP address, without actually storing IP addresses, reducing your GDPR surface area.
Copyright 2018 Mason Simon
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
If you would like to use