1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-05 13:18:06 +03:00
Commit Graph

61966 Commits

Author SHA1 Message Date
Lennart Poettering
04959faa63 generators: optionally, measure file systems at boot
If we use gpt-auto-generator, automatically measure root fs and /var.

Otherwise, add x-systemd.measure option to request this.
2023-01-17 09:42:16 +01:00
Lennart Poettering
50072ccf1b units: rework growfs units to be just a regular unit that is instantiated
The systemd-growfs@.service units are currently written in full for each
file system to grow. Which is kinda pointless given that (besides an
optional ordering dep) they contain always the same definition. Let's
fix that and add a static template for this logic, that the generator
simply instantiates (and adds an ordering dep for).

This mimics how systemd-fsck@.service is handled. Similar to the wait
that for root fs there's a special instance systemd-fsck-root.service
we also add a special instance systemd-growfs-root.service for the root
fs, since it has slightly different deps.

Fixes: #20788
See: #10014
2023-01-17 09:42:16 +01:00
Lennart Poettering
0ba07f9077 generator: teach generator_add_symlink() to instantiate specified unit
if we want generators to instantiate a template service, we need to
teach generator_add_symlink() the concept.

Just some preparation for a later commit.

While we are at it, modernize the function around
path_extract_filename() + path_extract_directory()
2023-01-17 09:42:16 +01:00
Lennart Poettering
072c8f6505 units: measure /etc/machine-id into PCR 15 during early boot
We want PCR 15 to be useful for binding per-system policy to. Let's
measure the machine ID into it, to ensure that every OS we can
distinguish will get a different PCR (even if the root disk encryption
key is already measured into it).
2023-01-17 09:42:16 +01:00
Lennart Poettering
17984c5551 pcrphase: make tool more generic, reuse for measuring machine id/fs uuids
See: #24503
2023-01-17 09:42:16 +01:00
Lennart Poettering
ff386f985b gpt-auto-generator: automatically measure root/var volume keys into PCR 15
let's enable PCR 15 measurements automatically if gpt-auto discovery is
used and systemd-stub is also used.
2023-01-17 09:42:16 +01:00
Lennart Poettering
572f78767f man: document the new crypttab measurement options 2023-01-17 09:42:16 +01:00
Lennart Poettering
94c0c85e30 cryptsetup: add tpm2-measure-pcr= and tpm2-measure-bank= crypttab options
These options allow measuring the volume key used for unlocking the
volume to a TPM2 PCR. This is ideally used for the volume key of the
root file system and can then be used to bind other resources to the
root file system volume in a secure way.

See: #24503
2023-01-17 09:42:16 +01:00
Lennart Poettering
9885c8745d tpm2-util: optionally do HMAC in tpm2_extend_bytes() in case we process sensitive data
When measuring data into a PCR we are supposed to hash the data on the
CPU and then pass the hash value over the wire to the TPM2. That's all
good as long as the data we intend to measure is not sensitive.

Let's be extra careful though if we want to measure sensitive data, for
example the root file system volume key. Instead of just hashing that
and passing it over the wire to the TPM2, let's do a HMAC signature
instead. It's also a hash operation, but should protect our secret
reasonably well and not leak direct information about it to wiretappers.
2023-01-17 09:42:16 +01:00
Lennart Poettering
15c591d1e2 tpm2-util: split out code that extends a PCR from pcrphase
This way we can reuse it later outside of pcrphase
2023-01-17 09:42:16 +01:00
Lennart Poettering
e4481cc512 tpm2-util: split out code that derives "good" TPM2 banks into an strv from pcrphase and generalize it in tpm2-util.c
That way we can reuse it later from different places.
2023-01-17 09:42:16 +01:00
Yu Watanabe
ab250890c0
Merge pull request #26004 from poettering/cleanuo-erase-moar
tree-wide: use CLEANUP_ERASE() at many places
2023-01-17 14:04:02 +09:00
Yu Watanabe
841dfd3dc0 sd-dhcp-client: gracefully handle invalid ether type client ID
Currently, sd-dhcp-server accepts spurious client IDs, then the leases
exposed by networkd may be invalid. Let's make networkctl gracefully
show such leases.

