Decline VNC approval early when no console user is logged in

This commit is contained in:
Viktor Liu
2026-05-23 19:15:01 +02:00
parent 544ebb3575
commit bde5c6fdcc
4 changed files with 44 additions and 0 deletions
+5
View File
@@ -431,6 +431,11 @@ func (s *Server) gateApproval(conn net.Conn, header *connectionHeader, connLog *
connLog.Warn("VNC connection rejected: approval required but no approver")
return false, ApprovalDecision{}
}
if s.serviceMode && !consoleHasInteractiveUser() {
rejectConnection(conn, codeMessage(RejectCodeNoConsoleUser, "no interactive user session"))
connLog.Info("VNC connection rejected: no interactive user session to approve")
return false, ApprovalDecision{}
}
info := ApprovalInfo{
SourceIP: sourceIPString(conn.RemoteAddr()),
Mode: modeString(header.mode),