feat: terminal as a chosen OS user, create users from the panel (0.0.2)

- agent reports the OS user it runs as (enroll + poll header)
- per-machine terminal user on the edit page; defaults to the agent's own user (root on Linux)
- create a new user from the panel: name, password, optional sudo group
- show the reason in the terminal when a shell fails to start
- bump version to 0.0.2
This commit is contained in:
redtea committed 2026-10-13 01:28:57 +03:00
1 parent be7fbabd9e
commit 3dde07f403
18 files changed
+530 -45

No files matched your search

+12 -4
View File
@@ -82,10 +82,11 @@ func (h *Hub) newSession(agentID string) *Session {
return s
}
// CreateSession registers a terminal session and queues it for the agent.
func (h *Hub) CreateSession(agentID string) *Session {
// CreateSession registers a terminal session and queues it for the agent. user
// is the OS user to run the shell as ("" = the agent's own user).
func (h *Hub) CreateSession(agentID, user string) *Session {
s := h.newSession(agentID)
h.enqueueJob(agentID, proto.ControlMessage{Type: proto.CtrlOpenTerminal, SessionID: s.ID})
h.enqueueJob(agentID, proto.ControlMessage{Type: proto.CtrlOpenTerminal, SessionID: s.ID, User: user})
return s
}
@@ -245,7 +246,14 @@ func (s *Session) PollOut(timeout time.Duration) ([]proto.OutMessage, bool) {
case <-time.After(timeout):
return nil, true
case <-s.closed:
return nil, false
// Hand over output queued before the close (e.g. the reason a shell
// failed to start) instead of dropping it.
select {
case m := <-s.out:
batch = append(batch, m)
default:
return nil, false
}
}
for {
select {