Commit Graph
6331 Commits
Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek eb5b6b7310 Merge pull request #24708 from keszybz/not-available-in-tables
various: use "-" instead of "n/a" in tables
2022-09-17 18:16:42 +02:00
Zbigniew Jędrzejewski-Szmek 8a9651088f various: use "-" instead of "n/a" in tables
In the context of a table, both would be generally understood to have the same
meaning. "n/a" is a strange beast. It was useful when tables were produced on
the typewriter with "---------" used to separate rows. It is visually more
pleasing to use "-", and there is no risk of it being mistaken for a row
separator.
2022-09-17 13:05:51 +02:00
Daan De Meyer 9bf36477bf Merge pull request #24703 from yuwata/dissect-image-verity-partition-make-fail
dissect-image: make verity_partition() actually fail when all attempts of activation failed
2022-09-17 09:57:20 +02:00
Yu Watanabe ee3455cf11 fd-util: rename CLOSE_AND_REPLACE() -> close_and_replace()
We have free_and_replace() and friends, they are all named with lower
letters, even they are macros, not functions.
For consistency, let's rename CLOSE_AND_REPLACE() with lower letters.

This also mekes the macro used more places.
2022-09-17 09:54:41 +02:00
Yu Watanabe 9972e6d6ed dissect-image: make verity_partition() actually fail when all attempts of activation failed 2022-09-17 05:18:25 +09:00
Yu Watanabe ad361a50fb dissect-image: split out verity_timeout()
To make verity_partition() shorten. No functional changes, just
refactoring.
2022-09-17 05:18:25 +09:00
Yu Watanabe 54ee1cd69d Merge pull request #24692 from yuwata/dissect-image-fix-memleak
dissect-image: fix memleak
2022-09-17 01:31:32 +09:00
Yu Watanabe ab8e6464b5 Merge pull request #24664 from yuwata/watchdog
watchdog: open /dev/watchdog0 only if it exists
2022-09-17 00:18:53 +09:00
Yu Watanabe 5bf5013fc9 dissect-image: handle all non-negative return values as success
No functional changes, just coding syle update.
2022-09-16 23:11:09 +09:00
Yu Watanabe 041e2edac8 dissect-image: fix memleak on failure 2022-09-16 23:11:09 +09:00
Yu Watanabe a6b7ebaafa watchdog: use /dev/watchdog0 only if it exists
Fixes #24661.
2022-09-16 22:34:37 +09:00
Yu Watanabe 3e911a0d0e pid1: drop redundant DBus properties
Follow-up for 10f3f4ed01.

We already have RuntimeWatchdogUSec or friends. Let's not introduce
redundant properties.

Also, drop the const qualifier for WatchdogLastPingTimestamp, as they
are actually not constant.
2022-09-16 21:53:28 +09:00
Yu Watanabe 9341f41801 watchdog: explicitly initialize global variable
No functional change, as they were implicitly initialized with zero.
2022-09-16 21:48:39 +09:00
Yu Watanabe a900274915 test-seccomp: support systems that sched_setscheduler() is already limited
Fixes #17078.
2022-09-15 13:47:17 +01:00
Yu Watanabe af3d387365 tree-wide: fix typo 2022-09-15 06:03:57 +09:00
Yu Watanabe 10f3f4ed01 pid1: introduce dbus properties WatchdogDevice and friends
Closes #24665.
2022-09-14 13:13:59 +01:00
Yu Watanabe 6f2d367e49 Merge pull request #24272 from dtardon/asserts
Use ASSERT_PTR more
2022-09-13 21:08:10 +09:00
Yu Watanabe e51bea3433 Merge pull request #24651 from yuwata/openssl-util
openssl-util: trivial cleanups
2022-09-13 21:05:42 +09:00
Yu Watanabe 35aefda35f creds-util: fix NULL pointer dereference
Fixes CID#1497840.
2022-09-13 21:05:16 +09:00
Yu Watanabe 2e64df07b8 openssl-util: use assert() if no side effect 2022-09-13 17:03:34 +09:00
Yu Watanabe d39929d96d openssl-util: drop meaningless assertion
As the type of 'msz' is int.

Fixes CID#1497842.
2022-09-13 17:03:18 +09:00
David Tardon c9958c4fc5 tree-wide: check parameter before dereferencing 2022-09-13 08:13:42 +02:00
David Tardon 995340074e tree-wide: use ASSERT_PTR more 2022-09-13 08:13:27 +02:00
Ansgar Burchardt 4167e2135e base-filesystem.c: add trailing zero byte for s390x entry 2022-09-12 23:35:09 +09:00
Lennart Poettering 251d2ea269 tpm2-util: avoid trial
Let's avoid trial mode for putting together policies if we can, and use
the real policy whenever we can pull it off.

