Commit graph

74663 commits

Author SHA1 Message Date
Kamil Szczęk fd8ed7f26b cryptsetup: allow customizing cache behavior
The new "password-cache" option allows customizing behavior of the
ask-password module in regards to caching credentials in the kernel
keyring. There are 3 possible values for this option:
  * read-only - look for credentials in kernel keyring before asking
  * on - same as read-only, but also save credentials input by user
  * off - disable keyring credential cache

Currently the cache is forced upon the user and this can cause issues.
For example, if user wants to attach two volumes with two different
FIDO2 tokens in a quick succession, the attachment operation for the
second volume will use the PIN cached from the first FIDO2 token, which
of course will fail and since tokens are only attempted once, this will
cause fallback to a password prompt.
2024-06-27 13:00:49 +02:00
Kamil Szczęk 53b6c99018 cryptsetup: make key discovery more robust
Currently, if user doesn't specify a key file, /etc/cryptsetup-keys.d/
and /run/cryptsetup-keys.d/ will be searched for a key file with name
matching the volume name. But current implementation has an important
flaw. When the auto-discovered key is a socket file - it will read the
key only once, while the socket might provide different keys for
different types of tokens. The issue is fixed by trying to discover the
key on each unlock attempt, this way we can populate the socket bind
name with something the key provider might use to differentiate between
different keys it has to provide.
2024-06-27 12:58:45 +02:00
Lennart Poettering db2b897a86
Merge pull request #33503 from poettering/hostnamed-polkit-fixes
hostnamed: minor corrects to Varlink polkit handling
2024-06-27 12:47:46 +02:00
Lennart Poettering 24f0d6110c
Merge pull request #32560 from poettering/varlink-double-fd
varlink: add ability to talk to remote Varlink service binary via ssh
2024-06-27 12:47:31 +02:00
Lennart Poettering 26c5eebb74 update TODO 2024-06-27 12:25:25 +02:00
Lennart Poettering 440531c839 update TODO 2024-06-27 12:17:57 +02:00
Luca Boccassi ae4c61bacc
Merge pull request #33502 from DaanDeMeyer/opensuse
mkosi: Drop s390x console patch from opensuse spec
2024-06-27 11:49:19 +02:00
Lennart Poettering ebc4a76a64 ci: add simple test for the new "ssh-exec:" varlink logic 2024-06-27 11:30:07 +02:00
Lennart Poettering e44e109baa varlink: add ability to invoke and talk to remote service binary via SSH 2024-06-27 10:56:51 +02:00
Lennart Poettering ab89c6d162 varlink: if $SYSTEMD_VARLINK_LISTEN is set to "-", listen on stdio 2024-06-27 10:52:23 +02:00
Lennart Poettering 6678b9acc6 hostnamed: make sure we can actually properly parse 'allowInteractiveAuthentication' varlink parameter
If people want they should be able to turn on this flag, to allow
interactive auth. Let's make sure this actually works. i.e. add it to
the introspection data and don't refuse the parameter in Describe().
(note the varlink handling already does parameter validation through
varlink_dispatch(), hence we can just drop any further validation)
2024-06-27 10:43:21 +02:00
Lennart Poettering b6464e80d6 hostnamed: if polkit authentication fails for Varlink Describe() call, don't reply to client with an error
The logic of the Describe() call was supposed to be: if we can acquire
the PK priv to get the product UUID then let's return the product UUID,
and if we cannot then return the data without it.

