Browse Source

feat: allow to specify obfuscation salt string

Michael Kanchuker 3 days ago
parent
commit
fd06e94de3
2 changed files with 5 additions and 0 deletions
  1. 1 0
      doc_docker.md
  2. 4 0
      docker/entrypoint.sh

+ 1 - 0
doc_docker.md

@@ -59,6 +59,7 @@ Here's a list of additional environment variables available in this mode:
 * __`TITLE`__: Title of your speed test. Default value: `LibreSpeed`
 * __`TELEMETRY`__: Whether to enable telemetry or not. If enabled, you maybe want your data to be persisted. See below. Default value: `false`
 * __`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`
+* __`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.
 * __`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`
 * __`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:
   * sqlite - no additional settings required

+ 4 - 0
docker/entrypoint.sh

@@ -78,6 +78,10 @@ if [[ "$TELEMETRY" == "true" && ("$MODE" == "frontend" || "$MODE" == "standalone
 
   if [ "$ENABLE_ID_OBFUSCATION" == "true" ]; then
     sed -i s/\$enable_id_obfuscation\ =\ .*\;/\$enable_id_obfuscation\ =\ true\;/g /var/www/html/results/telemetry_settings.php
+    if [ ! -z "$OBFUSCATION_SALT" ]; then
+      echo "<?php" > /var/www/html/results/idObfuscation_salt.php
+      echo "\$OBFUSCATION_SALT = $OBFUSCATION_SALT;" >> /var/www/html/results/idObfuscation_salt.php
+    fi
   fi
 
   if [ "$REDACT_IP_ADDRESSES" == "true" ]; then