Skip to content

Commit 1a73021

Browse files
Kabuki94claude
andcommitted
cockpit: add supplementary group memberships so PAM auth completes
After mios.git@569b567 added the static cockpit-* users and fixed the socket SocketUser/SocketGroup overrides, HTTP 200 came back on the cockpit login page but POST /cockpit/login still returned 401 "Authentication not available". cockpit-tls journal kept saying: /run/cockpit/session: couldn't connect: Permission denied Root cause: the dynamic-user IDs that cockpit's instance units expect (cockpit-wsinstance-https / cockpit-wsinstance-http / cockpit-wsinstance-socket / cockpit-ws / cockpit-systemd-service) were created with NO supplementary group memberships. cockpit-ws running under cockpit-wsinstance-https tried to connect to /run/cockpit/session (group cockpit-session-socket, mode 0660) and got refused because cockpit-wsinstance-https's primary group is its own 953, not 974/cockpit-session-socket. Added cross-memberships via `m` directives so every cockpit helper user has supplementary access to both socket groups: m cockpit-ws cockpit-wsinstance-socket m cockpit-systemd-service cockpit-wsinstance-socket m cockpit-systemd-service cockpit-session-socket m cockpit-ws cockpit-session-socket m cockpit-wsinstance-https cockpit-session-socket m cockpit-wsinstance-https cockpit-wsinstance-socket m cockpit-wsinstance-http cockpit-session-socket m cockpit-wsinstance-http cockpit-wsinstance-socket m cockpit-wsinstance-socket cockpit-session-socket Verified live (operator's installed VM): PowerShell from Windows host: Invoke-WebRequest -Headers @{'X-Authorize'='password'} \ -Credential mios:mios https://localhost:9090/cockpit/login -> HTTP 200 + Set-Cookie: cockpit=<session-token>... journal: pam_unix(cockpit:session): session opened for user mios(uid=992) systemd-sysusers does not retro-apply `m` directives reliably on a populated /etc/group, so the install path also runs explicit `usermod -aG` lines (mios-bootstrap-side fix in a sibling commit) to materialize the memberships on first overlay run. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 9055dcc commit 1a73021

1 file changed

Lines changed: 29 additions & 6 deletions

File tree

usr/lib/sysusers.d/50-mios-cockpit.conf

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,33 @@ u cockpit-wsinstance-https 973:cockpit-wsinstance-https "'MiOS' Cockpit wsinstan
6363
g cockpit-ws 972
6464
u cockpit-ws 972:cockpit-ws "'MiOS' Cockpit web service primary user" /var/empty /sbin/nologin
6565

66-
# Group memberships -- cockpit-tls (which runs as cockpit-ws) needs to
67-
# connect to /run/cockpit/wsinstance/https-factory.sock, which is owned
68-
# by group cockpit-wsinstance-socket. Without this membership cockpit-tls
69-
# fails every HTTPS request with:
70-
# cockpit-tls: connect(https-factory.sock) failed: Permission denied
71-
# and the browser sees "connection reset by peer" after the TLS handshake.
66+
# Group memberships -- cockpit's binaries are run by systemd as
67+
# `cockpit-systemd-service` (set by cockpit.service's User=) and as
68+
# `cockpit-ws` (set by some helper units). Both need access to the
69+
# Unix sockets cockpit-ws creates at runtime under /run/cockpit/:
70+
#
71+
# /run/cockpit/session group cockpit-session-socket
72+
# /run/cockpit/wsinstance/http.sock group cockpit-wsinstance-socket
73+
# /run/cockpit/wsinstance/https-factory.sock group cockpit-wsinstance-socket
74+
#
75+
# Without these supplementary group memberships, cockpit-tls fails with
76+
# cockpit-tls: connect(...): Permission denied
77+
# the browser receives HTTP 401 "Authentication not available", and
78+
# the login form shows "Authentication failed" even when the operator
79+
# entered the correct credentials. Operator-flagged 2026-05-10.
7280
m cockpit-ws cockpit-wsinstance-socket
81+
m cockpit-systemd-service cockpit-wsinstance-socket
82+
m cockpit-systemd-service cockpit-session-socket
83+
m cockpit-ws cockpit-session-socket
84+
# cockpit-wsinstance-https.service spawns /usr/libexec/cockpit-ws with
85+
# DynamicUser=yes + User=cockpit-wsinstance-https + Group=cockpit-session-socket.
86+
# When DynamicUser is in effect systemd uses the unit's Group= for the
87+
# transient primary GID; when our overlay drop-ins disable it, the static
88+
# user's own primary group sticks (cockpit-wsinstance-https=953) and the
89+
# cockpit-session.sock connect fails. Explicit membership keeps both
90+
# paths working. Same applies to the http instance.
91+
m cockpit-wsinstance-https cockpit-session-socket
92+
m cockpit-wsinstance-https cockpit-wsinstance-socket
93+
m cockpit-wsinstance-http cockpit-session-socket
94+
m cockpit-wsinstance-http cockpit-wsinstance-socket
95+
m cockpit-wsinstance-socket cockpit-session-socket

0 commit comments

Comments
 (0)