57 lines
3.2 KiB
Markdown
57 lines
3.2 KiB
Markdown
---
|
|
id: "bug-1875"
|
|
status: "fixed"
|
|
status_updated: "2026-09-28"
|
|
status_note: ""
|
|
component: "apiserver"
|
|
severity: "noise"
|
|
timestamp: "2026-09-28T03:52:37Z"
|
|
last_seen: "2026-09-28T03:58:49Z"
|
|
occurrences: 1
|
|
files: ["src/frontend/apiserver/middleware/startserver.go"]
|
|
tags: ["apiserver", "auth", "pam", "logging"]
|
|
related: []
|
|
fix_commits: ["44173f74"]
|
|
gitea_issue: 313
|
|
gitea_synced_status: "fixed"
|
|
gitea_synced_hash: "215a5c77313a"
|
|
---
|
|
|
|
# bug-1875: apiserver warns PAM needs root when the auth provider is not pam
|
|
|
|
## Description
|
|
**Observed:**
|
|
```
|
|
2026-09-28T11:52:50.031+0800 WARN Not running as root — PAM authentication will not work. OK for dev/testing.
|
|
```
|
|
**Expected:** no warning when the configured auth provider is not pam (the default config/auth.yaml has `provider: config_file`).
|
|
**Impact:** a misleading WARN on every non-root apiserver start; noise only.
|
|
**Found by:** user report from a pc13v HA deploy, 2026-09-28
|
|
|
|
## Environment
|
|
- OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64
|
|
- libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2, from src/xce.build/frontend/apiserver/xce_apiserver)
|
|
- Toolchain: gcc (GCC) 15.2.0, meson 1.9.1
|
|
- Build: release-style Go build via meson (xce.build/frontend/apiserver/xce_apiserver)
|
|
- Code: scheduler-framework @ 8cadeeb2 (last commit without the fix)
|
|
- Deployment: first seen on pc13v: 3-node HA (ctrl-1..3) + scheduler + apiserver + real root xcecd under systemd, deploy dir /tmp/xce-ha-deploy, 2026-09-28 11:52 +0800 (pc13v's OS, libc and exact commit were not recorded; the values above are from the reproduction on this dev host, same nix toolchain)
|
|
|
|
## Reproduction
|
|
1. Start the apiserver as a non-root user with the default src/frontend/apiserver/config/auth.yaml (provider: config_file)
|
|
2. The warning is logged at start
|
|
- Frequency: deterministic (every non-root start)
|
|
- Evidence: the xcecd/scheduler/controller/apiserver logs pasted in the user's report, 2026-09-28 (quoted above)
|
|
|
|
## Root cause
|
|
StartServer() (src/frontend/apiserver/middleware/startserver.go) warned whenever the uid was not 0, without looking at which auth provider cmd/main.go had initialized (auth.GlobalProvider) -- only the PAM provider needs root.
|
|
|
|
## Fix
|
|
rootWarning(uid, provider) returns the warning only for provider "pam" and a non-root uid; StartServer() passes auth.GlobalProvider.Name().
|
|
|
|
## Verification
|
|
- Test: TestRootWarning in src/frontend/apiserver/middleware/startserver_test.go (5 uid/provider cases): RED before the fix (rootWarning did not exist), GREEN after; run with `CGO_ENABLED=0 go test ./middleware/ -run TestRootWarning` (the package's TestLoadJobs needs a live apiserver and is not part of the normal Go test set)
|
|
- Suites: full ASAN build (xce-build all): 113/113 suites after the updated scheduler picker-registration test; controller 1250/0, harness 141/0, worker diskstats 4/0, scheduler picker wiring 11/0 + picker registration 4/0, apiserver TestRootWarning PASS
|
|
- Live: pc13v retest at 4c134127 (debug build, 2026-09-28 14:47 +0800): `ag -i error logs/` finds nothing; `ag -i warn logs/` shows only the WAL-unencrypted advisory; no PAM warning from the apiserver
|
|
|
|
## References
|
|
- Related: none
|