Commit Graph
61 Commits
Author SHA1 Message Date
Ludwig NusselandAkarithos d2bb93565c pcrlock: skip make-policy tests if environment lacks TPM support
make-policy needs to write into an NVindex. For that we need an actual
TPM.

Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
2026-08-04 14:11:43 -07:00
Ludwig Nussel 8ab0aaea3c pcrlock: honor pcr arg for filtering list-components 2026-08-04 14:11:43 -07:00
Ludwig Nussel 2e7c9a24a1 pcrlock: ignore empty device path
Don't mark records with empty device path as invalid. When shim is in
use such records are normal :-/
https://github.com/rhboot/shim/issues/642
2026-08-04 14:11:43 -07:00
Ludwig NusselandAkarithos 230f171837 pcrlock: reduce verbosity a bit
Not sure what a good compromise between too much and too less is.
Semi happy with SYSTEMD_LOG_LEVEL=notice now.

Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
2026-08-04 14:11:43 -07:00
Ludwig NusselandAkarithos 8f631ffe05 pcrlock: limit list view to selected PCRs
Makes it easier to inspect specific PCRs

Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
2026-08-04 14:11:43 -07:00
Ludwig NusselandAkarithos d1cec47900 pcrlock: add --strict option
Add a --strict option that makes sure all PCRs for which components were
found are indeed included in the set of predicted PCRs. Instead throw an
error. Avoids creating a policy less secure than requested.

Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
2026-08-04 14:11:43 -07:00
Ludwig NusselandAkarithos dcde7c750d pcrlock: don't add checkmark for missing component
Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
2026-08-04 14:11:43 -07:00
Ludwig NusselandAkarithos 18fed0d0d4 pcrlock: shorten displayed hash bytes
Shorten number of bytes show of sha256 hashes. Similar to git, makes
output less wide and more readable.

Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
2026-08-04 14:11:43 -07:00
Ludwig NusselandAkarithos be9c38a77d pcrlock: exclude red and green color ranges
Using red and green in the output is rather confusing as that is
normally associated with good or bad like in the checkmark columns.
So let's exclude those colors from the display.

Co-authored-by: Akarithos <277667353+Akarithos@users.noreply.github.com>
2026-08-04 14:11:43 -07:00
Ludwig Nussel 0e10c3d872 logind: implement maintenance time
Update frameworks that work automatically in the background
occasionally need to schedule reboots. Systemd-logind already
provides a nice mechanism to schedule shutdowns, send notfications
and block logins short before the time. Systemd has a framework for
calendar events, so we may conveniently use logind to define a
maintenance time for reboots.

The existing ScheduleShutdown DBus method in logind expects a usec_t
with an absolute time. Passing USEC_INFINITY as magic value now tells
logind to take the time from the configured maintenance time if set.

"shutdown -r" leverages that and uses the maintenance time
automatically if configured. The one minute default is still used if
nothing was specified.

Similarly the new 'auto' setting for the --when parameter of systemctl
uses the maintenance time if configured or a one minute timer like the
shutdown command.
2024-06-20 14:37:42 +02:00
Ludwig Nussel 8ce171bf51 bootctl: add --random-seed=yes/no 2024-06-20 14:26:13 +09:00
Ludwig Nussel 1df4b21abd cryptenroll: use root device by default 2024-04-23 12:29:32 +02:00
Ludwig Nussel e7705e2191 nsresourced: don't redefine of bpf_rdonly_cast
bpf_rdonly_cast() was introduced in libbpf commit 688879f together with
the definition of a bpf_core_cast macro. So use that one to avoid
defining a prototype for bpf_rdonly_cast;
2024-04-12 05:55:27 +09:00
Ludwig Nussel aadbe55925 creds: allow null when decrypting
pcrlock writes a credential file using null key. Make sure systemd-creds
can show the file
2024-04-11 12:15:32 +01:00
Ludwig Nussel 33f23e2230 Revert "options" rename in json bootctl output
Revert the rename from "options" to "finalCmdline" in 122650b4a0
while the bigger https://github.com/systemd/systemd/pull/31339 is still
under review.
2024-02-29 18:07:14 +01:00
Ludwig Nussel ec9ff6ea94 kernel-install: silence num kernels installed 2024-01-15 17:16:37 +01:00
Ludwig Nussel 27d420f466 kernel-install: fix context_copy
Don't reopen or dup values that weren't set before. Fixes add-all.
2024-01-15 17:16:37 +01:00
Ludwig Nussel 5058bd7e1f strv: introduce strv_copy_unless_empty() 2024-01-15 17:16:37 +01:00
Ludwig Nussel 4bc14b1790 bootctl: show report state and type in json output 2023-04-07 10:22:37 +02:00
Ludwig Nussel 6fb595bc2f docs: fix coredump legacy example 2023-03-31 11:47:17 +02:00
Ludwig Nussel 361cacf49e manager: fix scope for environment generators
fixes regression introduced by 4870133bfa
2023-03-16 03:59:49 +09:00
Ludwig Nussel 8702496bfb bootctl: unlink and cleanup functions
The unlink command removes an entry from the ESP including
referenced files that are not referenced in other entries. That is
useful eg to have multiple entries that use the same kernel with
different options.

