1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00
Commit Graph

76436 Commits

Author SHA1 Message Date
Lennart Poettering
59b3df9bae bootspec: process multi-profile UKIs 2024-09-12 10:02:15 +02:00
Lennart Poettering
9de565dd5d pe-binary: add pe_is_native() for checking if PE is native 2024-09-12 10:02:15 +02:00
Lennart Poettering
e6c49f7f11 pe-binary: split pe_header_find_section() in two
This splits out the core part into a new function
pe_section_table_find().

pe_header_find_section() takes a PeHeader as input, while
pe_section_table_find() just takes the section table and its size.
2024-09-12 10:02:15 +02:00
Lennart Poettering
f3c1d7fea1 pe-binary: split pe_read_section_data() into two
This renames pe_read_section_data() to pe_read_section_data_by_name()
and makes pe_read_section_data() a bit more low-level: it takes a header
table entry directly, instead of searching it first by name.
2024-09-12 10:02:15 +02:00
Lennart Poettering
a8e912f01b pe-binary: add helper pe_is_addon() for detecting whether we are looking at PE EFI add-on 2024-09-12 10:02:15 +02:00
Lennart Poettering
201aca5f9a man: fix advertised filename of the PCR public key 2024-09-12 09:46:26 +02:00
Lennart Poettering
6f1dfc407e man: systemd-stub places PCR public key in file 'tpm2-pcr-public-key.pem', stick to that name across the board
systemd-stub provides the signing key for TPM2 signed PCR policies in a
file tpm2-pcr-public-key.pem to userspace. Hence, to clarify that this
is the same key as used when signing via "systemd-measure", let's rename
it in the docs like that.

Also rename the private key to tpm2-pcr-private-key.pem, to keep the
symmetry.

With this we should universally stick to this nomenclature:

1. tpm2-pcr-public-key.pem   ← public part of signing key
2. tpm2-pcr-private-key.pem  ← private part of signing key
3. tpm2-pcr-signature.json   ← signature file made with key pair

Inspired by: #34069
2024-09-12 09:46:26 +02:00
Lennart Poettering
d258b1c60c update TODO 2024-09-12 09:38:32 +02:00
Mike Yuan
53c75243af network/wireguard: refuse default key if all zero
Follow-up for fa724cd52c

We attempt to retrieve default key if eqzero(Wireguard.private_key),
but a all zero default key should be refused too.
2024-09-12 09:25:50 +02:00
Matteo Croce
c78bcda461 test-network: add test for sysctl watch
Add a NetworkdSysctlTest class which ensures that networkd correctly
complains when a sysctl file it's handling has been changed externally.
2024-09-11 23:10:36 +02:00
Matteo Croce
6d9ef22acd emit a warning in networkd if managed sysctls are changed
Monitor the sysctl set by networkd for writes, if a sysctl is
overwritten with a different value than the one we set, emit a warning.
Writes are detected with an eBPF program attached as BPF_CGROUP_SYSCTL
which reports the sysctl writes only in net/.

The eBPF program only reports sysctl writes from a different cgroup than networkd.
To do this, it uses the `bpf_current_task_under_cgroup_proto()` helper,
which will be available allowed in BPF_CGROUP_SYSCTL from kernel 6.12[1].

Loading a BPF_CGROUP_SYSCTL program requires the CAP_SYS_ADMIN capability,
so drop it just after the program load, whether it loads successfully or not.

Writes are logged but permitted, in future the functionality can be
extended to also deny writes to managed sysctls.