Fixes: #24401
2022-09-10 20:58:41 +02:00
Yu Watanabe 86f9b69a6a blockdev-util: split out blockdev_reread_partition_table()
No functional changes, just refactoring.
2022-09-10 01:19:41 +09:00
Yu Watanabe 9409174ee7 udevd: use partition enumerator at one more place
No functional changes, just refactoring.
2022-09-10 00:48:34 +09:00
Yu Watanabe 9cce72ee5d Merge pull request #24611 from yuwata/loop-util-refactoring
loop-util: several cleanups
2022-09-09 23:31:19 +09:00
Yu Watanabe e0993236d3 blockdevi-util: also check sysname when enumerating partitions 2022-09-09 22:30:19 +09:00
Yu Watanabe 833106b876 loop-util: do not try to enumerate partitions twice 2022-09-09 05:16:41 +09:00
Yu Watanabe 53274fdb59 loop-util: always check if backing file is not attached yet
An image file without partition table may be attached.
2022-09-09 05:16:01 +09:00
Yu Watanabe da4fd28871 loop-util: open loopback block device in loop_configure()
And make it return LoopDevice object on success.
No functional changes, just refactoring.
2022-09-09 04:31:10 +09:00
Yu Watanabe bb273a5145 loop-util: save the flag about if LOOP_CONFIGURE ioctl works or not in loop_configure()
When LOOP_CONFIGURE fail, then it is not necessary to call it on any
later call of loop_configure(). Let's save the flag in a static variable
in the function.
2022-09-09 04:31:10 +09:00
Yu Watanabe 54ba7daf23 loop-util: split out several functions fron loop_configure() and loop_device_make_internal()
The two functions were quite long, and hard to understand its logic.
No functional change, just refactoring.
2022-09-09 04:31:10 +09:00
Frantisek Sumsal 8432b0cd20 Merge pull request #24351 from poettering/pcr-sign
support for signed TPM2 PCR policies in cryptsetup/cryptenrolls/credentials
2022-09-08 19:07:04 +00:00
Lennart Poettering 75a9681ec0 cryptsetup: hook up TPM2 token code with policies based on PCR signatures, too 2022-09-08 16:34:27 +02:00
Lennart Poettering 4d5cc0d453 tpm2-util: add helper for formatting PCR masks as string 2022-09-08 16:34:27 +02:00
Lennart Poettering fdf6c27cba tpm2-util: add common parser for the LUKS2 TPM2 JSON structure
This splits out the JSON parser used by the systemd-cryptsetup code.

This is preparation for later work to reuse it in the tpm2 cryptsetup
token module, which currently uses a separate but very similar parser
for the same data.

No change in behaviour.
2022-09-08 16:34:27 +02:00
Lennart Poettering f0f4fcaeb7 cryptenroll: hook up new TPM2 signed policies with cryptenroll 2022-09-08 16:34:27 +02:00
Lennart Poettering 6a0779cbf9 creds-util: hook up new signed PCR policies 2022-09-08 16:34:27 +02:00
Lennart Poettering d9b5841d40 tpm2-util: extend TPM2 policies to optionally check PCR values against signed values
Traditionally, TPM2 PCR policies are bound against literal PCR values,
which makes them hard to work with when updating software that is
measured into PCRs: each update will change the PCR values, and thus
break TPM2 policies of existing objects.

Let's improve the situation: let's allow signed PCR policies. Secrets
and other TPM2 objects can be associated with a public key that signs a
PCR policy. Thus, if the signed policy and the public key is presented,
access to the TPM2 object can be granted. This allows a less brittle
handling of updates: for example, whenever a kernel image is updated a
new signed PCR policy can be shipped along with it, signed by a private
key owned by the kernel vendor (ideally: same private key that is used
to sign the kernel image itself). TPM2 objects can then be bound to the
associated public key, thus allowing objects that can only be unlocked
by kernels of the same vendor. This makes it very easy to update kernels
without affecting locked secrets.

This does not hook up any of the consuming code (just passes NULL/0
everywhere). This is for later commits.
2022-09-08 16:34:27 +02:00
Lennart Poettering e8ccb5c7e1 openssl-util: add helper for calculating fingerprint of a DER public key 2022-09-08 16:27:07 +02:00
Lennart Poettering bad4c73c37 tpm2-util: allow external code to create tpm2 contexts 2022-09-08 16:27:07 +02:00
Lennart Poettering 0d75641388 tpm2-util: pick up 4 more symbols of tpm2-tss 2022-09-08 16:27: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
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
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