Commit Graph
85828 Commits
Author SHA1 Message Date
Mike Yuan e9a1271a0c units/systemd-portabled: enable NoNewPrivileges=
As with all other daemons we ship.
2026-01-21 23:13:09 +01:00
Daan De Meyer a08cee5084 mountfsd: Make singleFileSystem non-nullable
It's always set, so no need to be nullable.
2026-01-21 23:12:47 +01:00
Mike Yuan adcc87f802 Trivial follow-ups for recently merged PRs (#40417) 2026-01-21 19:54:32 +01:00
Daan De Meyer b58a45e96a portable: Enable unpriv operation (#40091)
This does not yet support directory images properly
as systemd itself does not support unpriv directory
images properly yet.
2026-01-21 16:46:53 +01:00
Mike Yuan 13c0351ba4 fdset: do not call fd_get_path() if debug logging is off
Follow-up for 89065ada83
2026-01-21 15:55:06 +01:00
Yu Watanabe 68c7004236 network/dhcp4: send release message before stopping the client
Otherwise, the socket is already closed and sending release will be
anyway skipped.

With this patch, release message is sent before stopping the client.
```
Jan 20 18:29:41 systemd[1]: Stopping systemd-networkd.service - Network Management...
Jan 20 18:29:41 systemd-networkd[3821255]: wlp59s0: DHCPv4 client: RELEASE
Jan 20 18:29:41 systemd-networkd[3821255]: wlp59s0: DHCPv4 client: STOPPED
Jan 20 18:29:41 systemd-networkd[3821255]: wlp59s0: DHCP lease lost
```

Fixes #39299.
2026-01-21 15:50:35 +01:00
Mike Yuan 1886047e59 fdset: sort includes 2026-01-21 15:49:58 +01:00
Mike Yuan 382382a6eb sysupdate-resource: on hash mismatch the best before marker is not ignored
Hence use a less ambiguous wording.

Follow-up for d0badc0a61
Addresses https://github.com/systemd/systemd/pull/40393#discussion_r2709953179
2026-01-21 15:48:14 +01:00
Daan De Meyer 824fcb95c9 portable: Enable unpriv operation
This does not yet support directory images properly
as systemd itself does not support unpriv directory
images properly yet.

The user profiles are a copy of the system profiles but without
DynamicUser=yes (can't be used by user managers) and without
ProtectHome=yes (this masks /home which breaks StateDirectory= which
is lcoated inside /home)
2026-01-21 15:09:46 +01:00
Vunny Sodhi db4b6b7043 pam_systemd_home: Use PAM_TEXT_INFO for token prompts
The prompts asking the user to physically authenticate
or confirm presence on a security token are informational
requests for action, not error conditions.

This commit changes the message type to PAM_TEXT_INFO,
which is more appropriate for guiding the user through
the authentication process.
2026-01-21 14:18:15 +01:00
AshishKumar Mishra 89065ada83 shared/fdset: add detailed debug logging to fdset_new_fill()
Currently, when fdset_new_fill() fails to open /proc/self/fd or
encounters an error while processing individual file descriptors
(such as fcntl or fstat failures), it returns a silent error code.

For debugging rarely reproducible failures it becomes difficult to
know the exact cause of failure
This commit updates the function to use log_debug_errno() for all
error paths and hence  provides better visibility into why FD collection
failed, including the path of the problematic FD (via fd_get_path)
and its inode type.
2026-01-21 20:11:23 +09:00
Daan De Meyer 1a239eae8e portable: Split out receive_portable_metadata() 2026-01-21 12:03:08 +01:00
Daan De Meyer e4058c584f portable: Make extract_now() operate on a dirfd
Preparation for making portabled support unpriv
operation.
2026-01-21 12:03:08 +01:00
Daan De Meyer 05f672c782 portable: Use report_errno_and_exit() 2026-01-21 12:03:08 +01:00
Daan De Meyer f6cfd8ac1f mountfsd: Communicate whether the image is a single filesystem
Various parts of the image dissection logic make use of whether the
thing is a single file system or not, so communicate this info back
from mountfsd.
2026-01-21 12:03:08 +01:00
Daan De Meyer a92a9efdc0 mountfsd: Add relaxExtensionReleaseChecks
We currently pass this around as a mount option in pid1, which means
privileges are required by mountfsd to mount images that make use of it.
Add an explicit argument for it in varlink instead and remove it client
side from the mount options to remove the need for privileges.
2026-01-21 12:03:08 +01:00
Daan De Meyer 4b070c4c9f path-lookup: Add config_directory_generic() 2026-01-21 12:03:08 +01:00
DaanDeMeyer 688ebd3313 dissect-image: Add more debug logging 2026-01-21 12:03:08 +01:00
DaanDeMeyer b525c1d9e9 dissect-image: Make make_image_name() public 2026-01-21 12:03:07 +01:00
Daan De Meyer ec1ab07605 dissect-image: Generalize foreign tree logic from import 2026-01-21 12:03:07 +01:00
DaanDeMeyer ebbc333880 loop-util: Make path optional in loop_device_make_by_path_at() 2026-01-21 12:03:07 +01:00
DaanDeMeyer 180875da36 test: Set SYSTEMD_NSS_LOG_LEVEL=info
Currently, our test logs are flooded with useless NSS varlink debug
logs coming from nss-systemd talking to each varlink userdb service
individually. Let's set SYSTEMD_NSS_LOG_LEVEL=info to get rid of these
verbose logs.
2026-01-21 12:03:07 +01:00
DaanDeMeyer 995c507a6f nss-util: Add support for $SYSTEMD_NSS_LOG_LEVEL
When setting SYSTEMD_LOG_LEVEL=debug and debugging a tool that happens
to do NSS lookups, the resulting logs from varlink are obnoxiously
verbose. Let's parse a separate log level environment variable in NSS
to allow overriding the log level for NSS specifically so these noisy
logs can be silenced.
2026-01-21 12:03:07 +01:00
Daan De Meyer 81a43a44eb mkosi: Install libucontext in Arch/Fedora images
Split out of #39771

We don't use make use of libucontext yet but merging this early makes
sure my mkosi cached images don't get invalidated every time I switch
between my other work and the fiber branch.
2026-01-21 12:02:52 +01:00
Mike Yuan a9859a62f1 reread-partition-table: fix typo 2026-01-21 02:15:09 +01:00
Mike Yuan 14d4bb527c prompt-util: trivial header cleanups (#40407) 2026-01-21 01:38:19 +01:00
Mike Yuan dbd7555190 mkdir: reset mtime *after* fchown()
Follow-up for 34c3d57474

Also, drop pointless shortcut.
2026-01-21 08:35:31 +09:00
Mike Yuan 475c8a491f prompt-util: use our own sd-varlink header 2026-01-21 00:10:08 +01:00
Mike Yuan dca48de7ed prompt-util: drop unneeded inclusion of stdbool.h
Our -forward headers have it covered.
2026-01-21 00:09:49 +01:00
Lennart Poettering d0badc0a61 sysupdate: add simple "freshness" validation to systemd-sysupdate
In order to make "freeze" attacks against the update logic harder let's
add the ability to encode a "Best Before" date into SHA256SUMS directory
listings: if the current time is already beyond that time, we'll ignore
the SHA256SUMS as "stale" and fail the upgrade. Or in other words: the
freeze attack will now result in a client-side error eventually, instead
of success state.

The best before data is encoded in an optional pseudo-file listed in SHA256SUMS:
any file named BEST-BEFORE-YYYY-MM-DD.
2026-01-20 21:22:35 +01:00
Mike Yuan ba1a9c7b72 bootctl,sbsign: fix $SOURCE_DATE_EPOCH parsing (#40404)
A more comprehensive fix for #40403

Closes #40403
2026-01-20 19:13:50 +01:00
Mike Yuan f6edc81230 bootctl,sbsign: fix $SOURCE_DATE_EPOCH parsing
This fixes two things:

* $SOURCE_DATE_EPOCH is previously treated as usec, while it's in seconds
* >= 0 is passed to log_debug_errno(), triggering assertion

Replaces #40403
2026-01-20 15:54:55 +01:00
Mike Yuan 2f7fdef55e install-file: add a generalized parser for $SOURCE_DATE_EPOCH 2026-01-20 15:54:55 +01:00
Yu Watanabe e6a25c2fc7 stat-util: make proc_mounted() not update errno
Typically, proc_mounted() is used in error handling. Hence, it is better
to make it not update the original errno.

Currently, there are two places that returns wrong error code:
- pidref_get_capability() in src/basic/capability-util.c
```c
        _cleanup_fclose_ FILE *f = fopen(path, "re");
        if (!f) {
                if (errno == ENOENT && proc_mounted() == 0)
                        return -ENOSYS;

                return -errno;
        }
```
- fdset_new_fill() in src/shared/fdset.c
```c
        d = opendir("/proc/self/fd");
        if (!d) {
                if (errno == ENOENT && proc_mounted() == 0)
                        return -ENOSYS;

                return -errno;
        }
```

Rather than fixing them, let's make proc_mounted() not update errno,
otherwise we may make a similar failure in a future.
2026-01-20 22:37:04 +09:00
Mike Yuan e41d7de091 core/dbus-execute: fix memleak on Mount/ExtensionImages parse failure (#40398) 2026-01-20 03:10:34 +01:00
Mike Yuan ae039016f4 bless-boot-generator: skip if current system is entered via soft-reboot
Fixes #40386
2026-01-20 11:09:27 +09:00
Yu Watanabe 9503cc3b6d resolve: include current DNS server in JSON again (#40396)
Fixes a regression caused by c6b6ac63ea.
2026-01-20 09:41:51 +09:00
Mike Yuan f0f66976e7 core/dbus-execute: use strextendf_with_separator() where appropriate 2026-01-19 23:30:58 +01:00
Mike Yuan 00f459f30f core/dbus-execute: fix memleak on Mount/ExtensionImages parse failure
Define mount_image_free_many() in our usual fashion for use in
CLEANUP_ARRAY and ensure proper cleanup on error paths.
2026-01-19 23:22:32 +01:00
safforddr 331fef07d8 tpm2: allow use of recoverable sealing keys
In some use cases it is desirable to use a recoverable (ie duplicatable)
sealing key. Currently objects have the attribute TPMA_OBJECT_FIXEDTPM
and TPMA_OBJECT_FIXEDPARENT hard coded, which will not work with a
recoverable sealing key. This patch sets the object's attributes from
the sealing key's attributes, so that both types of sealing keys will work.
2026-01-19 22:00:45 +01:00
Lennart Poettering 9316e02c9d Introduce 'fixate-volume-key' option to repart/cryptsetup to pin the exact LUKS volume key hash (#40343)
Add an option to generate the expected volume key hash for LUKS volumes
by systemd-repart
and put it to crypttab, make systemd-cryptsetup check it upon attaching.
The format of the hash
matches what's currently being measured to TPM2 PCR with
tpm2-measure-pcr=.

Closes #40123
2026-01-19 21:59:47 +01:00
Lennart Poettering 3a0ddbe338 core: follow-ups for changes to MountOptions (#40395)
Follow-up for #39449
2026-01-19 21:59:19 +01:00
Lennart Poettering 799392286e sd-varlink: ensure that "any" actually means "any but null"
The new "any" type was implemented by accident that it actually meant
"any but null" – unless marked as "any?" in which case it actually meant
truly any, including null. The spec change in
https://github.com/varlink/varlink.github.io/pull/43 otoh suggested that
"any" really means anything, and "any?" apparently too.

I think the implementation in code makes more sense than the spec change
however, hence let's add some checks/tests to ensure the behaviour of
the code is made explicitly and cared for.

I will prep a spec change to make the spec follow the code on this too.

Follow-up for: #39918
2026-01-19 21:29:38 +01:00
Nick Rosbrook e06ee11150 test: check that currentServer field is set in resolvectl JSON status 2026-01-19 13:48:07 -05:00
Nick Rosbrook d990b426b9 resolve: include current DNS server in JSON again
The current_dns_server_json object in dns_configuration_json_append() is
always NULL, because the logic to dump the current DNS server to JSON
was removed by mistake in a re-factoring commit. Add that logic back.

Fixes c6b6ac63ea ("resolve: drop unnecessary preparation of empty arrays").
2026-01-19 13:29:52 -05:00
Yu Watanabe 8a5fb3627a vmspawn: use indexed loop
Previously, the index is obtained from the pointer offset. The
pointer offset is expressed by ptrdiff_t and may be different from
ssize_t.

Let's avoid to use FOREACH_ARRAY() but use an indexed loop.
This also renames `mount` to `m` to avoid conflict with `mount()`.

Fixes #40380.
2026-01-20 02:26:35 +09:00
Vitaly Kuznetsov 398acccb2a TEST-58-REPART: Add a test for fixate_folume_key
The test checks that the expected hash is correctly recorded to the
generated crypttab and also checks that systemd-cryptsetup handles
the option correctly.
2026-01-19 17:50:25 +01:00
Vitaly Kuznetsov 4754289ddf repart: Add fixate_volume_key crypttab option generation
Add an option to capture the expected LUKS volume key hash and
record it to the generated crypttab.
2026-01-19 17:50:25 +01:00
Vitaly Kuznetsov 69fab29ec4 cryptsetup: Add fixate-volume-key option to pin the expected volume key hash
The expected hash (SHA265 HMAC signature) uses the exact same algorithm which
is used to calculate sha256 PCR bank digest when 'tpm2-measure-pcr=' is used.
2026-01-19 17:49:39 +01:00
Mike Yuan e1388041c0 core/dbus-util: several cleanups for bus_read_mount_options()
* Make sure ret_options is initialized on success.
* Return empty mount options as-is rather than NULL-ing it -
  dbus property parser for RootImageOptions relies on it
  for resetting options for a specific partition designator.
* Format partition:options properly with strextendf, currently
  multiple ":" will be emitted.
* Allow separator to be unset if in_out_format_str is not
  needed.
2026-01-19 17:49:29 +01:00