Commit Graph
8191 Commits
Author SHA1 Message Date
Yu Watanabe 520ae9cac7 resolve: fix varink message verification
Fixes #30199.
2023-11-28 04:10:25 +09:00
Mike Yuan bfb6b1214a bus-print-properties: prettify more unset properties 2023-11-25 00:38:49 +08:00
Mike Yuan 3f362012ce bus-print-properties: ignore CGROUP_LIMIT_MAX for Memory*{Current,Peak}
MemoryCurrent and MemoryAvailable are shown as "[not set]" when UINT64_MAX
(unset). Let's do the same for the newly-added Memory*{Current,Peak} properties.
2023-11-24 23:22:41 +08:00
Lennart Poettering 1b6983b395 ptyfwd: don't reset TTY twice if stdin/stdout point to same TTY
And in particular don't save/restore an already reset TTY state.
2023-11-24 11:00:52 +01:00
Yu Watanabe 7b3bbb1038 ptyfwd: trivial format cleanups 2023-11-24 11:00:52 +01:00
Mike Yuan 0f9267501b exec-util: don't say sd-executor to avoid ambiguity
We have a systemd-executor binary now.
2023-11-23 11:39:07 +00:00
Mike Yuan 0ca66adfcc conf-parser: only read the first found main config file
Follow-up for 93f1da4556
and 8ea288db01

Before the offending commits, we only read the first found
main config file. If the main config file is symlinked to/as
a drop-in, we should break instead of continuing, for it to
be read later.
2023-11-22 17:44:54 +00:00
Luca Boccassi c1fd45d067 Merge pull request #30143 from poettering/machine-credential-fixes
machine credential fixes
2023-11-22 17:43:14 +00:00
Luca Boccassi 31897753fb Merge pull request #30024 from keszybz/one-doc-thingy
Serialize units ratelimits and document StartLimitIntervalSec=infinity
2023-11-22 17:42:51 +00:00
Lennart Poettering 2105f79ed3 machine-credential: tweak --load-credential= use a bit
Let's try to recognize paths (i.e. those with a "/") as source for
credentials to load, and then read them from the file system. Also, only read
credentials from an inbound credentials directory if the source
qualifies as valid credential name.

Otherwise print a nice error.
2023-11-22 15:17:18 +01:00
Lennart Poettering 1311946233 machine-credential: simplify code a bit 2023-11-22 15:17:18 +01:00
Lennart Poettering 437f3e156d machine-credential: use word 'Credential' rather than 'MachineCredential'
Probably some search/replace mistake.
2023-11-22 15:17:18 +01:00
Lennart Poettering d66c4d101e machine-credential: fix GREEDY_REALLOC error handling
We must check the return value of GREEDY_REALLOC for OOM, and the
pointer are updated already on success, hence it's a bad idea to make a
copy of the pointer beforehand.
2023-11-22 15:17:18 +01:00
Lennart Poettering 6045958bab machine-credential: fix error logging
Remove duplicate logging: let exclusively
machine_credential_load()/machine_credential_set() log, and not the
caller again.
2023-11-22 15:16:32 +01:00
Yu Watanabe d61a4dbba9 pid1: move draw_cylong() to pretty-print.[ch] 2023-11-22 08:59:23 +09:00
Lennart Poettering 07e89d501f tpm2-util: rename json field "tpm2-pcrlock" → "tpm2_pcrlock"
We generally want to avoid to include dashes in json field names. We
historically made a mistake there which is hard to fix. But for new
fields, let's get this right. We already got it right for a bunch of new
fields, hence also make sure to use underscores rather dashes for new
additions.

This field was added post v254, and since we didn't release since then,
let's just rename it.
2023-11-21 16:58:48 +00:00
Yu Watanabe e00f1dda7d in-addr: improve log message for e.g. [DHCPv4] AllowList=
Closes #30107.
2023-11-21 09:32:50 +00:00
Lennart Poettering aab79f5278 format-table: add a proper "underline" concept to cells 2023-11-20 13:05:50 +01:00
Mike Yuan 0e8f09561f hibernate-util: if asked to bypass space check, accept the case when we
have no swap space at all

But I shall still recommend
https://chrisdown.name/2018/01/02/in-defence-of-swap.html
to everyone ;-)

Fixes #30083
2023-11-18 20:15:42 +08:00
Mike Yuan 500ec22d09 hibernate-util: report no available swap as no enough swap space
Otherwise, ENOENT or ENXIO may be directly returned as error through
bus.