[1] https://lore.kernel.org/bpf/20240819162805.78235-3-technoboy85@gmail.com/
2024-09-11 23:07:00 +02:00
Matteo Croce
64629617b6 store the sysctls set by networkd
networkd set several sysctl to set the network configuration. Save their
value so we can check is other processes change them.
2024-09-11 23:01:25 +02:00
Matteo Croce
766bcf302a extend sysctl functions to shadow values
Pass to all the sysctl_* functions a hashmap which can be used to
optionally save the value written in the sysctl.
2024-09-11 23:01:25 +02:00
Lennart Poettering
2b735c7d71 resolvectl: rework StatusMode handling into a switch/case statement 2024-09-11 21:36:50 +02:00
Lennart Poettering
da8540583d resolvectl: rename shallow destructors …_done() 2024-09-11 21:36:36 +02:00
Daan De Meyer
783a15081e
Merge pull request #34373 from poettering/resolved-dnssd-move-out
move dnssd configuration file parsing from generic code into dnssd source files
2024-09-11 21:36:24 +02:00
Lennart Poettering
967c84ebb0 resolved: simplify dns_scope_get_n_dns_servers(), don't count each time 2024-09-11 21:36:11 +02:00
Lennart Poettering
6e1fa7516a resolved: use dns_scope_ifindex() at more places
And add a mirroring dns_scope_ifname()
2024-09-11 21:35:58 +02:00
Lennart Poettering
14dc0fc4ef resolved: simplify initialization of DnsScope 2024-09-11 21:35:47 +02:00
Lennart Poettering
8b4fb52462 pcrlock: remove empty components from our list
This is a rework of e7a93e7521: instead of
handling components with n_variants being zero at every step of the way, we instead
remove it from our list after loading all components, given that such a
component simply makes not sense for the rest of our logic.
2024-09-11 21:35:34 +02:00
Lennart Poettering
368051ee6b resolved: use unlinkat() where appropriate 2024-09-11 21:34:51 +02:00
Daan De Meyer
aaa6c6e279
Merge pull request #34377 from DaanDeMeyer/symlinks
repart: Add MakeSymlinks=
2024-09-11 21:34:37 +02:00
Lennart Poettering
e5868783ca resolvectl: show DefaultRoute state in per-link DNS staus info too 2024-09-11 21:14:28 +02:00
Lennart Poettering
118592cc49 pcrlock: correct --help text regarding recovery pin
Fixes: #33917
2024-09-11 21:13:38 +02:00
Lennart Poettering
8d647ed2ff cryptenroll: don't try to get PCR bank if we know the device key
If we operate in "offline" mode, i.e. know the device key, then we will
not have a TPM2 connection, hence don't try to read the PCR bank to use form
it.

We don't need it anyway because we are not going to test unseal things.

Fixes: #33855
2024-09-11 21:07:53 +02:00
Daan De Meyer
c64ddefd5c repart: Add MakeSymlinks=
Similar to MakeDirectories=, but creates symlinks in the filesystem.
2024-09-11 18:45:05 +02:00
Daan De Meyer
e2b0f23713 repart: Add missing parameter comment 2024-09-11 18:44:59 +02:00
Daan De Meyer
bc48bd83d3 repart: Fix memory corruption 2024-09-11 17:52:20 +02:00
Filip Lewiński
c3563dc6d9 hwdb.d/60-keyboard.hwdb: add Clevo mic mute quirk for V5x iGPU, NV41PZ
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2024-09-11 17:02:10 +02:00
Karel Zak
eb360dd9a1 udev: allow persistent storage rules for zram devices
The /dev/zramN devices can be used as regular block devices. They are
typically used for swap areas, but it would be beneficial to have
LABEL and UUID in the udev database to make it more user-friendly for
tools such as lsblk or mount (if used with other filesystems).
2024-09-11 17:01:26 +02:00
Lennart Poettering
8e1c345921 resolved: move dnssd parsers to resolved-dnssd.c
Let's keep only the parsers for the main config in resolved-conf.c
2024-09-11 17:00:03 +02:00
Lennart Poettering
c87afdf23d resolved: move resolved_dnssd_gperf_lookup() prototype definition to resolved-dnssd.h 2024-09-11 16:59:48 +02:00
Daan De Meyer
2232452379 repart: Reuse partition_needs_populate() more 2024-09-11 16:36:47 +02:00
Lennart Poettering
93f5821c95 man: fix help text for systemd-creds tool's "list" verb
I guess this was copy/pasted from sysupdate? Weird though. Fix it. And
also reword "cat" help text to make it more precise.
2024-09-11 15:21:21 +02:00
Lennart Poettering
f9807539b0 pcrlock: log if we generate an "empty" policy
Such a policy won't provide any protection, but it's still entirely fine
to have it like this in various contexts, for example at OS install
time, to allocate the nvindex and reference it in enrollments. However,
it does deserve mention, hence log about it at LOG_NOTICE level.

This is based on a similar patch by Arnaud Patard
<arnaud.patard@collabora.com> proposed at #33663.
2024-09-11 15:14:22 +02:00
sinus-x
2c8184a8d2 man: Correct flag description of systemd-cat
It is not true that "no string" is written to journal; the binary
name is used when run via `systemd-cat command`, or `cat` is used
when run via `command | systemd-cat`.
2024-09-11 15:00:34 +02:00
Luca Boccassi
8f4bbd096b test: fix TEST_SKIP for test cases with subtests
TEST-64-UDEV-STORAGE is invoked with the subtest appended, so TEST_SKIP=TEST-64-UDEV-STORAGE
does not work. Fix it by using TEST_SKIP as a partial match.

