Skip to content

Commit 4458c69

Browse files
authored
Merge pull request #726 from mkl262/master
feat: allow to specify obfuscation salt string Thank you for contributing @mkl262
2 parents a1c4397 + 64e4c3b commit 4458c69

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

doc_docker.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Here's a list of additional environment variables available in this mode:
5959
* __`TITLE`__: Title of your speed test. Default value: `LibreSpeed`
6060
* __`TELEMETRY`__: Whether to enable telemetry or not. If enabled, you maybe want your data to be persisted. See below. Default value: `false`
6161
* __`ENABLE_ID_OBFUSCATION`__: When set to true with telemetry enabled, test IDs are obfuscated, to avoid exposing the database internal sequential IDs. Default value: `false`
62+
* __`OBFUSCATION_SALT`__: The salt string that is used to obfuscate the test IDs. The format shoud be a 2 byte hex string (e.g. `0x1234abcd`). If not specified, a random one will be generated.
6263
* __`REDACT_IP_ADDRESSES`__: When set to true with telemetry enabled, IP addresses and hostnames are redacted from the collected telemetry, for better privacy. Default value: `false`
6364
* __`DB_TYPE`__: When set to one of the supported DB-Backends it will use this instead of the default sqlite database backend. TELEMETRY has to be set to `true`. Also you have to create the database as described in [doc.md](doc.md#creating-the-database). Supported backend types are:
6465
* sqlite - no additional settings required

docker/entrypoint.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ if [[ "$TELEMETRY" == "true" && ("$MODE" == "frontend" || "$MODE" == "standalone
7878

7979
if [ "$ENABLE_ID_OBFUSCATION" == "true" ]; then
8080
sed -i s/\$enable_id_obfuscation\ =\ .*\;/\$enable_id_obfuscation\ =\ true\;/g /var/www/html/results/telemetry_settings.php
81+
if [ ! -z "$OBFUSCATION_SALT" ]; then
82+
if [[ "$OBFUSCATION_SALT" =~ ^0x[0-9a-fA-F]+$ ]]; then
83+
echo "<?php" > /var/www/html/results/idObfuscation_salt.php
84+
echo "\$OBFUSCATION_SALT = $OBFUSCATION_SALT;" >> /var/www/html/results/idObfuscation_salt.php
85+
else
86+
echo "WARNING: Invalid OBFUSCATION_SALT format. It must be a hex string (e.g., 0x1234abcd). Using random salt." >&2
87+
fi
88+
fi
8189
fi
8290

8391
if [ "$REDACT_IP_ADDRESSES" == "true" ]; then

0 commit comments

Comments
 (0)