Commit Graph
59692 Commits
Author SHA1 Message Date
Lennart Poettering d56f77e17f measure: print a helpful message if TPM2 PCR sysfs attributes are missing
Prompted by:

https://github.com/systemd/systemd/pull/24351#pullrequestreview-1100418585
2022-09-08 19:46:54 +02:00
Guillaume W. Bres b3fe33ff52 basic/missing_loop.h: fix missing lo_flags LO_FLAGS_DIRECT_IO 2022-09-08 18:46:19 +01:00
Luca Boccassi 90235a3df2 Merge pull request #24608 from bluca/example
docs: mention tmpfiles.d in CREDENTIALS.md and add example for ssh provisioning (to manpage too)
2022-09-08 17:42:07 +01:00
Lennart Poettering b2629096e2 Merge pull request #24600 from poettering/bootspec-chase-symlinks
bootspec: more chase_symlinks()
2022-09-08 18:40:10 +02:00
Luca Boccassi b60d3016eb docs: mention tmpfiles.d in CREDENTIALS.md and add example 2022-09-08 16:33:24 +01:00
Luca Boccassi 87d1886346 man: add example with one-liner for ssh provisioning via tmpfiles.d + Creds 2022-09-08 16:27:52 +01:00
Frantisek Sumsal f53d56f1a3 test: check the numa-test.service status directly
In a couple of recent CI runs I noticed TEST-36 failing due to a missed
service exit notification and a subsequent fail of the `grep` command:

```
[  257.112153] H systemd[1]: Started numa-test.service.
[  257.114343] H systemd[899]: numa-test.service: Failed to set NUMA memory policy: Invalid argument
[  257.118270] H systemd[899]: numa-test.service: Failed at step NUMA_POLICY spawning /bin/sleep: Invalid argument
[  257.126170] H systemd[1]: Bus private-bus-connection: changing state RUNNING → CLOSING
[  257.130290] H systemd[1]: numa-test.service: Failed to send unit change signal for numa-test.service: Connection reset by peer
[  257.131567] H systemd[1]: Received SIGCHLD from PID 899 ((sleep)).
[  257.132870] H systemd[1]: Got disconnect on private connection.
[  257.134299] H systemd[1]: systemd-journald.service: Got notification message from PID 498 (FDSTORE=1)
[  257.135611] H systemd[1]: systemd-journald.service: Added fd 38 (n/a) to fd store.
[  257.136999] H systemd[1]: systemd-journald.service: Received EPOLLHUP on stored fd 38 (stored), closing.
[  257.366996] H testsuite-36.sh[536]: + stopJournalctl
[  257.366996] H testsuite-36.sh[536]: + local unit=init.scope
[  257.366996] H testsuite-36.sh[536]: + echo 'Force journald to write all queued messages'
[  257.366996] H testsuite-36.sh[536]: Force journald to write all queued messages
[  257.366996] H testsuite-36.sh[536]: + journalctl --sync
[  257.488642] H systemd-journald[498]: Received client request to rotate journal.
[  257.520821] H testsuite-36.sh[536]: + journalctl -u init.scope --cursor-file=jounalCursorFile
[  257.981399] H testsuite-36.sh[536]: + pid1StopUnit numa-test.service
[  257.984533] H testsuite-36.sh[536]: + systemctl stop numa-test.service
[  258.173656] H systemd[1]: Bus private-bus-connection: changing state AUTHENTICATING → RUNNING
[  258.180710] H systemd[1]: numa-test.service: Trying to enqueue job numa-test.service/stop/replace
[  258.182424] H systemd[1]: Added job numa-test.service/stop to transaction.
[  258.185234] H systemd[1]: numa-test.service: Installed new job numa-test.service/stop as 738
[  258.187017] H systemd[1]: numa-test.service: Enqueued job numa-test.service/stop as 738
[  258.239930] H testsuite-36.sh[536]: + grep 'numa-test.service: Main process exited, code=exited, status=242/NUMA' journal.log
```

Let's mitigate this by checking the test service exit status directly
instead of relying on the notification.
2022-09-08 15:00:26 +00:00
Lennart Poettering bbb71e5c98 CODING_STYLE: fix header level 2022-09-08 16:13:07 +02:00
Lennart Poettering 8c87f2473f bootctl: don't start "bootctl list" output with a title line
Let's not output a title line given that we don't output multiple
different things here anyway, and the "bootctl list" command is about
listing boot entries anyway and it's documented that way.

