Commit Graph
100 Commits
Author SHA1 Message Date
Lennart Poettering 6315106268 add CITATION.cff file
As per spec: https://citation-file-format.github.io/

Fixes: #35260
2025-06-05 14:39:20 +02:00
Lennart Poettering 4bd37b94b8 fixes for --machine= handling in run0 and journalctl (#37741)
Fixes: #32997
2025-06-05 14:02:26 +02:00
Lennart Poettering 6d83b6afbb resolvectl: --raw improvements (#37743)
Fixes: #37737
2025-06-05 14:02:00 +02:00
Lennart Poettering 79226d797d sd-bus: treat '@' as equivalent to '@.host'
We allow omission of the part before and the part after the @. But so
far we didn't allow omitting both. There's no real reason for
disallowing that, hence be systematic and allow it.
2025-06-05 12:49:42 +02:00
Lennart Poettering 2ae32e9d8f sd-bus: port to split_user_at_host() 2025-06-05 12:49:35 +02:00
Lennart Poettering 137a8ce14d journalctl: politely refuse if non-root usernames are specified for --machine=
We currently cannot support that (supporting that would probably require
some active component in the machine, or alternatively idmapped mounts
or so), hence politely refuse it.

See: https://github.com/systemd/systemd/issues/32997#issuecomment-2127700945
2025-06-05 12:49:35 +02:00
Lennart Poettering 994a42a096 run: chop off username from --machine= argument before calling OpenMachinePTY()
Let's be compatible with sd-bus' logic to talk to machine, and support
the usual user@host syntax. We only want the host part, hence chop if
off before passing it to OpenMachinePTY().

Fixes: #32997
2025-06-05 12:45:37 +02:00
Lennart Poettering 020d6c1dce machined: open up OpenMachinePTY() for unpriv clients
The method call already does a PK check, it was just forgotten to
allowlist this in the dbus policy. And in the dbus vtable for
OpenMachinePTY() call. (It was allowlisted in the per-machine
vtable…)

Anyway, clean this up.
2025-06-05 12:44:08 +02:00
Lennart Poettering 4295c0db5f hostname-util: add new helper split_user_at_host()
Let's introduce a common helper for splitting user@host specifications
like we use them for --machine=.
2025-06-05 12:44:08 +02:00
Lennart Poettering 231a0417cd resolvectl: improve error message if we do not support dumping payload of RR 2025-06-05 12:43:36 +02:00
Lennart Poettering 317054365e man: reword --raw= explanation a bit
Explain what we mean by "payload", and for which RR types this is
intended.

And don#t claim we'd output a full packet, because we don't. We output
only the RR in binary.

Fixes: #37737
2025-06-05 12:38:28 +02:00
Lennart Poettering 141894f53a resolvectl: output slightly more data when --raw=payload is used
Let's also show A/AAAA data in binary form if --raw=payload is used. For
these RR types there's only a single data field, hence it's obbviously
meant.

Inspired by: #37737
2025-06-05 12:38:28 +02:00
Lennart Poettering f27d1bfdce sd-daemon: add sd_pidfd_get_inode_id() (#37679) 2025-06-05 09:31:48 +02:00
Lennart Poettering 4f4113ee33 sd-login: various modernizations (#37728) 2025-06-04 22:24:57 +02:00
Lennart Poettering 874c4beb24 io-util: protect against INT_MAX overflow in flush_fd() 2025-06-04 22:06:52 +02:00
Lennart Poettering 46ab6b63e5 journal: make journal_file_copy_entry() robust towards copying invalid/half-written source journal files (#37732) 2025-06-04 20:51:24 +02:00
Lennart Poettering 9151a60a4e journal-file: let's make journal_file_copy_entry() robust against concurrent writing of the source
As usual, we need to protect ourselves against concurrent modification
of journal files. We a pretty good at that these days when reading
journal files. But journal_file_copy_entry() so far wasn't too good with
that. journal_file_append_data() so far returned EINVAL when you pass
invalid data to it. Since we pass the source data as-is in there, it's
going to fail if the journal source file is slightly invalid due to a
concurrent update.

Hence, we need to validate data gracefully here that we think comes from
a safe place, because actually it doesn't, it's directly copied from an
unsafe journal file.

Hence, let's introduce a clear error code here, and look for it in
journal_file_copy_entry(), and handle it gracefully.

Pretty sure this fixes #33372, but it's a race, so I don't know for
sure. If this remains reproducible we need to look at this again.

Fixes: #33372
2025-06-04 18:05:58 +02:00
Lennart Poettering e74c1e1cac compress: get rid of a bunch of 'else' 2025-06-04 18:04:27 +02:00
Lennart Poettering eb78010898 sd-login: port sd_peer_get_cgroup() to SO_PEERPIDFD 2025-06-04 17:58:44 +02:00
Lennart Poettering e2af482f0a sd-login: place inner part of sd_login_monitor_new() by a table 2025-06-04 17:58:43 +02:00
Lennart Poettering eac4a028df sd-login: modernize return parameter handling
Let's rename the return parameters as "ret_xyz" systematically in
sd-login.

Also, let's make the return parameters systematically optional, like we
typically do these days. So far some where optional, other's weren't.
Let's clean this up.
2025-06-04 17:58:42 +02:00
Lennart Poettering 8e6ceee38b update TODO 2025-06-04 16:28:52 +02:00
Lennart Poettering d1bacb0b8d doc: clarify that root storage daemons need unit files
Fixes: #37700
2025-06-04 15:07:34 +02:00
Lennart Poettering 59fe8d74b5 doc: mention 'exitrd' term 2025-06-04 15:07:34 +02:00
Lennart Poettering 959d7f1759 resolved: honour SD_RESOLVED_NO_CNAME flag when processing cache
Fixes: #33300
Replaces: #35102
2025-06-04 12:52:11 +01:00
Lennart Poettering d483ac1d0d compress: avoid a bunch of div-by-zeroes
Follow-up for #37706. Implements the same logic for all compression
algorithms we have.
2025-06-03 18:27:02 +02:00
Lennart Poettering a53b225c53 tpm2: various smaller fixes, mostly about better error messages and support checking (#37690)
Fixes: #35187
Fixes: #36743
Fixes: #37607
2025-06-03 18:26:36 +02:00
Lennart Poettering 9c335d2458 tpm2-util: guarantee that verb_has_tpm2_generic() returns usable exit status 2025-06-03 16:16:46 +02:00
Lennart Poettering 8756482804 tpm2-util: use BIT_FOREACH() more 2025-06-03 16:16:46 +02:00
Lennart Poettering 1e08f92250 tpm2: add a clear error message for all errors that suggest a PCR violation
Fixes: #35187
2025-06-03 16:16:46 +02:00
Lennart Poettering 8335765bb8 tpm2-util: add a brief summary of tpm2_unseal() return values in a comment 2025-06-03 16:15:34 +02:00
Lennart Poettering f31a87331f tpm2-util: also generate recognizable error if PolicyAuthorizeNV fails 2025-06-03 16:12:45 +02:00
Lennart Poettering c7ce6fd30e pcrlock: also refuse lacking SHA-256 support early when creating policy
This will fail eventually, but let's be explicit early here.
2025-06-03 16:12:45 +02:00
Lennart Poettering 3ab04fbc4c pcrlock: make error messages more useful if PCR state doesn't match policy during PolicyOR
Fixes: #35187
2025-06-03 16:12:45 +02:00
Lennart Poettering 1144f07dc6 measure: generate a more useful error in case SHA1 support is disabled by distro
Fixes: #36743
2025-06-03 16:12:45 +02:00
Lennart Poettering ccd2bf48b2 pcrlock: add "is-supported" verb that checks if the local TPM supports the commands we need for pcrlock
systemd-pcrlock requires support for the PolicyAuthorizeNV command,
which is not implemented in the first TPM2 releases. We also strictly
require SHA-256 support. Hence add a tool for checking for both of
these.

This is a tighter version of "systemd-analyze has-tpm2", that checks for
the precise feature that systemd-pcrlock needs, on top of basic TPM2
functionality.

Fixes: #37607
2025-06-03 16:12:45 +02:00
Lennart Poettering d1c36f11d5 tpm2-util: correct copy/pasted error message 2025-06-03 16:05:25 +02:00
Lennart Poettering 30f6240bd2 nss-systemd/userdb drop-ins: various doc updates (#37693)
This mostly adds crosslinks from various bits and pieces of userdb docs
to each other, and adds some clarifications.

Fixes: #27208
2025-06-02 17:02:20 +02:00
Lennart Poettering a9de5d7d84 man: emphasize that systemd-userdb-load-credentials.service doesn't do UID/GID allocation 2025-06-02 15:16:31 +02:00
Lennart Poettering c5fcf4ab59 man: add reference from userdbctl man page to nss-systemd regarding user record drop-ins 2025-06-02 15:16:31 +02:00
Lennart Poettering c4c0307f53 man: mention systemd-userdb-load-credentials.service when discussing /run/userdb/ drop-ins 2025-06-02 15:16:31 +02:00
Lennart Poettering 344309d6d9 repart: fix generation of UUID= line for vfat in fstab entries (#37689)
Fixes: #36735
2025-06-02 12:25:14 +02:00
Lennart Poettering a27e58892e repart: set a useful access mode file for generated fstab files
We create these as temporary files with 0600 access mode. Let's adjust
this before we install the files.
2025-06-02 10:12:33 +02:00
Lennart Poettering 8504721e0e repart: fix generation of UUID= line for vfat in fstab entries
Fixes: #36735
2025-06-02 10:12:10 +02:00
Lennart Poettering 83f8c15dea Update TODO 2025-06-02 09:34:59 +02:00
Lennart Poettering 253acf116c repart: make CopyBlock=auto work for verity sig partitions
Note that this doesn't care which partition set (A or B in an A/B
scenario) is actually newer, it just picks the first suitable, but
that's something we should look into later. For now, let's just make
verity sig partitions work the same way as verity partitions.

Fixes #34835
2025-06-02 06:45:09 +02:00
Lennart Poettering a15c5517e0 repart: make use of blkid_partition_get_type_id128() more 2025-06-02 06:44:58 +02:00
Lennart Poettering 249752d1ec mount-util: avoid unnecessary mount_setattr() call in make_fsmount()
If .attr_set is zero (and .att_clr, .propagation too), then there's no
point in calling mount_setattr().

Fixes: #37062

Note that this optimization is not precisely load-bearing anymore, since
3cc23a2c23 got merged which removes the
only caller of make_fsmount() that might trigger it. But it's worth
fixing generic code anyway, in case it gets used like this later again.
2025-06-01 03:14:02 +09:00
Lennart Poettering 1105f8d20f tree-wide: only use .si_pid field in siginfo_t, if .si_code indicates that's safe
Fixes: #37498
2025-05-31 14:48:37 +02:00
Lennart Poettering a5b713630f update NEWS 2025-05-28 23:01:21 +02:00
Lennart Poettering 5b94cdf888 update TODO 2025-05-28 18:29:47 +02:00
Lennart Poettering e08ee8fdd3 update NEWS in preparation for v258 2025-05-28 18:29:47 +02:00
Lennart Poettering 5c5934c62d mountfsd: add ability to create dir owned by foreign UID range in unpriv $HOME (#37616) 2025-05-27 12:20:05 +02:00
Lennart Poettering aa62b1ba58 Assorted systemd-machined fixes (#37622) 2025-05-27 12:19:46 +02:00
Lennart Poettering 8215935180 ci: add test case for io.systemd.MountFileSystem.MakeDirectory() and varlinkctl --push-fd= 2025-05-27 10:41:52 +02:00
Lennart Poettering b4c2e2b970 varlinkctl: optionally push fds to server 2025-05-27 10:41:52 +02:00
Lennart Poettering 0261fe571b mountfsd: add call for creating a foreign UID owned dir in dir owned by caller
In order to fully support unpriv containers placed in directories owned
by the foreign UID range, below some unpriv user $HOME, we need to away
to actually create these hierarchies in the first place.

Let's add a method call for that. It takes a dir fd, then validates that
its ownership matches the client's identity, and then creates a subdir,
chown()ing it to the foreign UID range. It then returns an fd to the
result.

The result could then be passed to MountDirectory() in order to get a
mount which can then be populated by some code running in a dynamic
userns.
2025-05-27 10:41:52 +02:00
Lennart Poettering cb062410ec sd-json: add json_dispatch_const_filename()
json_dispatch_const_filename() is to json_dispatch_filename() what json_dispatch_const_path() is to json_dispatch_path().
2025-05-27 10:37:11 +02:00
Lennart Poettering 48764e2e58 machine: fix log message, doesn't have to be scope unit, can by any 2025-05-27 10:27:37 +02:00
Lennart Poettering ca02f658e0 machine: rework machine_gc()
Let's check the leader alive state, and let's log about dbus errors.
This mimics (but is not quite identical to) what we do these days in
logind for GC'ing user sessions.
2025-05-27 10:27:37 +02:00
Lennart Poettering 0c38bc6227 machine: shorten code 2025-05-27 10:23:36 +02:00
Lennart Poettering ee5622f9f0 machine: as safety precaution also check parsed machine name 2025-05-27 10:23:36 +02:00
Lennart Poettering 6981e465a7 machine: also save/restore vsock CID properly 2025-05-27 10:23:36 +02:00
Lennart Poettering 320b370ab3 machine: modernizations of serializing/deserializing netif data 2025-05-27 10:23:36 +02:00
Lennart Poettering 20babd6038 machine: save/restore machine leader pidfdid 2025-05-27 10:23:36 +02:00
Lennart Poettering 4b9c918431 machine: use the correct escaping calls for machine metadata 2025-05-27 10:23:36 +02:00
Lennart Poettering b8396f1102 machine: properly remove unit name symlink on removal 2025-05-27 10:23:36 +02:00
Lennart Poettering a4dc3b16d9 machine: port machined state files to fopen_tmpfile_linkable()
Similar to the erlier commit for logind, switch to a more modern way to
write the state files.
2025-05-27 10:23:36 +02:00
Lennart Poettering 0c18c0deee machine: insist in a valid root directory 2025-05-27 10:23:36 +02:00
Lennart Poettering 98fc46f2a6 logind,machined: expose bus properties for leader PID fd ids, too 2025-05-27 10:23:36 +02:00
Lennart Poettering 5b759bf5fd homed: generate proper error if we cannot create mountpoint for homedir
Let's make this easier to debug. (When this failed for me due to disk
full it took me a bit to figure out what was going on.)
2025-05-27 10:10:03 +09:00
Lennart Poettering 61d3133706 polkit: reword 'Interactive authentication required' error
I guess the current wording of "Interactive authentication required." is
hard to grok for many users. Let's try to reword this, and say
explicitly:

1. That this is a form of "access denied" error
2. That interactive auth could remedy this
3. But that the client disabled interactive auth

I think these are the three primary elements the error msg needs to
convey. I tried to distill this in a short error string with this.

Fixes: #2081
2025-05-27 05:52:38 +09:00
Lennart Poettering bee59ab901 varlinkctl: if returned error is an errno, print it as one in log message 2025-05-27 05:51:47 +09:00
Lennart Poettering 040637ebaa machinectl: fix indentation of status output field
One field is differently aligned then the others in the "status" output.
Fix that.
2025-05-26 18:08:28 +02:00
Lennart Poettering a6b5e57274 update TODO 2025-05-26 13:46:51 +02:00
Lennart Poettering 0cca16a836 units: enable watchdog notifications for vmspawn
nspawn supports it and enables it. Let's do this for vmspawn too. It
already supports it in code. Let's make it also work in the unit file.
2025-05-26 13:23:45 +02:00
Lennart Poettering 3ae6e64641 loginctl,machinectl: use LESS_BY() where appropriate
And while we are at it, add a lower bound of the display output to 10
for all three cases, because it's pointless outputting someting with
less space.
2025-05-24 00:23:14 +09:00
Lennart Poettering ceed11e465 path-util: invert PATH_STARTSWITH_ACCEPT_DOT_DOT flag
As requested: https://github.com/systemd/systemd/pull/37572#pullrequestreview-2861928094
2025-05-23 06:51:45 +02:00
Lennart Poettering 482107724f cgroup: port some code over to path_startswith_full() 2025-05-23 06:51:43 +02:00
Lennart Poettering ee19edbb9f path-util: add flavour of path_startswith() that leaves a leading slash in place 2025-05-23 06:50:30 +02:00
Lennart Poettering b179ae57a4 logind: fix serialization of display user field
Follow-up for: 232f4e12fe
2025-05-22 18:09:54 +02:00
Lennart Poettering c450027d14 env-file: rework write_env_file() to make use of O_TMPFILE 2025-05-22 02:50:48 +09:00
Lennart Poettering dfc9fd0147 logind: rename EnableWallMessages= configuration knob to WallMessages= (#37553)
We generally frown on config options that are called
EnableXYZ=/DisableXYZ=, hence drop this here too. Note that the original
sin was that the pre-existing D-Bus property already used the prefix.
But given that D-Bus properties are substantially more low-level (i.e.
developer focused) than the config knobs, let's bite the bullet and
name the configuration option cleanly, even if the dbus property carries
the damn prefix.

The knob was added post v257, hence this is not a compat break.

Follow-up for: 130698dc20
2025-05-22 02:47:57 +09:00
Lennart Poettering 3c70cbae0f machined: call pidref_verify() in some cases this was missing
We need to protect us from recycled PIDs here like everywhere else: once
we read data from /proc/$PID/ we need to validate that $PID still points
to the original pidfd.
2025-05-22 02:38:38 +09:00
Lennart Poettering f01d8658a3 logind: also save pidfdid as part of session state, even if we don't parse it 2025-05-21 17:33:40 +02:00
Lennart Poettering 1aa202dd24 logind: save/restore inhibitor process pidfdid 2025-05-21 17:33:40 +02:00
Lennart Poettering b0555149de logind: always enclose list fields (that may contain spaces) in quotes 2025-05-21 17:33:40 +02:00
Lennart Poettering 232f4e12fe logind: fix escaping of various fields in state files
parse_env_file() applies a certain kind of unescaping, and we really
need to match that when writing out arbitrary strings.

(This gets a bit confusing in the inhibit case, since that already
applied one level of escaping on its own...)
2025-05-21 17:33:40 +02:00
Lennart Poettering 019c8ea26a logind: port logind state files to fopen_tmpfile_linkable()
This replaces use of fopen_temporary() with fopen_tmpfile_linkable() +
flink_tmpfile(). This both shortens the code and means we use O_TMPFILE
for installing these files, which is always good.

No change in behaviour otherwise.
2025-05-21 17:33:40 +02:00
Lennart Poettering e27333b2cc env-file: add helper for printing a properly escaped env var file assignment 2025-05-21 17:33:40 +02:00
Lennart Poettering 8193066c0f update TODO 2025-05-21 07:13:19 +02:00
Lennart Poettering 18fa37a62c Prettify bootctl status (#37524) 2025-05-21 07:10:07 +02:00
Lennart Poettering 81a1f8eeba resolved: add new "DNS Delegate" concepts (#34368)
Various long standing issues (at least: #5573 #14159 #20485 #21260
#24532 #32022 #18056) have been asking for a way to delegate DNS
resolution of specific domains to very specific DNS servers.

This PR goes a major step towards that goal by adding a new concept "DNS
Delegate" which allows to configure just that. Basically, this adds a
third kind of DNS scope to resolved's logic: besides the per-link and
global DNS scopes there are now also "delegate" scopes, which can be
created by dropping in a new file /etc/systemd/dns-delegate/*.conf. They
carry DNS= and Domains= lines just like the global setting or what the
per-link configuration can carry.

And they are consulted the same way as link DNS scopes are considered,
following the same routing rules.

This allows to configure these DNS delegates statically via drop-in
files as mentioned, and only adds the most basic functionality. Later on
we might want to extend this:

1. Allow dynamic creation of DNS delegates via IPC with lifecycle bound
to IPC client (usecase: installing a DNS delegate that routes traffic to
some DNS-over-TLS server once basic setup is complete).
2. Allow configuration of protocol details per delegate the same way
this is currently allowed per-link.
3. Instead of strictly using DNS as delegation protocol, support an
alternative varlink based protocol (without retransmission problems and
so on) that systemd-machined and similar can implement.

This PR is not complete yet. Lacks docs and tests. Seems to work fine in
my local tests however.

Fixes: #5573
Fixes: #18056
Fixes: #20485
2025-05-21 00:32:07 +02:00
Lennart Poettering 88d2cb3668 test: add simple integration test for delegation feature 2025-05-20 23:00:53 +02:00
Lennart Poettering 89768b601b man: document dns-delegate files 2025-05-20 23:00:53 +02:00
Lennart Poettering 45817e9245 resolvectl: show delegate information, too 2025-05-20 23:00:53 +02:00
Lennart Poettering 5c45b341d3 resolvectl: rework parsing of dns server + search domain bus properties
Let's handle the per-link and the global dns server/search domain
property parsing the same. Let's use a flags field for three separate
booleans, and unify more code.
2025-05-20 23:00:53 +02:00
Lennart Poettering 7928c0e0a1 resolved: add concept of delegating lookups below certain domains to specific DNS servers
This permits configuration of additional "delegates" which ensure that
lookups for certain DNS zones are routed to specific sets of DNS
servers, in addition to the routes we create for each network interface.

For now, this allows only static configuration, but eventually we should
open this up to IPC.

Fixes: #5573 #14159 #20485 #21260 #24532 #32022

(Fixes #32022, because now redundant)
2025-05-20 23:00:03 +02:00
Lennart Poettering 6a198b4382 resolved: add a new DnsScopeOrigin enum, to delcare the "origin" of a DnsScope explicitly
This new enum field is supposed to indicate why a DnsScope came to be.
For now it distinguishes two origins: the "global" one (which is what is
configured in resolved.conf) and "link" ones (which are synthesized for
each link).

The field as is is pretty redundant, the same information can be
determined from whether the .link field is set or not.

This is pretty much just preparation for later commits that add
statically configured additional DnsScopes whose origin shall be encoded
with this.
2025-05-20 22:58:44 +02:00
Lennart Poettering 18bd6a4d11 update TODO 2025-05-20 22:58:17 +02:00