Commit Graph
39446 Commits
Author SHA1 Message Date
Lennart Poettering 6564591cc3 measure: store bank name in PcrState structure
Let's not query/strdup()ascii_strlower() it all the time, but just cache
it once and use it.
2022-08-20 09:01:31 +09:00
Lennart Poettering c06b6d46fd measure: add json output 2022-08-19 23:26:09 +02:00
Lennart Poettering 82b0039eb0 Merge pull request #24368 from poettering/tpm2-json-pcr-array-rework
tpm2: add helpers for building/parsing JSON arrays of PCR indexes
2022-08-19 21:51:47 +02:00
Lennart Poettering 222a951fa4 tpm2-util: introduce tpm2_parse_pcr_argument() helper
Add a new tpm2_parse_pcr_argument() helper that unifies how we merge PCR
masks in a single function, we can use all over the place. Previously we
had basically the same code for this at 4 places.
2022-08-19 21:26:26 +02:00
Lennart Poettering 98193c39c6 tpm2-util: expose more hash algorithms
swtpm supports them, hence maybe support them in our codebase, too
2022-08-19 20:12:49 +01:00
Lennart Poettering df6c3cbd02 tpm2-util: add TPM2_PCR_MASK_VALID() helper 2022-08-19 20:12:20 +01:00
Lennart Poettering 1dad9cd766 Merge pull request #24362 from poettering/sha256-tweaks
some tweaks to the sha256 implementation
2022-08-19 16:33:35 +02:00
Lennart Poettering 8de8ec88da tpm2-util: also add helper for parsing PCR arrays 2022-08-19 16:30:37 +02:00
Lennart Poettering 4436081e9d tpm2-util: split out helpers which format a PCR mask as a JSON array
This makes the code easier to read, and is something we can reuse later
on.
2022-08-19 16:29:38 +02:00
Lennart Poettering 2ab1fb77e2 tree-wide: pass proper values (not bools) to sd_event_source_set_enabled() 2022-08-19 14:56:26 +02:00
Lennart Poettering 7484c60ec6 Merge pull request #23653 from aafeijoo-suse/ask-for-recovery-key
cryptsetup: improve password prompt text
2022-08-19 14:55:54 +02:00
Rene Hollander d9bdb29bf5 Add --efi-boot-option-description argument to bootctl to control the name of the boot
entry.

By default an entry named "Linux Boot Manager" is created (which is the
previous behavior). With the flag the name of the entry can be
controlled, which is useful when installing systemd-boot to multiple ESP
partitions and having uniquely named entries.

Fixes #17044.
2022-08-19 14:55:31 +02:00
Lennart Poettering a0789e5fb8 cryptsetup: make sure all token-based codepaths are effected by SYSTEMD_CRYPTSETUP_USE_TOKEN_MODULE env var
Previously the env var was only checked when conditionalizing use of our
own libcryptsetup loadable token modules.  But let's also use it for any
other kind of token module, including possible internal ones by
libcryptsetup.
2022-08-19 14:53:54 +02:00
Lennart Poettering d1b2e04328 cryptsetup: use right internal helper when checking whether to use tokens
The other codepaths get this right, the TPM2 one currently does not. Fix
that.
2022-08-19 14:53:11 +02:00
Lennart Poettering 558d96240b sha256: add sha256_direct()/SHA256_DIRECT() helpers 2022-08-19 12:53:04 +02:00
Lennart Poettering 00b4663813 random-seed: use SHA256_DIGEST_SIZE 2022-08-19 12:53:04 +02:00
Lennart Poettering 3c4d5f2ff5 sha256: change digest buffer type to uint8_t[]
This way we can specify a size with "static". All users use uint8_t
already, hence this comes at no price.
2022-08-19 12:53:04 +02:00
Franck Bui 570fe6f12b Drop the limit on number of inodes for /dev
Follow-up for 4c733d3046.

