Commit Graph

79751 Commits

Author SHA1 Message Date
Daan De Meyer
38701809a8 core: Add DelegateNamespaces= (#36532) 2025-03-01 15:18:45 +01:00
dependabot[bot]
a60cb5c425 build(deps): bump github/codeql-action from 3.27.5 to 3.28.10
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.5 to 3.28.10.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](f09c1c0a94...b56ba49b26)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-01 14:09:07 +01:00
dependabot[bot]
e24cd759e1 build(deps): bump ossf/scorecard-action from 2.4.0 to 2.4.1
Bumps [ossf/scorecard-action](https://github.com/ossf/scorecard-action) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/ossf/scorecard-action/releases)
- [Changelog](https://github.com/ossf/scorecard-action/blob/main/RELEASE.md)
- [Commits](62b2cac7ed...f49aabe0b5)

---
updated-dependencies:
- dependency-name: ossf/scorecard-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-01 14:08:38 +01:00
dependabot[bot]
c736862058 build(deps): bump redhat-plumbers-in-action/differential-shellcheck
Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 5.4.0 to 5.5.3.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](cc6721c45a...dd551ce780)

---
updated-dependencies:
- dependency-name: redhat-plumbers-in-action/differential-shellcheck
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-01 14:08:15 +01:00
Daan De Meyer
8234cd9989 core: Add DelegateNamespaces=
This delegates one or more namespaces to the service. Concretely,
this setting influences in which order we unshare namespaces. Delegated
namespaces are unshared *after* the user namespace is unshared. Other
namespaces are unshared *before* the user namespace is unshared.

Fixes #35369
2025-03-01 13:54:58 +01:00
Yu Watanabe
aaa5065d8f bump minimum required version of glibc to 2.31, and drop many fallback logic around statx() (#36558)
glibc-2.31 was released on 2020-02-01, which is more than 5 years ago.
Let's also bump the baseline of glibc.
2025-03-01 04:18:17 +09:00
Daan De Meyer
54ae0edc4a dissect: Skip partitions with _empty label 2025-02-28 17:00:50 +01:00
Lennart Poettering
8a69330e54 homed: port to notify_recv() + convert to PidRef (#36557)
Just some refactoring/modernization
2025-02-28 17:00:31 +01:00
Yu Watanabe
ee739ea692 mountpoint-util: make statx() failure critical
Two error conditions are unreachable, as now both glibc and kernel
support statx(). In other many places, failure in statx() are handled as
critical, even if it is filtered by seccomp or so. Let's follow the same
way here.
2025-03-01 00:40:22 +09:00
Yu Watanabe
d5ddc0e0d3 stat-util: drop statx_fallback()
Now both our required baseline of glibc and kernel support statx.
2025-03-01 00:33:32 +09:00
Yu Watanabe
998e6394ea test-stat-util: check if linux/stat.h is actually included from sys/stat.h 2025-03-01 00:33:32 +09:00
Yu Watanabe
4424e6c811 tree-wide: drop workarounds for statx()
struct statx in glibc header was introduced in glibc-2.28
(fd70af45528d59a00eb3190ef6706cb299488fcd), but at that time,
sys/stat.h conflicts with linux/stat.h. Since glibc-2.30
(5dad6ffbb2b76215cfcd38c3001778536ada8e8a), sys/stat.h includes
linux/stat.h if exists.

Since now our baseline of glibc is 2.31. Hence, we can drop workarounds
for struct statx by importing linux/stat.h from newer kernel (v6.14-rc4).
2025-03-01 00:33:28 +09:00
Yu Watanabe
24845c4ff6 README: bump supported minimum glibc version to 2.31
The current glibc versions used by major distributions:
CentOS 9:  2.34
CentOS 10: 2.39
Fedora 40: 2.39
Fedora 41: 2.40
Fedora 42: 2.41
Ubuntu 20.04 LTS (focal): 2.31
Ubuntu 22.04 LTS (jammy): 2.35
Ubuntu 24.04 LTS (noble): 2.39
Ubuntu 24.10 (oracular):  2.40
Debian 11 (Bullseye, oldstable): 2.31
Debian 12 (Bookworm, stable):    2.36
openSUSE SLE-15-SP6: 2.38
openSUSE Tumbleweed: 2.40

Hence, based on our supporting policy, we can bump the base line to 2.31.
This commit does not change anything on our source code. But, will drop
many workarounds for supporting older glibc in later commits.
2025-02-28 23:38:45 +09:00
Yu Watanabe
a3d0471b03 basic/linux: update kernel headers from v6.14-rc4 2025-02-28 23:38:45 +09:00
Yu Watanabe
914d1ec171 tmpfiles: fix output value assignment
Fixes a bug in 7eeda1da90 (v256).
2025-02-28 23:38:02 +09:00
Yu Watanabe
91421f8379 recurse-dir: fix wrong assertion and error code in log
Fixes a bug in b5a07e524e (v250).
2025-02-28 23:37:52 +09:00
Lennart Poettering
3b0103aaa5 homed: port worker management to PidRef 2025-02-28 14:18:23 +01:00
Lennart Poettering
09b3390529 pidref: take more fields into account in pidref_compare_func() 2025-02-28 14:18:20 +01:00
Lennart Poettering
2ad187fb68 pidref: export hash funcs
That way we can use them for definition of additional hash_ops that map
pidrefs to arbitrary other resources.
2025-02-28 14:18:07 +01:00
Lennart Poettering
a147e72add homed: port to notify_recv_with_fds()
Found another implementation of the sd_notify() reception. Modernize it.
2025-02-28 14:18:04 +01:00
Lennart Poettering
19ade24464 notify-recv: add notify_recv() flavour that returns a split up strv instead of he message text as string
This is useful at various places, since we split up the message as first
thing there anyway.
2025-02-28 14:17:52 +01:00
Yu Watanabe
649c63d6ac profile: return earlier if it is loaded from non-bash shell
Follow-up for dadbb34919.
2025-02-28 21:24:06 +09:00
Justinas Kairys
12b3ed44f3 po: Translated using Weblate (Lithuanian)
Currently translated at 70.0% (180 of 257 strings)

Co-authored-by: Justinas Kairys <j.kairys@proton.me>
Translate-URL: https://translate.fedoraproject.org/projects/systemd/main/lt/
Translation: systemd/main
2025-02-28 09:40:25 +00:00
Yu Watanabe
94dc76c996 test-network: extend test case for static routes
- split out verifications into two functions,
- also check the following scenarios:
  * unmanaging an existing interface,
  * re-managing an unmanaged interface,
  * adding a new unmanaged interface,
  * removing an unmanaged interface.
2025-02-28 08:51:14 +01:00
Luca Boccassi
80b55e4ac3 mkosi: update debian commit reference
* 4dab786933 Install new files
* a57877706d Install new files
* a6a26c4294 Install new files for upstream profile
* 2cc2784bbe Install new files for upstream
* 191edb6aa3 d/t/tests-in-lxd: skip test on any setup error
* 47c0a694b0 systemd-sysv: add Protected: yes
* 62ed7598fa README: add note about out-of-tree patches being forbidden
* dfd1b0409f systemd-resolved: recommend libidn2-0
* 88291172bc d/rules: ignore more blhc false positives
2025-02-28 15:57:10 +09:00
Yu Watanabe
3694397994 osc-context: fix typo
Follow-up for 91aa93ec8d.
2025-02-28 15:51:07 +09:00
Dan McGregor
113c159ba9 machine-id-setup: bhyve also provides a uuid
When using UEFI with bhyve it behaves similarly to qemu, and provides
a product_uuid. Use it if found, just like with qemu.
2025-02-28 13:15:35 +09:00
Lennart Poettering
46bd501faa Issue OSC ANSI sequence whenever we change "context" of a TTY, i.e. acquire privs, enter container or VM or similar (#35224)
This is mostly a strawman to get a discussion going regarding how to
communicate to terminal emulators such as ptyxis about run0 (and nspawn,
and vmspawn, and moe) and what it does.

It's hierarchical and I think still relatively simple.

/cc @chergert
2025-02-27 22:12:54 +01:00
Yu Watanabe
78f2c17454 parse-util: extend the maximum length of nftable identifiers
Since kernel v4.14, more specifically, after the following four commits,
e46abbcc05
b7263e071a
387454901b
6150957521
the maximum length of nftable identifiers are extended to 255.

Now, our kernel baseline is 5.4, hence we can freely use the extended
name length.

This also modernizes code a bit, and adds test cases.

Closes #36542.
2025-02-28 04:57:00 +09:00
Yu Watanabe
b8358967e6 sbsign: trivial coding style cleanups
Follow-ups for 8c0098d486.
2025-02-28 04:04:18 +09:00
Martin Wilck
505c2f2137 libfido2-util: accept cached pin in fido2_generate_hmac_hash()
fido2_generate_hmac_hash() sets req->keyring to "fido2-pin" when
calling ask_password_auto(), suggesting that a key by this name
can be read from the kernel keyring. But the keyring is never
opened because the ASK_PASSWORD_ACCEPT_CACHED flag is not set.

Set ASK_PASSWORD_ACCEPT_CACHED to allow automated / scripted
setup of encrypted volumes with FIDO2. If the PIN turns out to
be invalid, clear ASK_PASSWORD_ACCEPT_CACHED to avoid retrying
and possible lockout.
2025-02-27 17:35:47 +01:00
Lennart Poettering
250118f3f0 sbsign: Add support for offline signing (#36485)
Add new options --prepare-offline-signing, --signed-data= and
--signed-data-signature= which allow for offline signing in a
similar manner to pesign.
2025-02-27 17:34:05 +01:00
Lennart Poettering
cf20b5d1dc units: measure additional phases into PCR 11 when entering storage target mode or factory reset (#36543)
Let's "spoil" access to TPM secrets when we boot into these two modes.
This matters in particular for storagetm: if the host gets exploited
while booted into storage target mode any secrets kept by the TPM might
remain accessible otherwise. By measuring a new "phase" word into PCR 11
we "blow the fuse" however on this boot.
2025-02-27 15:29:48 +01:00
Lennart Poettering
bbdad5c025 core: also issue OSC 3008 from service context
(Note: we also change TEST-13-NSPAWN.machined.sh minimally here, because
it checks for byte precise output of a pty allocated for a service
invocation - which it's not going to get if it claims that the pty is an
all-powerful one. After all this PR ensures that we'll generate the new
OSC sequence on non-dumb terminals associated with services. Hence, set
TERM=dumb explicitly to ensure no ANSI sequences are generated, ever.
Which is a nice test btw that TERM=dumb really does its thing here.)
2025-02-27 15:17:34 +01:00
Lennart Poettering
5b3eaf9e68 terminal-util: change conditioning in terminal_reset_defensive()
So far we conditioned the logic that issues ansi sequences for resetting
the TTY based on whether something is a pty is not (under the assumption
we need no reset on ptys, since they are shortlived).

This is simply wrong though. The pty that a container getty is invoked
on is generally long-lived: as long as the container is up, and it will
be reused between getty instances/sessions all the time. In such a case
we really should reset properly.

Let's instead make the logic dependent on whether TERM is set to
anything other than "dumb". The previous commit made sure we always set
TERM in a sensible way in systemd-run, hence this
*explicit* logic sounds like a much better choice now, as it mea
2025-02-27 15:17:34 +01:00
Lennart Poettering
9ab703d8e1 terminal-util: change 2nd parameter of terminal_reset_defensive() to flags
let's convert the 2nd argumeng form a boolean to a proper flags
parameter. Doesn't change behaviour in anyway, but is more readable, and
prepares ground for adding more flags soon.
2025-02-27 15:13:15 +01:00
Lennart Poettering
ddb503b7f6 nspawn: set TERM to "dumb" if we are invoked outside of TTY context 2025-02-27 15:13:15 +01:00
Lennart Poettering
4d6eb6441a run: tweak logic how we set $TERM for activated services
There are two cases when we invoke a service on a TTY:

1. We ourselves are connected to a TTY and would intend to enable PTY
   forwarding.
2. We are allocating a TTY but are not ourselves connected to a TTY and
   just want to input/output to pipe or other non-TTY fd.

Let's propagate $TERM only as-is in the first case. In the 2nd case,
let's explicitly set $TERM to "dumb", so that invoked progams do not
issue needless ansi sequences, since we are not propagating them to a
terminal either.

This should be a much safer result, for cases where people include
invocations of systemd-nspawn with full TTY allocation in a shell
pipeline or so.

(of course, the user can always explicitly override this)
2025-02-27 15:13:15 +01:00
Lennart Poettering
dadbb34919 profile: generate shell + command OSC events 2025-02-27 15:13:15 +01:00
Lennart Poettering
d8069b8add pam_systemd: issue context OSC sequences when allocating new TTY session
note: this also adds making a copy of the session type string after
registering the session. That's because we need to check the session
type we settled on later to condition out the OSC sequence (because it
should only be issued on TTY sessions). However, the session type string
originally quite likely points into the PAM environment block, which we
update in the meantime, invalidating that pointer. hence, make an
explicit copy first, and use that.
2025-02-27 15:11:31 +01:00
Lennart Poettering
575922c914 run: generate OSC context sequence in run0/system-run 2025-02-27 15:09:25 +01:00
Lennart Poettering
ff03ac8730 machinectl: add OSC context support to login/shell commands 2025-02-27 15:09:25 +01:00
Lennart Poettering
5eb39a385a vmspawn: generate vm context OSC 2025-02-27 15:09:25 +01:00
Lennart Poettering
466b285bdb nspawn: output context OSC 2025-02-27 15:09:25 +01:00
Lennart Poettering
98c283131c pid1: issue boot context issue at boot 2025-02-27 15:09:25 +01:00
Lennart Poettering
91aa93ec8d osc-util: add helpers for writing OSC context events 2025-02-27 15:03:17 +01:00
Lennart Poettering
09b130c9cd doc: add OSC 3008 spec 2025-02-27 15:03:17 +01:00
Daan De Meyer
d9c7d47f99 Update TODO 2025-02-27 14:55:00 +01:00
Daan De Meyer
8c0098d486 sbsign: Add support for offline signing
Add new options --prepare-offline-signing, --signed-data= and
--signed-data-signature= which allow for offline signing in a
similar manner to pesign.
2025-02-27 13:47:07 +01:00
Daan De Meyer
6f3ef02067 sbsign: Split out functions and switch to lower level APIs
Preparation for adding offline signing support. Some additional
features and fixes are included as well:

- We make sure to add an empty SMIMECAP attribute instead of a populated
  one to mimick pesign more.
- We switch to PKCS7_dataFinal() instead of PKCS7_final() as all that the
  latter does is an unnecessary copy before calling PKCS7_dataFinal().
- We add support for passing in the signing time via $SOURCE_DATE_EPOCH.
2025-02-27 13:47:05 +01:00