Having titles for sections if we have mutliple sections of output
definitely makes sense, but if there's only one kind of information we
list it's redundant clutter.
2022-09-08 13:14:05 +02:00
Lennart Poettering f2c513048c bootspec: don't follow symlinks when opening type1/type2 files
let's not follow symlinks when going from enumeraiton dir to enumerated
file either.
2022-09-08 13:14:05 +02:00
Lennart Poettering 2683ae2d73 bootspec: use chase_symlinks() where appropriate
Let's better be safe than sorry, and follow symlinks in ESP + XBOOTLDR
via chase_symlinks() relative to the root of these files systems. This is
not a big issue given that ESP/XBOOTLDR are supposed to be VFAT where
symlinks don't exist, but the specs don't strictly require this, and by
loading efifs drivers in uefi it would be possible to support symlinks,
but we'd rather not have that here.

No real change in behaviour, just stricter rules to make me sleep better
at night.
2022-09-08 13:14:05 +02:00
Lennart Poettering be429c8ff6 update TODO 2022-09-08 13:14:04 +02:00
Lennart Poettering 3d83c3eacf Merge pull request #24572 from DaanDeMeyer/repart-verity
repart: Add support for formatting verity partitions
2022-09-08 12:02:27 +02:00
Lennart Poettering e586cc4cc5 Merge pull request #24434 from medhefgo/boot-fixes
boot: Small fixes
2022-09-08 11:17:12 +02:00
William Roberts 0e15c14f63 tpm2: add bind key
Currently, the tpm2 support will use encrypted sessions by creating a
primary key that is used to encrypt traffic. This creates a problem as
the key created for encrypting the traffic could be faked by an active
interposer on the bus. In cases when a pin is used, we can introduce the
bind key. The pin is used as the auth value for the seal key, aka the
disk encryption key, and that auth value can be used in the session
establishment. An attacker would need the pin value to create the secure
session and thus an active interposer without the pin could not
interpose on TPM traffic.

Related-to: #22637

Signed-off-by: William Roberts <william.c.roberts@intel.com>
2022-09-08 11:16:28 +02:00
Daan De Meyer 0fc40a0ef6 update TODO 2022-09-08 08:43:50 +02:00
Daan De Meyer b5b7879a5d repart: Add support for formatting verity partitions
This commit adds a new Verity= setting to repart definition files
with two possible values: "data" and "hash".

If Verity= is set to "data", repart works as before, and populates
the partition with the content from CopyBlocks= or CopyFiles=.

If Verity= is set to "hash", repart will try to find a matching
data partition with Verity=data and equal values for CopyBlocks=
or CopyFiles=, Format= and MakeDirectories=. If a matching data
partition is found, repart will generate verity hashes for that
data partition in the verity partition. The UUID of the data
partition is set to the first 128 bits of the verity root hash. The
UUID of the hashes partition is set to the final 128 bits of the
verity root hash.