This didn't work however, since the polkit varlink glue would
immediately propagate the error it acquired from polkit its own client.
Let's turn this off, optionally, so that hostnamed can handle this
nicely.
2024-06-27 10:43:21 +02:00
Daan De Meyer 21942c008e mkosi: Drop leftover systemd-coredump-debuginfo package for opensuse
The package was merged into the main systemd package in
23bfa9d83b.
2024-06-27 10:14:32 +02:00
Daan De Meyer f92a005cd1 mkosi: Drop s390x console patch from opensuse spec
This patch does not apply anymore on upstream, so let's remove it
from the spec before building until the spec is fixed.
2024-06-27 09:49:40 +02:00
Lennart Poettering 4120151f7b varlink: add helper that adds a connection via stdio to a varlink server
This adds varlink_server_add_connection_stdio() as wrapper around
varlink_server_add_connection_pair(), that steals stdin/stdout fds and
turns them into a varlink connection. To be safe it replaces
stdin/stdout with /dev/null fds.
2024-06-27 09:41:54 +02:00
Lennart Poettering e73ae07b52 varlink: add new call varlink_server_add_connection_pair() for two-fd servers
This adds the server-side for varlink connections over two distinct fds.
2024-06-27 09:41:54 +02:00
Lennart Poettering 6f24e09006 varlink: add new call varlink_connect_fd_pair() helper for two-fd clients
This makes use of the functionality added in the previous commit to
implement the client-side functionality for talking to servers via a
pair of fds.
2024-06-27 09:41:54 +02:00
Lennart Poettering 2ac1fb14d9 varlink: support varlink communication via distinct input/output fds
When invoking another process via a pair of pipes it makes sense to
allow reading from one fd, and writing from another. Teach our varlink
code to do so optionally.

(sd-bus supports something similar, fill the gap).

This is preparation for a later commit that uses this to talk to remote
SSH invocations via pipes.
2024-06-27 09:41:54 +02:00
Lennart Poettering fbdb7854a5
Merge pull request #33493 from poettering/stub-refactor
sd-stub: clean-up codebase/refactoring
2024-06-27 09:18:39 +02:00
Luca Boccassi 8e6d95846b
Merge pull request #33491 from keszybz/allow-interactive-auth-in-inhibit
Allow interactive auth in inhibit
2024-06-26 23:01:22 +02:00
Luca Boccassi d031b5876b
Merge pull request #33338 from ml-/specifiers
tmpfiles: add %q, %A, %M specifiers
2024-06-26 21:40:15 +02:00
Florian Schmaus 016e9d8d08 core/exec-invoke: use sched_setattr instead of sched_setscheduler
The kernel's sched_setattr interface allows for more control over a processes
scheduling attributes as the previously used sched_setscheduler interface.

Using sched_setattr is also the prerequisite for support of utilization
clamping (UCLAMP [1], see #26705) and allows to set sched_runtime. The latter,
sched_runtime, will probably become a relevant scheduling parameter of the
EEVDF scheduler [2, 3], and therefore will not only apply to processes
scheduled via SCHED_DEADLINE, but also for processes scheduled via
SCHED_OTHER/SCHED_BATCH (i.e., most processes).

1: https://docs.kernel.org/next/scheduler/sched-util-clamp.html
2: https://lwn.net/Articles/969062/
3: https://lwn.net/ml/linux-kernel/20240405110010.934104715@infradead.org/
2024-06-26 20:54:53 +02:00
Kamil Szczęk 0828c6a2bf cryptsetup: improve TPM2 blob display
Just a tiny change to fix an eyesore in cryptsetup luksDump display :)
2024-06-26 20:52:31 +02:00
Luca Boccassi 6105b745dd
Merge pull request #33495 from bluca/mkosi_update
mkosi: update to latest, fix opensuse, use standalone shutdown package in Debian
2024-06-26 18:21:20 +02:00
Lennart Poettering 506ffa0e72 efi: share setting of generic efivars between sd-stub/sd-boot
We have very similar code for setting generic efi vars in sd-stub and
sd-boot. Let's share it.

This changes behaviour in a minor way: if you chainload multiple
versions of an sd-boot you'll see the efi vars of the first one now in
the OS, not of the last one.

