IP addresses can now be redacted automatically from telemetry

This commit is contained in:
dosse91 2019-09-28 08:22:14 +02:00
parent 247b9c0e4c
commit a50fcfe566
3 changed files with 9 additions and 0 deletions

2
doc.md
View file

@ -101,6 +101,8 @@ To enable ID obfuscation, edit `results/telemetry_settings.php` and set `$enable
__Important:__ ID obfuscation currently only works on 64-bit PHP!
While you're editing `results/telemetry_settings.php`, you might want to set `$redact_ip_addresses` to `true`, this way, all IP addresses will be removed from the telemetry for better privacy. This is disabled by default.
##### Seeing the results
A basic front-end for visualizing and searching tests by ID is available in `results/stats.php`.

View file

@ -13,6 +13,12 @@ $ping=($_POST["ping"]);
$jitter=($_POST["jitter"]);
$log=($_POST["log"]);
if($redact_ip_addresses){
$ip="0.0.0.0";
$ispinfo=preg_replace('/((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}/',"0.0.0.0",preg_replace('/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:(?!$)|$)|\2))(?4){5}((?4){2}|((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?7)){3})/i',"0.0.0.0",$ispinfo));
$log=preg_replace('/((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?1)){3}/',"0.0.0.0",preg_replace('/(((?=(?>.*?(::))(?!.+\3)))\3?|([\dA-F]{1,4}(\3|:(?!$)|$)|\2))(?4){5}((?4){2}|((2[0-4]|1\d|[1-9])?\d|25[0-5])(\.(?7)){3})/i',"0.0.0.0",$log));
}
header('Cache-Control: no-store, no-cache, must-revalidate, max-age=0, s-maxage=0');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');

View file

@ -3,6 +3,7 @@
$db_type="mysql"; //Type of db: "mysql", "sqlite" or "postgresql"
$stats_password="PASSWORD"; //password to login to stats.php. Change this!!!
$enable_id_obfuscation=false; //if set to true, test IDs will be obfuscated to prevent users from guessing URLs of other tests
$redact_ip_addresses=false; //if set to true, IP addresses will be redacted from IP and ISP info fields, as well as the log
// Sqlite3 settings
$Sqlite_db_file = "../../speedtest_telemetry.sql";