Fixes #25984.
2023-01-16 20:00:08 +00:00
Lennart Poettering
ec56edf55c busctl: simplify peeking the type
let's peek the type before we enter the variant, not after, so that we
can reuse it as-is, instead having to recombine it later.

Follow-up for: #26049
2023-01-16 20:54:44 +01:00
Yu Watanabe
ea9dbf51c6 sd-dhcp6: always append the default status message generated from status code
Fixes #25988.
2023-01-16 19:46:05 +00:00
Yu Watanabe
303dfa73b3 network: fix memleak
Fixes a bug introduced by af2aea8bb6.

Fixes #25883 and #25891.
2023-01-16 19:42:59 +00:00
Luca Boccassi
37df1221d5
Merge pull request #26071 from yuwata/network-dhcp-quick-ack
network: make TCP quick ACK mode for dynamic routes configurable
2023-01-16 19:41:03 +00:00
Luca Boccassi
36c7dcb7fa
Merge pull request #26054 from aplanas/fix_user_creds
creds-util: some fixes related with TPM2 and capabilities
2023-01-16 19:40:05 +00:00
Luca Boccassi
9e6b820e8d
Merge pull request #26051 from YHNdnzj/systemctl-list-dependencies-type
systemctl: list-dependencies: support --type= and --state=
2023-01-16 19:38:58 +00:00
Lennart Poettering
5040b2cfab memory-util: add CLEANUP_ERASE_PTR() macro and use it 2023-01-16 16:19:07 +01:00
Lennart Poettering
692597c843 tree-wide: use CLEANUP_ERASE() at various places
Let's use this new macro wherever it makes sense, as it allows us to
shorten or clean-up paths, and makes it less likely to miss a return
path.
2023-01-16 15:44:43 +01:00
Lennart Poettering
32284ffc12 update TODO 2023-01-16 14:29:16 +01:00
Daan De Meyer
7ea3f4ff60
Merge pull request #25999 from DaanDeMeyer/mkosi
ci: Update mkosi action to latest commit
2023-01-16 14:24:04 +01:00
David Tardon
218cfe2335 mount: handle bind mount of file with non-existing target
When the target (Where=) of a mount does not exist, systemd tries to
create it. But previously, it'd always been created as a directory. That
doesn't work if one wants to bind-mount a file to a target that doesn't
exist.

Fixes: #17184
2023-01-16 22:16:49 +09:00
Alberto Planas
e37dfcec52 creds-util: merge the TPM2 detection for initrd
This patch merge the TPM2 detection paths when we are inside and outside
an initrd.

Signed-off-by: Alberto Planas <aplanas@suse.com>
2023-01-16 13:40:40 +01:00
Alberto Planas
e653a194e4 creds-util: do not try TPM2 if there is not support
During the credentials encryption, if systemd it is compiled with TPM2
support, it will try to use it depending on the key flags passed.

The current code only checks if the system has a functional TPM2 if the
case of the INITRD flag.

This patch do a similar check in the case that it is outside initrd (but
still automatic).

Signed-off-by: Alberto Planas <aplanas@suse.com>
2023-01-16 13:31:17 +01:00
Alberto Planas
1615578f27 creds-util: check for CAP_DAC_READ_SEARCH
In make_credential_host_secret, the credential.secret file is generated
first as a temporary anonymous file that is later instantiated with
linkat(2).  This system call requires CAP_DAC_READ_SEARCH capability
when the flag AT_EMPTY_PATH is used.

This patch check if the capability is effective, and if not uses the
alternative codepath for creating named temporary files.

Non-root users can now create per-user credentials with:

  export SYSTEMD_CREDENTIAL_SECRET=$HOME/.config/systemd/credential.secret
  systemd-creds setup

Signed-off-by: Alberto Planas <aplanas@suse.com>
2023-01-16 13:31:17 +01:00
Mike Yuan
3729976944
systemctl: list-dependencies: support --type= and --state=
Closes #25975
2023-01-16 19:46:52 +08:00
Łukasz Stelmach
87d1221174 man: clarify applicability of IPv6AcceptRA option
There is no reason to not accept RAs on bondX devices (devices that
aggregate other devices). It makes sense for aggregated devies though.
2023-01-16 10:30:15 +00:00
Mike Yuan
d708293d43 gpt-auto: harden ESP/XBOOTLDR mounts with "noexec,nosuid,nodev"
When these partitions are probed by gpt-auto,
they will always be hardened with such options.

