Status poll opens a real authenticated root SSH login to the target host every 30 seconds… #2

Closed
opened 2026-11-02 13:19:08 +00:00 by luke · 0 comments
Owner

Reported from the pi-chat app.

Status poll opens a real authenticated root SSH login to the target host every 30 seconds

Every open browser tab makes the app SSH into the target host twice a minute just to light a status dot. On our Proxmox host one idle client produces ~2 root logins a minute; across 24 hours the host logged 3,648 accepted publickey logins from the pi-chat container, all with the same key, and 6,248 logind 'New session' entries in the same window.

The chain (build a63ee57):

  • web/src/lib/boot.ts:137-138 — setTimeout(checkStatus, 1000) then setInterval(checkStatus, 30_000), running for as long as any tab is open.
  • web/src/lib/data.ts:937 + 945 — checkStatus() fetches api/health AND api/ssh-status.
  • src/server.ts:850-861 — GET /api/ssh-status runs execFile("ssh", [...SSH_ARGS, "-o", "ConnectTimeout=3", "pi-chat", "echo ok"]), i.e. a full authenticated login as root inside the container, per request.

Host-side evidence (voyager, 02/11/2026):

  • idle single client: exactly ~2 'Accepted publickey for root from 192.168.10.61' lines per minute
  • last 24 h: 3,648 accepted logins from 192.168.10.61, all key ED25519 SHA256:0XwEt88kWBg4uvu/VYg64A31Jec+L79neg3QAUlXJYE
  • systemd-logind: 6,248 'New session' in the same 24 h

Why it matters: every poll spawns an ssh child, runs the PAM stack, creates and tears down a logind session and writes to the host journal — per client, per 30 s. It also drowns real root logins in the host's auth log, and it made a 'Session logged out' timeline during a host shutdown unreadable because every entry was a poll, not a person. With 3-6 tabs open the logins land every few seconds, which is exactly how this first looked like a rogue process on the host.

Suggested fix, in order of preference:

  1. Memoise /api/ssh-status server-side for ~60 s (a few lines, keeps the dot accurate) AND
  2. probe TCP :22 instead of authenticating, so no session is created at all.
  3. Failing those, drop ssh-status from the 30 s loop entirely and test on demand — Settings → SSH already tests the connection on save, so the dot can reflect the last known result.

The health dot does not need a live SSH login to be useful: /api/health already answers 'is the server up', so the SSH indicator can be a cheap reachability check.

What I expected

The status dot should not authenticate to the SSH target at all, or at most once a minute regardless of how many tabs are open. A status probe should be cheap: TCP connect to :22, or a cached result of the last real connection test.

Severity Annoying — it works, but badly
Area SSH / status
Reported by Ian Jameson
Reported from ian-pi (5fde841d) · dev
Filed 2026-11-02 13:19 UTC
Version a63ee57 (a63ee57)
Browser Safari / Chrome (multiple clients and tabs open simultaneously)
Locale en-GB

Attachments, if any, are attached to this issue by the app.

**Reported from the pi-chat app.** Status poll opens a real authenticated root SSH login to the target host every 30 seconds Every open browser tab makes the app SSH into the target host twice a minute just to light a status dot. On our Proxmox host one idle client produces ~2 root logins a minute; across 24 hours the host logged 3,648 accepted publickey logins from the pi-chat container, all with the same key, and 6,248 logind 'New session' entries in the same window. The chain (build a63ee57): - web/src/lib/boot.ts:137-138 — setTimeout(checkStatus, 1000) then setInterval(checkStatus, 30_000), running for as long as any tab is open. - web/src/lib/data.ts:937 + 945 — checkStatus() fetches api/health AND api/ssh-status. - src/server.ts:850-861 — GET /api/ssh-status runs execFile("ssh", [...SSH_ARGS, "-o", "ConnectTimeout=3", "pi-chat", "echo ok"]), i.e. a full authenticated login as root inside the container, per request. Host-side evidence (voyager, 02/11/2026): - idle single client: exactly ~2 'Accepted publickey for root from 192.168.10.61' lines per minute - last 24 h: 3,648 accepted logins from 192.168.10.61, all key ED25519 SHA256:0XwEt88kWBg4uvu/VYg64A31Jec+L79neg3QAUlXJYE - systemd-logind: 6,248 'New session' in the same 24 h Why it matters: every poll spawns an ssh child, runs the PAM stack, creates and tears down a logind session and writes to the host journal — per client, per 30 s. It also drowns real root logins in the host's auth log, and it made a 'Session logged out' timeline during a host shutdown unreadable because every entry was a poll, not a person. With 3-6 tabs open the logins land every few seconds, which is exactly how this first looked like a rogue process on the host. Suggested fix, in order of preference: 1. Memoise /api/ssh-status server-side for ~60 s (a few lines, keeps the dot accurate) AND 2. probe TCP :22 instead of authenticating, so no session is created at all. 3. Failing those, drop ssh-status from the 30 s loop entirely and test on demand — Settings → SSH already tests the connection on save, so the dot can reflect the last known result. The health dot does not need a live SSH login to be useful: /api/health already answers 'is the server up', so the SSH indicator can be a cheap reachability check. **What I expected** The status dot should not authenticate to the SSH target at all, or at most once a minute regardless of how many tabs are open. A status probe should be cheap: TCP connect to :22, or a cached result of the last real connection test. | | | | --- | --- | | Severity | Annoying — it works, but badly | | Area | SSH / status | | Reported by | Ian Jameson | | Reported from | ian-pi (5fde841d) · dev | | Filed | 2026-11-02 13:19 UTC | | Version | a63ee57 (a63ee57) | | Browser | Safari / Chrome (multiple clients and tabs open simultaneously) | | Locale | en-GB | _Attachments, if any, are attached to this issue by the app._
luke closed this issue 2026-11-02 14:35:32 +00:00
Sign in to join this conversation.
No labels
bug
from-app
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gsylabsgg/pi-chat#2
No description provided.