-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use DynamicUser=yes for all cockpit components #16811
Changes from 1 commit
26f5aa8
5911fb9
8ae0d32
e438ef2
73875c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Dynamic user for /run/cockpit/wsinstance/ sockets | ||
BindsTo=cockpit.service | ||
|
||
[Service] | ||
DynamicUser=yes | ||
User=cockpit-wsinstance-socket | ||
Group=cockpit-wsinstance-socket | ||
Type=oneshot | ||
ExecStart=/bin/true | ||
RemainAfterExit=yes |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ Documentation=man:cockpit-ws(8) | |
Requires=cockpit.socket | ||
Requires=cockpit-wsinstance-http.socket cockpit-wsinstance-https-factory.socket | ||
# ensure our DynamicUser exists | ||
Requires=cockpit-ws-user.service | ||
After=cockpit-ws-user.service | ||
Requires=cockpit-ws-user.service cockpit-wsinstance-socket-user.service | ||
After=cockpit-ws-user.service cockpit-wsinstance-socket-user.service | ||
# we need to start after the sockets so that we can instantly forward incoming requests | ||
After=cockpit-wsinstance-http.socket cockpit-wsinstance-https-factory.socket | ||
|
||
|
@@ -17,6 +17,7 @@ ExecStartPre=+@libexecdir@/cockpit-certificate-ensure --for-cockpit-tls | |
ExecStart=@libexecdir@/cockpit-tls | ||
User=cockpit-ws | ||
Group=cockpit-ws | ||
SupplementaryGroups=cockpit-wsinstance-socket | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And ditto. We should have |
||
NoNewPrivileges=true | ||
ProtectSystem=strict | ||
ProtectHome=true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,7 +332,7 @@ class TestConnection(testlib.MachineCase): | |
# number of https instances is bounded (DoS prevention) | ||
# with MaxTasks=200 und 2 threads per ws instance we should have a | ||
# rough limit of 100 instances, so at some point curl should start failing | ||
m.execute("runuser -u cockpit-ws -- sh -ec 'RC=1; for i in `seq 120`; do " | ||
m.execute("runuser -u cockpit-wsinstance-socket -- sh -ec 'RC=1; for i in `seq 120`; do " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It occurs to me that if we ran this as |
||
" echo -n $i | nc %s -U /run/cockpit/wsinstance/https-factory.sock;" | ||
" curl --silent --head --max-time 5 --unix-socket /run/cockpit/wsinstance/https@$i.sock http://dummy > /dev/null || RC=0; " | ||
"done; exit $RC'" % n_opt) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reading this, even as someone who understands how this pile of software works, is confusing.
We've used
cockpit-ws
forcockpit-tls
andcockpit-wsinstance
forcockpit-ws
for a while now for reasons that are no longer relevant. I think we should take the time to change these usernames:cockpit-tls
forcockpit-tls
andcockpit-ws
forcockpit-ws
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to be careful about "cockpit-ws", as we used to have that static user, and /etc/cockpit/ws-certs.d/* may still be owned by it on old systems. In general, +1 for cleaning up the user names, though!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For that reason I added postinst scripts which remove the cockpit-wsinstance user on upgrade, but not for cockpit-ws. I don't want to get into the business of randomly chowning files in /etc. You can just too easily screw up shared certificates, backups, break Ansible scripts, etc.