Follow-up for ddc91af4ea
2024-09-11 13:55:53 +02:00
Lennart Poettering
c355208d83 tpm2-util: fix whitespace 2024-09-11 10:28:36 +02:00
Lennart Poettering
87f5efdeb0
Merge pull request #34353 from yuwata/timesync-bus-document
timesync: add document for org.freedesktop.timesync1
2024-09-11 10:15:30 +02:00
Lennart Poettering
a5d0f74e62
Merge pull request #34348 from poettering/stub-efivar-tweaks
sd-stub: report stub location in efi vars
2024-09-11 10:09:53 +02:00
Skye Chappelle
a67a206379
Change OS X to macOS in BOOT.md (#34358) 2024-09-11 09:15:39 +02:00
Lennart Poettering
a482908cbc stub: add StubDevicePartUUID/StubImageIdentifier
These variables closely mirror the existing
LoaderDevicePartUUID/LoaderImageIdentifier variables. But the Stub…
variables indicate the location of the stub/UKI (i.e. of systemd-stub),
while the Loader… variables indicate the location of the boot loader
(i.e. of systemd-boot). (Except of course, there is no boot loader used,
in which case both sets point to the stub/UKI, as a special case).

This actually matters, as we support that sd-boot runs off the ESP,
while a UKI then runs off XBOOTLDR, i.e. two distinct partitions.
2024-09-11 06:48:27 +02:00
Lennart Poettering
77d496c083 stub: tweak setting of common Loader* EFI vars
Let's always check if we have data to set *first*, and only then check
if an EFI var is already set.

Checking for the EFI var is more expensive after all.
2024-09-11 06:48:27 +02:00
Lennart Poettering
8d5ff87a70 man: fix documentation for LoaderDevicePathUUID + LoaderImageIdentifier, in systemd-stub man page too
Let's fix the version here too, and also clarify that this is usually
not necessarily the ESP.
2024-09-11 06:48:19 +02:00
Lennart Poettering
8b5ad0ba41 man: fix LoaderDevicePathUUID + LoaderImageIdentifier descriptions
First of all, these were always set, i.e. since sd-boot was merged into
our tree, i.e. v220. Let's say so explicitly.

Also, let's be more accurate, regarding which partition this referes to:
it's usually "the" ESP, but given that you can make firmware boot from
arbitrary disks, it could be any other partition too. Hence, be
explicit on this.

Also, clarify tha sd-stub will set this too, if sd-boot never set it.
2024-09-11 06:47:16 +02:00
Lennart Poettering
66d3605896 bootctl: show new sd-boot/sd-stub feature flags 2024-09-11 06:47:16 +02:00
Maanya Goenka
25d1b96880 src/sysext: Use versioned names when logging extensions used for merge operation
If this is not done, and there are two images, image_1.raw and image_2.raw under
an image.raw.v folder, then the log will say "Using extensions image" instead of
using "Using extensions image_2.raw" which is the desired behavior for v-picked extensions.
2024-09-11 06:44:38 +02:00
Lennart Poettering
408ab988db tmpfiles: add separate fragment for stuff we copy from .extra/ into /run/systemd
Let's move copying out the PCR signature/key into its own tmpfiles
snippet.

And then let's add support for copying out the profile + os-release
information systemd-stub now places in the invoked initrd.

That way these four pieces of information are available even after the
initrd→host transition.
2024-09-11 04:47:44 +09:00
Lennart Poettering
41a9a502a1 meson: increase default number of available sections for the stub
Now that we have multi-profile UKIs people likely want to stick more PE
sections into them than before. Hence, bump the number of available PE
section slots to 30 (up from 15). Also, make this configurable at build
time since some folks probably want even more, and others don't want
this at all.

(pre-allocating too many shouldn't matter too much btw, I'd advise
everyone to overshoot, except maybe on the tiniest of embedded boards)
2024-09-11 04:47:00 +09:00
Yu Watanabe
fd0958762a man: add basic documents for org.freedesktop.timesync1
Closes #34352.
2024-09-11 04:42:50 +09:00