Fixes #24559
2022-09-08 08:43:07 +02:00
Yu Watanabe e21253d3d7 Merge pull request #24587 from yuwata/sd-device-monitor-running-user-ns
sd-device-monitor: relax sender uid check when running in user namespace
2022-09-08 14:27:21 +09:00
Yu Watanabe c0aa23cf1e sd-device-monitor: relax sender uid check when running in user namespace
If sd-device-monitor is running in a user namespace, the sender uid is
not zero. Let's relax the verification in that case.
2022-09-08 11:08:43 +09:00
Yu Watanabe a30d3c0134 uid-range: move to src/basic/
To make the functions defined in the files usable by libsystemd library.
2022-09-08 11:08:43 +09:00
Lennart Poettering cdba12b34f uid-range: error code tweak for uid_range_load_userns()
Let's return ENOSYS if /proc/ is not mounted (as that's what we usually
return in that case in various helpers that operate on /proc/). Return
EOPNOTSUPP if the kernel simply doesn't support userns.
2022-09-08 06:27:29 +09:00
Yu Watanabe 30633dbd32 Merge pull request #24571 from yuwata/dissect-loop-image-use-backing-file
dissect: save image path to LoopDevice and use it when dissect loop device
2022-09-07 23:45:29 +09:00
Daan De Meyer 3ab44dbdac repart: Invert no_dropin_files boolean 2022-09-07 14:46:21 +02:00
Daan De Meyer a26d463d08 repart: Extract context dump into a separate function 2022-09-07 14:46:17 +02:00
Yu Watanabe 0fb5036f4d dissect-image: drop unnecessary duplication of partition device node 2022-09-07 20:45:24 +09:00
Yu Watanabe 0b214aa0d0 dissect-image: reuse LoopDevice.node in dissect_image()
Currently, dissect_image() is only called through dissect_loop_device(),
and the LoopDevice object has device name. Hence, it is not necessary to
get device name in dissect_image().
2022-09-07 20:45:24 +09:00
Yu Watanabe bec0c37c9e dissect-image: drop currently unused arguments 2022-09-07 20:45:24 +09:00
Yu Watanabe 7726bd4b03 dissect-image: drop currently unused code
Currently, dissect_image() is called only through dissect_loop_device(),
and image_path is always specified. Let's drop it.
2022-09-07 20:45:24 +09:00
Yu Watanabe 64dd3a245f dissect-image: use loop backing file or device node as name of the image
Note, currently, for each call of dissect_loop_device_and_warn(), the
specified name is equivalent to the path passed to loop_device_make_by_path().
Hence, this should not change the current behavios.
2022-09-07 20:45:24 +09:00
Yu Watanabe 55a065cd30 gpt-auto: use LoopDevice object to manage whole block disk 2022-09-07 20:45:24 +09:00
Yu Watanabe 369de26fdf dissect-image: use backing_file stored in LoopDevice object to generate image name
Follow-up for e374439f4b (#24322).

This also simplify the logic of generating image name from image path.
2022-09-07 20:45:24 +09:00
Yu Watanabe e77cab8248 loop-util: save backing file of loopback block device
It will be used in later commits.
2022-09-07 20:45:24 +09:00
Yu Watanabe aa0295f1d9 loop-util: move device_has_block_children() to blockdev-util.c
As the function is not only for loopback block device.

No actual code changes, just refactoring.
2022-09-07 20:45:24 +09:00
Yu Watanabe af15ee0368 blockdev-util: check if provided sd_device is for a whole block device
And split out partition_generator_new(), to make it usable in other
functions.
2022-09-07 20:45:24 +09:00
Yu Watanabe 46c3a28845 blockdev-util: make block_device_remove_all_partitions() take sd_device object
Then, it is not necessary to recreate sd_device object when we already
have.
2022-09-07 20:45:20 +09:00
Jan Janssen 97f077df05 boot: Avoid magic values in timeout EFI vars 2022-09-07 12:55:55 +02:00
Jan Janssen 28fda21c85 boot: Use proper scan codes
This arg expects scan codes and it can be very confusing to find a key
conflict when trying to add a F3 button when there are no F3 keycodes
seemingly in use. CHAR_CARRIAGE_RETURN and SCAN_F3 use the same value,
so no changes in behavior.
2022-09-07 12:55:55 +02:00
Jan Janssen 230f78206a boot: Accept Ctrl+Del for deleting words 2022-09-07 12:55:55 +02:00
Jan Janssen d17d0e6770 boot: Correctly handle shift keys 2022-09-07 12:55:55 +02:00
Jan Janssen 0cf5f816f2 boot: Refuse GPT with invalid entry size
SizeOfPartitionEntry must be a multiple of 128 * 2^n.
2022-09-07 12:55:49 +02:00
Jan Janssen 71c628d426 boot: Fix device path unaligned access 2022-09-07 12:51:16 +02:00
Jan Janssen 515581d66a boot: Use mempcpy 2022-09-07 12:51:16 +02:00
Jan Janssen aa23f91ed6 boot: Add mempcpy 2022-09-07 12:51:10 +02:00
Lennart Poettering 2c3794f422 README: we don't use crypto API in kernel anymore
This effectively reverts 9c7f7d86f8.

We dropped kernel crypto API use with
1fc8d0c9dd, hence catch up in README.
2022-09-07 11:04:34 +01:00
Lennart Poettering c87abcfa5c README: make section title less confusing
This is about glibc NSS, not about the TLS implementation library NSS.
2022-09-07 11:30:23 +02:00
Lennart Poettering 659215cf14 README: drop some spurious empty lines, we otherwise don't place after section titles 2022-09-07 11:29:14 +02:00
Lennart Poettering 470d392aed Merge pull request #24592 from poettering/coding-style-more2
more coding style documentation additions
2022-09-07 11:27:12 +02:00
Lennart Poettering 036b9e7fed README: use right emoji UTF-8 sequences for stop/warning sign 2022-09-07 10:49:49 +02:00
Lennart Poettering e8a587dca2 docs: Some CODING_STYLE additions 2022-09-07 10:05:46 +02:00
Yu Watanabe 10719a6ff8 loop-util: fix leak of file descriptor on failure 2022-09-07 07:52:32 +09:00