The cleanup command removes all files that are not referenced by any
entry.
2023-01-19 14:24:43 +01:00
Ludwig Nussel 1132fd73b3 chase-symlinks: new chase_symlinks_and_unlink() 2023-01-19 14:11:12 +01:00
Ludwig Nussel d7efb17068 meson: ukify depends on GNU_EFI
ukify is rather efi specific and the manpage is already conditional on
HAVE_GNU_EFI so make the program also depend on HAVE_GNU_EFI
2023-01-19 11:42:18 +00:00
Ludwig Nussel e443cc7c05 bootspec: show efi entry too 2023-01-13 10:50:18 +09:00
Ludwig Nussel 2e76ca79b3 bootctl: honor $KERNEL_INSTALL_CONF_ROOT
Honor $KERNEL_INSTALL_CONF_ROOT for reading config files, as
kernel-install does.
2023-01-10 15:17:07 +01:00
Ludwig Nussel 5fe34dbfeb kernel-install: refactor some variables
In preparation for plugin support
2023-01-10 13:49:31 +01:00
Ludwig Nussel dd003f1621 kernel-install: run depmod only if writeable 2023-01-05 21:46:09 +01:00
Ludwig Nussel 8109b2908d bootctl: print entry token as well 2023-01-05 21:45:18 +01:00
Ludwig Nussel d353fcceb5 machined: pass shell command line to polkit
Pass the joined arguments to polkit as command_line property like
pkexec does. Obviously not exactly perfect as it lacks quoting. Good
enough for polkit rules to check whether a program was called with
or without arguments though.
2022-12-29 13:29:25 +01:00
Ludwig Nussel 9c28539a95 docs: mention qemu fw_cfg size limitation 2022-08-11 13:32:55 +02:00
Ludwig Nussel ff86850b30 creds: refactor reading user password
Share code between firstboot and sysusers
2022-08-11 13:32:55 +02:00
Ludwig Nussel 8313a1a5cd kmod-setup: load dmi-sysfs if it's a module 2022-08-08 19:22:53 +01:00
Ludwig Nussel 5243331fb8 pull: fix PullFlags numbering 2022-08-04 17:27:03 +02:00
Ludwig Nussel ee3d33c415 logind: use mfree instead of freep 2022-03-07 19:43:18 +00:00
Ludwig Nussel 00886e06e8 systemctl: use action_table for scheduling shutdown
The fall-through to reboot doesn't seem to make sense. It won't happen
in the current code. Filtering the actions on client side is not needed
either as the server will refuse unsupported operations anyway.
2022-02-28 11:29:45 +01:00
Ludwig Nussel aa6123e85e logind: load scheduled shutdown on restart
Make sure logind doesn't forget about a scheduled shutdown, even if it
gets restarted eg due to a package update.
2022-02-28 11:29:45 +01:00
Ludwig Nussel 9fa9c66dbd logind: fix handle_action_valid() 2022-02-28 10:31:10 +01:00
Ludwig Nussel 6d7127d6dd systemctl: improve error messages related to halt failures 2022-02-22 11:36:29 +01:00
Ludwig Nussel 4e076fc885 Revert "man: fix description of --force in halt(8) (#7392)"
This reverts commit 5d9adb5b60.
2022-02-15 14:58:03 +01:00
Ludwig Nussel 2a3a5288cb systemctl: fix halt -f
Commit adefc8789b always asks logind for shutdown first. So I broke halt
-f which is supposed to issue a direct syscall in that case.
2022-02-14 09:35:12 +01:00
Ludwig Nussel 54141d8ddd logind: more verbose struct initialization 2022-02-14 09:35:12 +01:00
Ludwig Nussel 1831759a70 logind: increase max wall message length to 4096 2022-02-14 09:35:12 +01:00
Ludwig Nussel d2fc0ecf9a logind: style fixes 2022-02-14 09:35:12 +01:00
Ludwig Nussel 138224fc80 logind: add handle enum to struct
Avoid pointer arithmetic at the expense of repeating the enum value
in the struct.
2022-02-14 09:35:12 +01:00
Ludwig Nussel 48f3bc5cc4 test: add shutdown test
Wraps nspawn to be able to use pexpect. The test logs in on the console
and runs screen. In one screen window it types in shutdown commands and
checks whether a wall message was sent to the other.
2022-01-25 17:43:13 +01:00
Ludwig Nussel 38d55bf264 systemctl: shutdown don't fallback on auth fail
For shutdowns don't fall back to starting the target directly if talking
to logind failed with auth failure. That would just lead to another
polkit auth attempt.
2022-01-25 17:43:13 +01:00
Ludwig Nussel 5ed73478e1 logind: refactor
Avoid hardcoded strings and string compares related to shutdown actions.
Instead put everything into a common structure. Reuse existing
HandleAction as index since it's already exposed as property for the
button handlers.
2022-01-25 17:43:10 +01:00
Ludwig Nussel ec14fba91c logind: require polkit auth for cancelling shutdowns 2022-01-25 14:56:55 +01:00
Ludwig Nussel 030f37c408 logind: fix wall messages for direct shutdown calls
The wall mechanism uses the scheduled_shutdown_type to determine what
message to send so it needs to be filled in also for the cases that call
for shutdown without schedule.

