diff --git a/doc.md b/doc.md index d91335e..edfd0ec 100644 --- a/doc.md +++ b/doc.md @@ -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`. diff --git a/results/telemetry.php b/results/telemetry.php index 7ef0839..b021759 100644 --- a/results/telemetry.php +++ b/results/telemetry.php @@ -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'); diff --git a/results/telemetry_settings.php b/results/telemetry_settings.php index 038bfb8..c4e87a9 100644 --- a/results/telemetry_settings.php +++ b/results/telemetry_settings.php @@ -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";