But this should not matter, invocation like that should generally not
happen.
2024-06-26 17:09:45 +02:00
Lennart Poettering 75d08dc6e8 measure: normalize error paths
Always put the success path at least indentation, and indent the error
paths.
2024-06-26 17:09:45 +02:00
Lennart Poettering 4a3659c5f4 stub: rework linux handover to take "struct iovec" 2024-06-26 17:09:45 +02:00
Lennart Poettering a729187a19 stub: turn lookup_name() into shorter and more generic function that turns sectin into char* string 2024-06-26 17:09:45 +02:00
Lennart Poettering c36c088a93 stub: add helper that turns PE section into char16_t* string 2024-06-26 17:09:45 +02:00
Lennart Poettering c8af9aca9e stub: reorder variables 2024-06-26 17:09:45 +02:00
Lennart Poettering 4087aa38c5 stub: reorder things a bit, so that initrds are generated/looked up together 2024-06-26 17:09:45 +02:00
Lennart Poettering e864cd91d5 stub: uniformly process "measured" flags
Always pass the pointer through so that the functions combine the flags
directly, instead of doing that in the caller.
2024-06-26 17:09:45 +02:00
Lennart Poettering fe0f6c099c stub: split out function that determines main cmdline 2024-06-26 17:09:45 +02:00
Lennart Poettering 9597320f5c stub: normalize error handling when looking for PE sections 2024-06-26 17:09:45 +02:00
Lennart Poettering 9f3bc7b505 stub: slightly reorder things
Let's do the section measurement first, before we use any data of it.

Let's bring up the boot splash next, so that it covers anything else we
might do.
2024-06-26 17:09:45 +02:00
Lennart Poettering 248b3257a1 stub: split out code that displays boot splash 2024-06-26 17:09:45 +02:00
Lennart Poettering 1489e66f7c stub: split out code that loads all addons from disk into function of its own 2024-06-26 17:09:45 +02:00
Lennart Poettering 16b550d01a stub: merge separate lists for addon cmdlines/devicetrees into one
Instead of keeping the lists for the global and per-UKI addons separate
throughout, just merge them. We apply them in the same order after all.
2024-06-26 17:09:45 +02:00
Lennart Poettering acf3e58eb3 stub: don't make up errors 2024-06-26 17:09:45 +02:00
Lennart Poettering 9e2ed6c78f stub: add DevicetreeAddon structure
Instead of keeping three parallel arrays of dt base, dt size and dt
filename, just introduce a proper structure and use an array of that,
greatly simplifying DT handling.
2024-06-26 17:09:45 +02:00
Lennart Poettering dcac1e4a9b stub: split out call that loads embedded device tree 2024-06-26 17:09:45 +02:00
Lennart Poettering 8d5669a467 stub: split out code that sets EFI vars indicating measured PCRs 2024-06-26 17:09:45 +02:00
Lennart Poettering c802cb2f80 stub: move initialization of kernel iovec to the end, where it's used 2024-06-26 17:09:45 +02:00
Lennart Poettering 8e67de8402 stub: split out code that finds embedded initrds 2024-06-26 17:09:45 +02:00
Lennart Poettering b199c0f26e stub: split out code that generates embedded initrds 2024-06-26 17:09:45 +02:00
Lennart Poettering 868219655a stub: split out calls that generate sidecar initrds 2024-06-26 17:09:44 +02:00
Lennart Poettering ac32323271 stub: rework initrd handling around "struct iovec"
Let's maintain an array of "struct iovec" for the initrds. It becomes a
ton easier and shorter to process/combine the various initrds then.
2024-06-26 17:09:44 +02:00
Lennart Poettering 79d076be37 stub: split out code that finds the uname among PE sections 2024-06-26 17:09:44 +02:00
Lennart Poettering 4a033b0a11 stub: split out code that appends smbios command line 2024-06-26 17:09:44 +02:00
Lennart Poettering cd6fe7aa7f stub: split out code that measures our own PE sections 2024-06-26 17:09:44 +02:00