It's really a hackish way. The overall code needs refacturing.
2022-01-25 14:56:52 +01:00
Ludwig Nussel cdf370626f logind: enable wall messages by default
Something calling directly into the dbus interface to request a
shutdown may not bother turning wall messages on explicitly.

This has the convenient side effect that no separate polkit auth is
required to turn on wall messages. Was annoying as having a wall
message is the default behavior of the commandline tools. Now it's
the other way around ie eg systemctl reboot --no-wall requires auth
to explicitly turn off the wall message.
2022-01-25 14:52:14 +01:00
Ludwig Nussel adefc8789b systemctl: simplify halt_main()
The code at this point is not able to tell whether it was called as
halt/poweroff/reboot or shutdown with time "now".
The code also takes a shortcut to skip logind if called as root.
That however means asking shutdown for immediate action won't trigger a
wall message.
As per https://github.com/systemd/systemd/issues/8424#issuecomment-374677315
all commands should trigger a wall message.
That simplifies the code as we can try logind first always.
2022-01-25 14:52:09 +01:00
Ludwig Nussel 90b1ec03b2 logind: fix wall message for immediate shutdowns
An elapse time of zero means NOW which should trigger a wall
message.
2022-01-25 14:46:37 +01:00
Ludwig Nussel 8dd3f6a3fd machined: provide more details to polkit auth 2022-01-18 22:35:09 +00:00
Ludwig Nussel 8e98568165 systemctl: consistent output for scheduled shutdowns
Use same terms when scheduling and showing sheduled shutdowns.
2022-01-10 09:09:50 +01:00
Ludwig Nussel 2dbb54788e systemctl: Fix --show timestamp 2022-01-05 14:19:11 +01:00
Ludwig Nussel b13a8b5b37 test: mark partition bootable
Make test suite partition bootable so nspawn can use the image directly.
Useful for local testing.

https://systemd.io/DISCOVERABLE_PARTITIONS/
2021-12-29 19:23:26 +00:00
Ludwig Nussel a9c97bbbfb machined: set TTYPath for container shell
TTYPath is needed for proper utmp registration of the shell to
receive wall messages.
2021-12-23 11:27:56 +01:00
Ludwig Nussel 60c5878dd4 logind: allow to read /proc
User name and tty are used for wall messages. For that to work logind
must be able to poke around in proc entries of other processes.
2021-12-17 12:18:16 +00:00
Ludwig Nussel a9c3cc8db0 systemctl: add shutdown --show option
Shows the scheduled shutdown action and time if there's one.
2021-12-09 15:07:40 +01:00
Ludwig Nussel cb80401132 sysctl: apply /etc/sysctl.conf last
apply /etc/sysctl.conf last to actually allow the admin to override
package provided defaults.
2011-05-16 23:36:52 +02:00