Ticket #567 (closed New feature: fixed)
Piwik_Common::getIP() - filter for public IP or from trusted proxy
| Reported by: | vipsoft | Owned by: | vipsoft |
|---|---|---|---|
| Priority: | normal | Milestone: | Piwik 1.1 |
| Component: | Core | Keywords: | |
| Cc: | Sensitive: | no |
Description (last modified by vipsoft) (diff)
Currently, getIp() only returns a single client IP address, looking at HTTP_CLIENT_IP, HTTP_X_FORWARD_FOR (XFF), and REMOTE_ADDR (in that order).
It's possible that getIp() returns a private IP address. We should make it configurable to return the first "public" IP address which can be geolocated, unless you want the current behavior (e.g., #1054 intranet subnet identification).
These are some private IP address ranges:
- 10.0.0.0 - 10.255.255.255
- 172.16.0.0 - 172.31.255.255
- 192.168.0.0 - 192.168.255.255
Another consideration is XFF spoofing (increasing popular with various browser addons). Perhaps we should log both the result from getIp() and REMOTE_ADDR?
(Above two scenarios may or may not involve a reverse proxy.)
Another consideration is #1553 ... the IP address from PiwikTracker should override any logic here.