Should help to generate clearer error message for #30083.
2023-11-18 20:15:41 +08:00
Zbigniew Jędrzejewski-Szmek 07a6647abb core: split out the helper to serialize/deserialize ratelimits 2023-11-17 17:47:37 +01:00
Luca Boccassi d579c42e9d loop-util: use the right error variable in log_debug_errno after fd_reopen 2023-11-16 21:13:10 +00:00
Luca Boccassi f5bb0a3163 loop-util: restart loop_configure and reopen FD when O_DIRECT fails
On kernel 5.10.178, when a squashfs file is stored on an EXT4 filesystem
backed by a dm-crypt volume, dissecting fails:

$ SYSTEMD_LOG_LEVEL=debug systemd-dissect /var/foo/bar.raw
Opened '/var/foo/bar.raw' in O_RDONLY access mode, with O_DIRECT enabled.
Couldn't find any partition table to derive sector size of.
loop2: Acquired exclusive lock.
Could not enable direct IO mode, proceeding in buffered IO mode.
Successfully acquired /dev/loop2, devno=7:2, nr=2, diskseq=87
Opened /dev/loop2 (fd=3, whole_block_devnum=7:2, diskseq=87).
      Name: bar.raw
      Size: 67.2M
 Sec. Size: 512
     Arch.: n/a

Successfully forked off '(sd-dissect)' as PID 4110.
Mounting /proc/self/fd/3 (squashfs) on /tmp/dissect-Zk3K5F (MS_RDONLY|MS_NODEV "")...
Failed to mount /proc/self/fd/3 (type squashfs) on /tmp/dissect-Zk3K5F (MS_RDONLY|MS_NODEV ""): Input/output error
Failed to mount dissected image: Input/output error
Failed to read /etc/hostname of image: No such file or directory
/etc/machine-id file of image is empty.
Failed to read has-init-system boolean: Input/output error
(sd-dissect) failed with exit status 1.
Failed to acquire image metadata: Input/output error

The kernel shows I/O errors:

kernel: blk_update_request: I/O error, dev loop2, sector 0 op 0x0:(READ) flags 0x800 phys_seg 1 prio class 0
kernel: SQUASHFS error: Failed to read block 0x0: -5
kernel: unable to read squashfs_super_block

This is independent of a particular filesystem and can be reproduced
reliably in my setup, starting from freshly formatted disks.

Instead of continuing when O_DIRECT fails, start over the setup
process without the flag, including opening a new FD, to make the
kernel happy.
2023-11-16 21:12:40 +00:00
Lennart Poettering 5df1a5538b discover-image: use TAKE_PTR() where appropriate 2023-11-15 22:53:35 +01:00
Lennart Poettering 25cdbd0428 discover-image: reindent string table 2023-11-15 22:53:35 +01:00
Luca Boccassi 4ce6e7d158 selinux: fix loading policy at early boot
First, check for the cached enabled/disabled, as that's what all the
label functions used to do. Then, if initialization is not done yet,
do not cause the label functions to bail out, as it's expected to
happen at early boot.

Among other things, fixes:

systemd[1]: Failed to compute init label, ignoring.

Follow-up for: 0617da2edb
2023-11-13 21:32:46 +00:00
Luca Boccassi 1029edea3c Merge pull request #30018 from mrc0mmand/TEST-70
test: skip --tpm2-device-key= tests with older OpenSSL
2023-11-13 20:58:43 +00:00
Frantisek Sumsal 968d232db5 tree-wide: unify OpenSSL spelling in log messages
Seeing three different spellings of OpenSSL in one log file triggers
some inner OCD I didn't even know I have.
2023-11-13 20:47:17 +01:00
David Tardon f20ae7dbdf udev-util: add wrapper for sd_device_get_property_value()
... that allows to pass additional properties to fall back to.
2023-11-13 19:18:23 +01:00
Yu Watanabe 4cec9b1b17 Merge pull request #30015 from poettering/tpm2-slow-tests
tests: skip slow tpm2 tests if slow tests aren't enabled
2023-11-14 02:38:33 +09:00
Lennart Poettering 47a7a4d404 tests: add macro for generating function enter log message
The test-tpm2 test multiplexes a bunch of tests from a single
entrypoint test that creates the TPM2 connection. This means we only get
the nice log output which test we are looking for once for the
entrypoint.

