Web access control - dl9rdz/rdz_ttgo_sonde GitHub Wiki

Web access control

Disclaimer

Exposing the firmware’s web interface directly to the Internet is not encouraged. For that purpose, a TLS-terminated reverse proxy or VPN is recommended.

If you want to limit access to the web UI on your LAN (or behind your own secure remote access), you can protect sensitive actions with password-based roles using /user.txt on the device.

Default behaviour

  • Unauthenticated users have full access (backward compatible with older setups).

Defining users and roles

Edit /user.txt on the LittleFS filesystem. You can:

  • Upload it via file isystem upload feature, or
  • Edit it in the browser: http://<TTGO_IP>/edit.html?file=user.txt
    (or http://rdzsonde.local/edit.html?file=user.txt if mDNS works on your network).

Each non-comment line has the form:

Username,Level,Password
  • Username: empty string is allowed for the special “default / not logged in” rule (see below).
  • Level: single digit:
    • 0: No access (not yet supported, treated like read-only for now)
    • 1: Read-only (basic web UI and sonde data visible; no changes to configuration)
    • 2: Full access (can change config, upload files, OTA, etc.)
  • Password: used with the login form; authentication uses a SHA-256 digest (username:preauth:password) over HTTP (password is not sent in plain text)

Lines starting with # are comments.

Example file

# Username,Level,Password
# Level 0: No access (currently not supported / same as level 1)
# Level 1: Read access to basic web interface / sonde data
# Level 2: Full access
# First line (username/password empty): access without authentication
# Change first line to ",1," for requiring login for any config change etc.
,1,
admin,2,admin

Meaning:

  • First line ,1,: for the empty username (users who did not log in), the default role is 1 (read-only): you can browse basic pages and sonde data, but not change configuration
  • Second line admin,2,admin: user admin with password admin has level 2 (full access).

Security note: replace admin / admin with a strong password before relying on this in any real deployment.

Default full access for anonymous users

To keep the original “no login required” behaviour, the predefined user.txt grants level 2 for the empty user name

,2,

That means unauthenticated visitors are treated as full access (same as legacy behaviour when everyone could change everything without logging in).

Login page

Use "Login" button at bottom of main page

⚠️ **GitHub.com Fallback** ⚠️