Finding a suitable limit that would fit any use cases out there is pretty hard
and since /dev is only writeable by root anyway, let's simply drop the limit.
2022-08-19 11:25:21 +02:00
Antonio Alvarez Feijoo b6c0bd11fc cryptsetup: improve password prompt text
Instead of always asking for passphrase, if the device has LUKS2 header check:
- If only regular passphrases are registered, ask for passphrase.
- If only recovery keys are registered, ask for recovery key.
- If both regular passphrases and recovery keys are registered, ask for
passphrase or recovery key.
2022-08-19 09:01:56 +02:00
Yu Watanabe ade100f3b6 Merge pull request #24348 from yuwata/network-ipv4acd-renew
network: fix IPv4ACD issues on DHCP renewal or reconfiguring interface
2022-08-19 14:27:05 +09:00
Frantisek Sumsal cd7ad0cbde Merge pull request #24054 from keszybz/initrd-no-reload
Don't do daemon-reload in the initrd
2022-08-18 13:15:14 +00:00
Yu Watanabe 03ff3c5a46 network: unref existing sd_ipv4acd object when not necessary
On reconfiguring an interface, the new setting may not enable IPv4ACD
for an existing address anymore. Hence, we need to unref it. Otherwise,
newly requested addresses may never be ready for (re-)configuring.
2022-08-18 15:44:39 +09:00
Yu Watanabe 3c45d0d099 network: update setting for IPv4ACD or IPv6DAD in existing Address objects
Otherwise, if the setting is changed on reconfigure, the new setting
is not applied to the existing addresses.
2022-08-18 15:44:30 +09:00
Yu Watanabe e402e99eaa network: fix DHCPv4 address renewal with IPv4ACD
Previously, when a DHCP address is renewed and if the IPv4ACD for the
address is enabled, the address will never drop the probing flag, thus
the lifetime of the address will never be updated.

This drops NETWORK_CONFIG_STATE_PROBING, and the IPv4ACD status is
managed another bit, Address.acd_bound. And, the flag is updated only
when the IPv4ACD announced the address or detects conflict.
2022-08-18 15:44:23 +09:00
Zbigniew Jędrzejewski-Szmek 87305b0fbf sd-messages: rename newly added constants
This hasn't been through a release yet, so we are free to change the name.

Closes #24270.
C.f. https://github.com/systemd/systemd/commit/907506695549c689710cd267583f6fd439711dcf#r80812414
2022-08-17 22:01:54 +09:00
Zbigniew Jędrzejewski-Szmek ed7f7a984d sd-messages: make the table wider
For whatever reason, nowadays we add entries that are quite long, so
we were using line continuation for most of new entries. This is hard
to read and edit. So let's just make the table wide enough to accomodate
all the names without line splits.
2022-08-17 22:01:54 +09:00
Lennart Poettering 4dde902ea0 tpm2-util: more structure initialization simplifications 2022-08-17 21:59:47 +09:00
Lennart Poettering 582fc142da random-util: drop unnecessary header file
(And some minor reindents)
2022-08-17 21:59:28 +09:00
Yu Watanabe 190169e591 Merge pull request #24250 from yuwata/backlight-multiple-graphics-cards
backlight: support multiple graphics cards system
2022-08-17 21:58:59 +09:00
Lennart Poettering 86b4e141a5 fs-util: make touch() an inline function 2022-08-17 21:58:33 +09:00
Lennart Poettering aba5dac372 tpm2-util: credit TPM2 RNG entropy only once per boot
Acquiring random data from the TPM is not precisely quick, let's speed
things up by doing this at most once per boot. For that, let's maintain
a flag file in /run/.
2022-08-17 21:58:17 +09:00
Yu Watanabe f9b3b99017 udev: rename various validate() -> should_reload() for builtin commands
Previously, true by validate() means several configs are outdated and we
need to reload configs. That's not intuitive for me. Let's rename the
functions.
2022-08-17 21:56:46 +09:00
Yu Watanabe 9ec8c82b8c sysctl: apply prefix before calling glob()
Otherwise, if there exist million of network interfaces,
calling glob() for network properties takes much time.

Fixes #24031.
2022-08-17 14:30:20 +09:00
Yu Watanabe 3b703fe269 path-util: introduce path_glob_can_match() 2022-08-17 14:30:20 +09:00
Yu Watanabe 7177ac4572 sysctl: split out code for applying glob option 2022-08-17 14:30:20 +09:00
Yu Watanabe c01404fdf1 sysctl: drop /proc/sys/ in prefix 2022-08-17 14:30:20 +09:00
Yu Watanabe 350ffa9749 sysctl: use ordered_hashmap_ensure_put() 2022-08-17 14:30:20 +09:00
Yu Watanabe e0504dd011 backlight: fix issue on multiple graphics cards system
If a system has multiple graphics cards, then we cannot associate
platform backlight devices to backlight devices under PCI bus.