Let's add a macro that allows it to nicely generate it for the inner
tests too and use it.
2023-11-13 16:50:55 +01:00
Lennart Poettering 3cc7a9fd25 udev-util: add generic device_get_{vendor,model}_string() helpers
We chck the same props in various places, add a single implementation of
a call to inquire this.
2023-11-13 16:24:17 +01:00
Lennart Poettering aa25e19b47 util-lib: share plymouth client code
Let's add a new "plymouth-util.c" module with helpers for talking to
plymouth. We so far had three places for this, let's unify the code
doing this a bit.
2023-11-13 14:17:05 +00:00
Lennart Poettering 1a292659f2 Merge pull request #29995 from keszybz/voidify-timestamp-getters
Rename and voidify timestamp getters
2023-11-13 14:41:42 +01:00
Zbigniew Jędrzejewski-Szmek fa5a025167 Rename {dual,triple}_timestamp_get to {dual,triple}_timestamp_now
Those functions take a pointer to a timestamp and return a timestamp pointer,
so the reader would be justified to think that those are just getters. Rename
them to avoid confusion.
2023-11-13 13:27:07 +01:00
Mike Yuan 8ea288db01 conf-parser: remove unused condition
Follow-up for 9ac2f3c4d2

config_parse() returns 0 only on ENOENT, which can
never happen since we pass the FILE stream.
2023-11-13 10:32:38 +00:00
Mike Yuan 9ac2f3c4d2 conf-parser: pin seen config files
Follow-up for 93f1da4556

Addresses https://github.com/systemd/systemd/commit/93f1da45566d064f4f053b37bbac2813631f58b1#r132152321
2023-11-13 05:11:26 +09:00
Yu Watanabe 7fd93e5acc Merge pull request #29968 from bluca/executor_selinux_lazy_load
executor: lazily load SELinux
2023-11-13 05:06:44 +09:00
Yu Watanabe 5996cc348c conf-parser: fix argument type of ConfigPerfItemLookup
Prompted by #29972.
2023-11-13 00:46:39 +09:00
Yu Watanabe 62c9beaa2c conf-parser: inline variable declaration 2023-11-13 00:46:34 +09:00
Luca Boccassi 0b511787fd selinux: change fd check into assertion 2023-11-11 12:33:19 +00:00
Luca Boccassi 0617da2edb selinux: support lazy initialization
Loading the SELinux DB is slow, so support lazy initialization so
that it is done when needed.
2023-11-11 12:33:19 +00:00
Luca Boccassi 2c6a231b47 selinux: avoid probing memory status if debug logs are not enabled
Given we are optimizing the selinux paths, avoid doing these operations
unless the result is actually used
2023-11-11 12:29:52 +00:00
Luca Boccassi be0916f77c Merge pull request #29955 from poettering/repart-seal-key
repart: add --tpm2-seal-key= support, matching the recently added support cryptenroll has
2023-11-10 16:52:00 +00:00
Lennart Poettering fbe7db47f4 tpm2-setup: also save the SRK to the file system in TPM2_PUBLIC format
We already save it in PEM format, also store it TPM2_PUBLIC format next
to it. This is useful for usage with systemd-cryptenroll's
--tpm2-device-key= switch.
2023-11-09 12:47:24 +01:00
Lennart Poettering a8d8d34bfc tpm2-util: move loading of TPM2B_PUBLIC from disk into tpm2-util.c
No change in behaviour, let's just move this over so that we can reuse
this in repart later (and don't have to export the ugly `sym_` function
pointer for it)
2023-11-09 12:27:43 +01:00
Felix Dörre e375bc5fcc journalctl: verify sealed log epochs are continuous
Currently empty epochs are not sealed. This allows an attacker to truncate
a sealed log and continue it without any problems showing when verifying the
log.

This partially addresses CVE-2023-31438. One way to extend this change to
address CVE-2023-31438 completely, would be to verify that there is exactly
one seal per epoch (and not sealing when the epoch has not ended yet).

the change also adds a journal-file flag: HEADER_COMPATIBLE_SEALED_CONTINUOUS
this flag indicates that a journal file is sealed continuously and decides whether
any missing crypto epochs should trigger a warning or an error.
2023-11-09 05:13:27 +09:00
Dan Streetman c3a2a681be cryptenroll: add support for calculated TPM2 enrollment
Instead of enrolling the local TPM to a luks volume, use the public key from a
TPM to enroll it into the luks volume. This is useful when enrolling a TPM that
is not currently accessible, for example if the TPM is located on a different
system.
2023-11-07 12:20:54 -05:00
Dan Streetman 65883f6c10 tpm2: update test-tpm2 for tpm2_calculate_seal()
Add testing for tpm2_calculate_seal().
2023-11-07 12:00:07 -05:00
Dan Streetman 0a7874ad55 tpm2: add tpm2_calculate_seal() and helper functions
Add functions to calculate a sealed secret object.
2023-11-07 12:00:02 -05:00