Security¶
SQMeter is an observatory instrument designed to run on a trusted LAN. This page describes the security model, what HTTP auth protects, and recommended deployment.
Threat model¶
SQMeter assumes the local network is trusted. The main risks on a typical home or observatory LAN are:
- Unauthorised config changes — any device on the same WiFi segment can call
POST /api/configand change settings, including WiFi credentials or MQTT broker. - Unauthorised OTA updates — any device on the LAN can flash new firmware or a new filesystem image via
POST /api/update. - Credential exposure — credentials sent over HTTP are visible to passive LAN observers. SQMeter does not support TLS.
- Restart/reboot abuse —
POST /api/restartis unauthenticated by default; any LAN device can reboot the device. - Shared passwords — with password sharing on, anything that has the device password can read the MQTT password, ntfy token and Pushover keys.
SQMeter does not defend against:
- An attacker who already has LAN access and captures HTTP traffic (no TLS).
- Brute-force attacks; there is no rate limiting or account lockout. (
/api/secretsthrottles wrong logins on that one request, which doesn't protect the password: every other protected route still accepts guesses.) - Remote internet attackers — do not expose the device to the public internet.
Over IPv6 the device only accepts requests from link-local addresses and its own network prefixes (IPv6), so a router that lets IPv6 in doesn't open it to the internet by itself. That's a backstop, not protection: keep it behind your firewall.
HTTP authentication¶
HTTP Basic Auth can be enabled to require credentials on mutation endpoints. This is disabled by default.
Protected endpoints (when auth is enabled)¶
| Endpoint | Method | Purpose |
|---|---|---|
/api/config |
POST / PUT | Save configuration |
/api/backup, /api/backup/preview, /api/backup/apply |
POST | Back up and restore settings |
/api/secrets |
GET | Passwords for a paired device; refused unless sharing is on and protection is on |
/api/restart |
POST | Reboot device |
/api/update |
POST | Flash firmware OTA |
/api/update/fs |
POST | Flash filesystem OTA |
/api/updates/check |
GET | Check GitHub for updates |
/api/updates/apply |
POST | Install an update from GitHub |
/api/wifi/scan |
GET | Scan for WiFi networks (starts a radio scan) |
/api/wifi/connect |
POST | Change WiFi network |
/api/mqtt/test |
POST | Test MQTT broker connection |
/api/alerts/test |
POST | Send a test alert |
/api/alerts/arm, /api/alerts/disarm |
POST | Resume / pause alerts |
/api/safety/hold, /api/safety/hold/<id>, /api/safety/hold/<id>/clear |
POST / DELETE | Set or clear a safety hold (MQTT <base>/safety/hold/set relies on the broker's access control) |
/api/alerts/clear |
POST | Clear the recent-alerts list |
/api/ble/ack, /api/ble/forget-bonds |
POST | Acknowledge the phone alarm / unpair phones |
/api/sensors/tsl2591/calibrate-dark |
POST | Store the light sensor dark offset |
/api/sensors/rg15/test, /reset-total, /reboot |
POST | RG-15 commands |
/api/display/wake, /api/display/blank |
POST | Wake or blank the OLED display |
/api/i18n/install, /api/i18n/upload |
POST | Install a language pack (from the release or a file) |
Unprotected endpoints (always accessible)¶
| Endpoint | Method | Purpose |
|---|---|---|
/api/sensors |
GET | Current sensor readings |
/api/status |
GET | System status |
/api/config |
GET | Read config (passwords, keys and tokens masked) |
/api/safe, /api/safety, /api/safety/history |
GET | Safety verdict, reasons and history |
/api/alerts/recent, /api/alerts/armed |
GET | Recent alerts, sending or paused and why |
/api/settings/effective |
GET | Which settings are in effect, and why not (no secrets) |
/api/i18n |
GET | The device language and installed packs (the UI needs it before it can ask for the password) |
/setup |
GET | Alpaca setup pages: a redirect to Settings, which asks for the password on save |
/generate_204, /hotspot-detect.html and other captive-portal probes |
GET | On the SQM-Setup hotspot, a redirect to the WiFi setup screen; changes nothing |
/api/v1/..., /management/... |
GET / PUT | ASCOM Alpaca (the Alpaca spec has no auth) |
/ws/sensors |
WS | Live sensor stream |
/ws/status |
WS | Live status stream |
Read-only integrations (Home Assistant, scripts polling sensor data) continue to work without credentials when auth is enabled.
Every route and whether it needs the password is listed in tools/api/routes.json; CI fails if a new route isn't declared there, so a route can't ship open by accident.
Setup¶
- Open Settings → Device in the web UI.
- Under Security, turn on Password-protect changes.
- Set a username (default
admin) and a strong password. - Save.
Once saved, the browser will prompt for credentials on the next mutation request. Most browsers remember credentials per origin for the session.
Password masking and preservation¶
GET /api/config returns ******** for the auth password (and likewise for the WiFi/MQTT/OTA passwords, Pushover keys, ntfy token, webhook auth header and Bluetooth passkey). When you POST config back, sending ******** or an empty string preserves the stored password unchanged. Send null only to intentionally clear the password.
Password sharing¶
RoofRoof, or another device at the same observatory, can copy SQMeter's site settings. Most of them are in the open GET /api/config, but the secrets there are masked. Share passwords (Settings → Device → Security, sharing.secrets) lets that device read four of them from GET /api/secrets:
- the MQTT password;
- the ntfy access token;
- the Pushover user key and application token.
Nothing else is ever shared: not the WiFi password, the device password, the upload password, the webhook authorization or the Bluetooth passkey.
It is off by default, and it needs password protection on with a password. Without one, the switch can't be turned on, and the request is refused (403 "Set a web password in SQMeter before sharing passwords"). With sharing off the request is refused too (403 "Password sharing is off in SQMeter"). Otherwise every request needs the username and password (401 without them). Five wrong logins in a row (requests that send a username and password that don't match; a request with none doesn't count) lock this request for a minute (429, with Retry-After), whoever asks; ten minutes without a wrong login, or a restart, clears the count. The lock only throttles this one request. It does not protect the device password: every other password-protected route still answers guesses at full speed, so a strong password is what keeps it safe. The 200, 403 and 429 answers are marked Cache-Control: no-store (the 401 login challenge carries nothing secret), and the device log records which address the passwords were shared with, never the values.
What turning it on means
- Anything that knows the device password can read these four secrets, from anywhere on your network. Use a strong device password that nothing else uses.
- They travel as plain HTTP. SQMeter has no HTTPS, so anyone who can watch the network traffic between the two devices can read them, as they can the device password itself. Keep both devices on a private network or VLAN.
- Turn it off again once the paired device has copied them; it only needs them again when you change one.
Backups¶
A settings backup made without a passphrase holds no secret. With one, the secrets are encrypted on the device (AES-256-GCM, key from the passphrase with PBKDF2-HMAC-SHA256), so a lost backup file doesn't give away your passwords; a weak passphrase can still be guessed offline, so use a long one. The passphrase itself travels to the device over plain HTTP like the device password does, so back up and restore on your own network. See Backup & Restore.
Password reset / lockout¶
If you forget the HTTP auth credentials:
- Connect the device to a serial console (115200 baud).
- Factory-reset via NVS clear: flash a sketch that calls
nvs_flash_erase(), or useesptool.pyto erase NVS. - The device will start with default config (no auth).
Alternatively, if you have physical access and can reflash, flash the complete image from the latest release.
OTA security¶
Web OTA (/api/update, /api/update/fs) does not require authentication by default — any LAN device can push firmware. Enable HTTP auth to gate these endpoints.
Command-line ArduinoOTA is separate and controlled by the ota.enabled and ota.password config fields. It is disabled unless explicitly configured.
Recommendations¶
| Scenario | Recommendation |
|---|---|
| Home observatory, trusted LAN | Enable HTTP auth with a strong password |
| Shared network or observatory with multiple users | Enable HTTP auth; consider VLAN isolation |
| Public internet exposure | Do not do this. Place behind a VPN or firewall. |
| Sensitive automation (roof safety) | Validate sensor data independently; SQMeter is a monitor, not a safety controller |
What HTTP auth does not protect¶
- Traffic confidentiality: credentials and sensor data travel in plaintext over HTTP. Anyone who can observe the LAN can capture them.
- Physical access: someone with physical access to the device can reset it.
- Denial of service: unauthenticated read endpoints remain open and could be flooded.
- Replay attacks: no session management or CSRF protection.