Previously, in such case, vaidate_device() for a raw backlight device
might erroneously detect a platform device and return false. So, users
could not save/load backlight level.

This makes validate_device() give up to associate platform devices on
non-PCI bus with raw backlight devices. That may cause unwanted
backlight level save or restore by systemd-backlight@.service, but users
can workaround that by masking specific instances of the service.

Closes #24223.
2022-08-17 14:22:43 +09:00
Yu Watanabe f8ff4b6076 backlight: filter out unnecessary backlight devices by device enumerator 2022-08-17 14:21:36 +09:00
Yu Watanabe b2f77b5e21 backlight: add/update several logs for validating backlight devices 2022-08-17 14:21:26 +09:00
Zbigniew Jędrzejewski-Szmek b1358f0362 run: simplification 2022-08-17 07:08:37 +09:00
Zbigniew Jędrzejewski-Szmek eab62c01ef manager: allow assignment of properties on target/swap/device units
E.g. Documentation or Markers could apply to any unit type. This already worked
partially, because a direct dbus call could be made:

After rebuild with the patch, but before the manager has been restarted:
$ build/systemctl --user set-property dev-zram0.swap Markers=+needs-restart
$ build/systemctl --user show -p Markers dev-zram0.swap
Markers=needs-restart

I noticed that that the rpm unit restart helper was throwing errors for target
units. We should just let the Markers be set for those too, even if it doesn't
do anything in the end. This way we don't need to special-case by unit type.
2022-08-17 07:08:37 +09:00
Luca Boccassi e4e6cfaad0 Merge pull request #24301 from yuwata/network-tuntap
network/tuntap: introduce KeepFileDescriptor= setting
2022-08-16 23:06:16 +01:00
Yu Watanabe af7a86b8a6 network/tuntap: save tun or tap file descriptor in fd store 2022-08-16 21:57:35 +09:00
Yu Watanabe f8b7c17764 network/tuntap: introduce KeepCarrier= setting
Closes #24267.
2022-08-16 21:57:31 +09:00
Avram Lubkin 19193b4898 sysusers: add fsync for passwd (#24324)
https://github.com/systemd/systemd/pull/6636 added `fsync()` when
temporary shadow, group, and gshadow files are created, but it was
not added for passwd. As far as I can tell, this seems to have been
an oversight. I'm seeing real world issues where a blank /etc/passwd
file is being created if a machine loses power early in the boot process.
2022-08-16 21:51:21 +09:00
Yu Watanabe 8f388c4e46 network/tuntap: code cleanups
- merge unnecessarily split functions,
- drop unnecessary initializations,
- tighten variable scopes,
- introduce TUNTAP() helper function.
2022-08-16 21:49:04 +09:00
Yu Watanabe 2720b6f23c login: use helper functions for fd store 2022-08-16 21:49:04 +09:00
Yu Watanabe 50e23ac667 daemon-util: introduce several helper functions for fd store 2022-08-16 21:49:00 +09:00
Lennart Poettering 7309690788 tpm-util: use trial session where appropriate
TPM2 knows two types of policy sessions: "real" ones and "trial" ones. The
latter allow you to calculate a policy hash without this enforcing any
policy, which the former do. Typically you want to use the "trial" ones
when enrolling, and you have to use the "real" ones for unlocking. So
far we used "real" ones for both cases. Which works fine – as long as
the policy put together matches the current reality (e.g. the PCR values
included in the policy are the ones currently in place in the TPM).

Let's switch to using trial sessions for enrolling. First of all this is
preparation for later work to implement further policy extensions (for
example, policies binding to literally specified PCR values, instead of
the once currently measured). But from my perspective more importantly
it actually is cleaner, as it communicates more clearly what we are
actually doing here.

No user-visible change in behaviour.
2022-08-16 10:16:19 +09:00