See also: https://github.com/systemd/systemd/issues/25776#issuecomment-1364115711

Closes #25776
2023-01-16 11:15:07 +01:00
Ulrich Ölmann
4b2e6892cb man: udev_enumerate_new: fix typo 2023-01-16 18:27:15 +09:00
Yu Watanabe
1d00da3755 NEWS: mention QuickAck= 2023-01-16 14:40:26 +09:00
Yu Watanabe
c972026888 NEWS: move one entry to the correct section 2023-01-16 14:40:25 +09:00
Yu Watanabe
f95fb19922 network: introduce QuickAck= for [DHCPv4] and [IPv6AcceptRA]
Closes #25906.
2023-01-16 14:40:22 +09:00
Daan De Meyer
67b65ac62d ukify: Fix version string
Let's make sure we mimick the version of our other CLI tooling.
2023-01-15 22:17:37 +00:00
Luca Boccassi
f86d037623 docs/man: remove reference to default vsock CID
This was dropped on reviewers' request in the revision that got merged,
but reference in two documents was not updated. Fix it.

Follow-up for: https://github.com/systemd/systemd/pull/25918
2023-01-15 22:17:15 +00:00
Daan De Meyer
8c21a0c9ee mkosi: Use meson setup 2023-01-15 20:45:22 +01:00
Daan De Meyer
1a01473065 boot: Remove -O1 workaround
Now that we have ukify and mkosi has been updated to use it, we
have a solution in place to make sure that PE sections don't overlap
in a UKI so let's drop the workaround to avoid overlapping PE sections.
2023-01-15 20:45:22 +01:00
Daan De Meyer
9d2e4ceee5 ci: Update mkosi action to latest commit
Let's make sure we're testing with the latest changes in mkosi. This
includes both the switch to systemd-repart and ukify, making sure we
get extra testing coverage for those components.

This also drops options from the centos config that have been removed
in the newer mkosi.

For some reason idmapping runs into some issues so we disable it for
now.
2023-01-15 20:44:53 +01:00
Ulrich Ölmann
3d16448758 man: libudev: fix typo 2023-01-15 17:19:10 +00:00
Yu Watanabe
2cbb171d20 busctl: fix introspecting DBus properties
Follow-up for f2f7785d7a.

Fixes #26033.
2023-01-15 15:39:46 +00:00
Frantisek Sumsal
fc2a0bc05e test: support a non-default SysV directory
Since the directory is configurable via -Dsysvinit-path= during build,
it makes the test fail on Fedora/RHEL/CentOS, where it's set to
/etc/rc.d/init.d, instead of the default /etc/init.d. Since we can't get
the value at runtime (in a reasonable manner), let's just support the
two most common paths for now.

Follow up to 7fcf0fab07.
2023-01-14 09:50:43 +09:00
Daan De Meyer
85e2e80699 open-file: Fix user-after-free 2023-01-13 17:14:23 +01:00
Mike Yuan
8e481bd292
systemctl: list-dependencies: pass bool where appropriate 2023-01-13 16:15:32 +08:00
Yu Watanabe
d59ce37c28
Merge pull request #26047 from yuwata/udev-node-cleanups
udev: several cleanups
2023-01-13 14:46:58 +09:00
Franck Bui
6d90488acb udev: simplify a bit stack_directory_find_prioritized_devnode()
And make the new format the one we expect as it should replace the old one
pretty quickly.
2023-01-13 12:06:00 +09:00
Franck Bui
e8a54a4e75 udev: return ENODEV if link_directory_read_one() can't find the devnode
That's usually the errno code we return when a device cannot be found because
it's been unplugged.
2023-01-13 11:22:31 +09:00
Franck Bui
72a459adc4 udev: let stack_directory_open() convert a slink into a dirname itself
We likely always want to open the directory via a slink.

There's currently only one caller so it doesn't make any difference in practice
but I think it's still nicer.

No functional change.
2023-01-13 11:16:14 +09:00
Franck Bui
c9032f910c udev: merge link_directory_lock() into link_directory_open()
These 2 operations are inseparable.
2023-01-13 11:16:10 +09:00
Ludwig Nussel
e443cc7c05 bootspec: show efi entry too 2023-01-13 10:50:18 +09:00