Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Require proxy admin for SSH config endpoints

rcourtman5f2990deecb2
diff --git a/internal/api/router.go b/internal/api/router.go
index 48f9f58dd2..c9c13ba124 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -1902,6 +1902,18 @@ func (r *Router) handleVerifyTemperatureSSH(w http.ResponseWriter, req *http.Req
return
}
+ // Check admin privileges for proxy auth users
+ if r.config.ProxyAuthSecret != "" {
+ if valid, username, isAdmin := CheckProxyAuth(r.config, req); valid && !isAdmin {
+ log.Warn().
+ Str("ip", GetClientIP(req)).
+ Str("username", username).
+ Msg("Non-admin user attempted verify-temperature-ssh")
+ http.Error(w, "Admin privileges required", http.StatusForbidden)
+ return
+ }
+ }
+
// Require settings:write scope for API tokens (SSH probes are a privileged operation)
if !ensureScope(w, req, config.ScopeSettingsWrite) {
return
@@ -1943,6 +1955,18 @@ func (r *Router) handleSSHConfig(w http.ResponseWriter, req *http.Request) {
return
}
+ // Check admin privileges for proxy auth users
+ if r.config.ProxyAuthSecret != "" {
+ if valid, username, isAdmin := CheckProxyAuth(r.config, req); valid && !isAdmin {
+ log.Warn().
+ Str("ip", GetClientIP(req)).
+ Str("username", username).
+ Msg("Non-admin user attempted ssh-config update")
+ http.Error(w, "Admin privileges required", http.StatusForbidden)
+ return
+ }
+ }
+
// Require settings:write scope for API tokens (SSH config writes are a privileged operation)
if !ensureScope(w, req, config.ScopeSettingsWrite) {
return
diff --git a/internal/api/security_regression_test.go b/internal/api/security_regression_test.go
index efa7850940..e3e0bc1f35 100644
--- a/internal/api/security_regression_test.go
+++ b/internal/api/security_regression_test.go
@@ -1948,6 +1948,8 @@ func TestProxyAuthNonAdminDeniedAdminEndpoints(t *testing.T) {
{method: http.MethodPost, path: "/api/security/reset-lockout", body: `{}`},
{method: http.MethodPost, path: "/api/security/apply-restart", body: `{}`},
{method: http.MethodPost, path: "/api/security/oidc", body: `{}`},
+ {method: http.MethodPost, path: "/api/system/verify-temperature-ssh", body: `{}`},
+ {method: http.MethodPost, path: "/api/system/ssh-config", body: `{}`},
{method: http.MethodGet, path: "/api/ai/debug/context", body: ""},
{method: http.MethodPost, path: "/api/ai/execute", body: `{}`},
{method: http.MethodPost, path: "/api/ai/execute/stream", body: `{}`},