Commit graph

9 commits

Author SHA1 Message Date
Allison Karlitskaya
9d0695647c ws: be more explicit when handling hostnames on cli
`cockpit-ws` has never protected hostnames from being interpreted as cli
options when passing them to the auth commands (`cockpit-session`,
`cockpit-ssh`, `cockpit.beiboot`).  There have been a couple of relevant
changes over the years:

  - our move to using cockpit-session via unix socket has removed
    exposure to this problem for `cockpit-session`

  - our move from `cockpit-ssh` (glib argument parser) to
    `cockpit.beiboot` (Python argparse) has unfortunately exposed us to
    https://github.com/python/cpython/issues/66623 which means (due to a
    strange heuristic) that arguments starting with '-' can be
    interpreted as positionals if they also have spaces in them

This gives a way to get a hostname starting with a `-` to ssh (where it
*will* be interpreted as an option) and the following argument (the
python invocation on the remote) will be interpreted as the hostname.
Fortunately, new versions of ssh will reject this hostname.  In any
case, we should firm up the code here and add `--` to ensure that it's
definitely interpreted as a hostname by ssh.

For a similar reason add a `--` to the ssh command in `cockpit-ws`.

CVE-2026-4631
2026-04-08 15:18:32 +02:00
Allison Karlitskaya
f38470d75a vendor: bump systemd_ctypes 2026-01-26 17:45:26 +01:00
Allison Karlitskaya
4b9c89f00c shell: add StartTransientUnit as a sudo alternative
All of the talk of sudo-rs, sudo, run0 and the like led to an
interesting conclusion: we've had the ability to start transient
root-owned units with polkit authentication with fd passing as a core
systemd feature since about a decade.

Since we use systemd for everything else, why not this?

Add a new "method" field to the superuser bridge which can be
"StartTransientUnit" or "spawn" and defaults to "spawn".  If this is set
to "StartTransientUnit" then we'll use that method to start the given
command as root via the StartTransientUnit D-Bus call on pid1.

Add also a new "polkit" boolean field for if we should start a polkit
agent or not.  We used to do that automatically if "pkexec" appeared in
the argument vector so use that as a default value for backwards
compatibility.

Add StartTransientUnit to the default methods defined by the shell (and
beoboot) in the order below sudo but above pkexec.  This means that on
systems without a working sudo (such as Ubuntu 25.10) we will choose
StartTransientUnit.

The eventual goal will be to make it the default method but let's try
this as a first step.

This will help us in our beautiful post-setuid future.

Closes #21723
Closes #22669
https://github.com/cockpit-project/cockpit/pull/22373
2026-01-21 09:11:40 +01:00
Martin Pitt
0d52b125d2 vendor: update to the latest systemd_ctypes
This fixes the inotify memory leak:
https://issues.redhat.com/browse/RHEL-103778
2025-07-23 12:20:47 +02:00
Martin Pitt
589e6aa26b vendor: Update ferny to c8713c4d3ba74a
This stops hardcoding the libc.so.6 soname, and has a new matcher for
OpenSSH 0.9.6's "hostname contains invalid characters" error.
2024-12-13 12:13:40 +01:00
Allison Karlitskaya
b486774bf9 vendor: update to the latest systemd_ctypes
We didn't sync this in a while and there have been a lot of changes.

We also have a critical bug fix included: we recently introduced a test
case (in 0bb7438820) which triggers a
segfault in the binding layer of systemd_ctypes due to FFI call
trampolines being garbage collected while they're still running.

This is currently blocking downstream packaging on several non-x86_64
architectures.
2024-02-02 16:16:19 +01:00
Martin Pitt
ea9a84d8a3 vendor: Pull in ferny fixes for OpenSSH 0.9.6
This unbreaks the Shell's SSH support with the latest round of OpenSSH
0.9.6 security updates.
2024-01-03 10:07:14 +02:00
Allison Karlitskaya
b18df61c42 vendor: update to the latest version of ferny
This has some breaking API changes, so make adjustments as necessary.

One slightly non-obvious change comes from the removal of
InteractionAgent.add_handlers(), which had the potential to be racy in
case a message arrived before its handler was registered.  We now have
to specify all handlers up-front, which means that the block for doing
that needs to move up to before the transport is connected.  Of course,
we can only write the stage1 bootloader after the transport is online,
so we need to keep that in its current location.
2023-11-09 05:37:16 +01:00
Allison Karlitskaya
eab0640513 modules: rename to vendor
This is a lot more tab-complete-friendly and it's also closer to what
many other packages do for similar situations.
2023-09-07 17:48:36 +02:00