Commit Graph

9558 Commits

Author SHA1 Message Date
Jan Čermák
a2015ad126 journal-gatewayd: make num_entries in Range header optional again
Since 435c372ce5 added in v256,
num_entries part of the Range header is mandatory and error is returned
when it's not filled in. This makes using the "follow" argument clumsy,
because for an indefinite following of the logs, arbitrary high number
must be specified. This change makes it possible to omit it again and
documents this behavior in the man page.

Moreover, as the cursor part of the header was never mandatory, enclose
it in square brackets in the documentation as well and elaborate how
indexing works.

Following are some concrete examples of the Range header which are now
accepted:

 entries= (or entries=:)
  - everything starting from the first event

 entries=cursor
  - everything starting from `cursor`

 entries=:-9:10
  - last 10 events and close the connection

If the follow flag is set:

 entries=:-4:10
  - last 5 events, wait for 5 new and close connection

 entries=:-9:
  - last 10 events and keep streaming

Note that only the very last one is changing current behavior, but
reintroduces pre-v256 compatibility.

Fixes #37172
2025-06-21 02:08:03 +09:00
Lennart Poettering
83d4b2fd75 nspawn: --network-veth also works with unpriv nspawn
(because we ask nsresourced for help)

Fixes: #36179
2025-06-20 01:37:55 +09:00
Lukas Nykryn
64fcb07199 man: encourage the creation of empty machine-id instead of deleting it
Current text hints that machine-id in template image should be empty
if the system is read-only. But most of the bare metal systems and
regular VMs have /etc read-only at this phase of boot.
2025-06-18 16:58:18 +02:00
Lennart Poettering
279962a9e8 core/timer: Introduce RandomOffsetSec= knob (#36437)
This is like RandomDelaySec, but it doesn't reset whenever the manager
restarts.

Fixes https://github.com/systemd/systemd/issues/21166
2025-06-17 16:05:12 +02:00
Lennart Poettering
ef3a0ed834 various: turn off SO_PASSRIGHTS where fds are not expected (#37759) 2025-06-17 15:37:35 +02:00
Lennart Poettering
f2a365b982 network/dhcp-server: improvements for saving/loading leases (#37835) 2025-06-17 14:31:22 +02:00
Luca Boccassi
5cdf2c4d40 man: fix varname copypasta 2025-06-17 14:16:36 +02:00
Mike Yuan
5c12797fc3 core/socket: introduce AcceptFileDescriptors=
This controls the new SO_PASSRIGHTS socket option in kernel v6.16.
Note that I intentionally choose a different naming scheme than
Pass*=, since all other Pass*= options controls whether some extra
bits are attached to the message, while this one's about denying
file descriptor transfer and it feels more explicit this way.
And diverging from underlying socket option name is precedented
by Timestamping=. But happy to change it to just say PassRights=
if people disagree.
2025-06-17 13:16:42 +02:00
Mike Yuan
35462aa14a core/socket: add PassPIDFD= 2025-06-17 13:16:41 +02:00
Mike Yuan
b36ab0d4ce core/socket: don't suggest PassFileDescriptorsToExec= is a socket option
by not interleaving it among socket options.
2025-06-17 13:16:07 +02:00
Yu Watanabe
fe94aa316d network/tunnel: make sit and ipip tunnel support Mode= setting
Closing #37377.
2025-06-16 17:01:20 +09:00
Yu Watanabe
8424a70caf network/tunnel: rename Ip6TnlMode to TunnelMode
This also makes ip6tnl can be created without specifying Mode= setting,
as the kernel accepts new-link netlink message without the
IFLA_IPTUN_PROTO attribute.

No effective functional change, just refactoring and preparation for
later change.
2025-06-16 16:58:38 +09:00
Mike Yuan
a14a6f1df6 socket-activate: add a --now option to instantly start service (#37620) 2025-06-16 02:08:57 +02:00
Yu Watanabe
a145343b90 network/dhcp-server: save and load leases in runtime directory when PersistLeases=runtime
With 9ccc369ff3, PersistLeases= is
disabled on the host side virtual interfaces for containers.

However, even it is not necessary to save the leases for containers
on a persistent storage, still we should save them on somewhere.
Otherwise, leases will be lost when networkd on the host is restarted
or the host side interface is reconfigured.

This introduce PersistLeases=runtime to save and load leases on runtime
storage.
2025-06-14 03:41:20 +09:00
Colin Foster
0dbb5139a7 network/dhcp4: add ability to use BOOTP
Add the following network option to enable BOOTP:

[DHCPv4]
Bootp=yes

This will allow a two message request / reply sequence that doesn't
require DHCP message types.

Co-authored-by: Avram Dorfman <dorfman@est.org>
2025-06-13 14:15:04 +09:00
Yu Watanabe
6f5958c74d man/machinectl: underscore is not allowed in machine name
Fixes #27481.
2025-06-11 22:41:53 +09:00
Luke Yeager
9217a6ffa3 man: fix typo in dns-delegate example 2025-06-11 12:47:21 +09:00
Dan Streetman
103fa98f84 keyutil: add parameter to specify hash algorithm used for PKCS#1 signature 2025-06-10 08:45:31 -04:00
Daniel Foster
9e940164e9 socket-activate: add --now option
Add a --now option that starts the program instantly, instead of waiting for a
connection on the socket. This is useful, for instance, when developing:

Say I have a Rust, socket-activated web service. I can test it with:
systemd-socket-activate -l 8080 --fdname=http cargo run

However this delays running the service (which potentially involves compilation)
to when I try to connect to it, which wastes time. Since it delays compilation,
I also don't see any warning or errors in the code until it gets a connection
either.

The name's now a bit of a misnomer, since starting the service immediately isn't
really socket activation, but oh well ¯\_(ツ)_/⁻
2025-06-10 13:38:33 +10:00
Lennart Poettering
790f516217 machined: open up machine registration for unpriv clients also via D-Bus
This is already opened up via Varlink. Let's also open it up via D-Bus
with the same polikit operation.
2025-06-07 00:27:11 +02:00
Lennart Poettering
ac8c558629 nspawn: start polkit agent while we do polkit operations
Let's make sure unpriv nspawn can acquire privs even when invoked
outside of a desktop environment that has a polkit agent registered.
2025-06-06 22:14:50 +02:00
Lennart Poettering
c91f1a3db8 man: suggest using --unlock-tpm2-device=auto in cryptenroll example
When refreshing a tpm2 enrollment, it makes sense to use tpm2 to unlock
the device.

Fixes: #35279
2025-06-05 14:10:32 +01: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
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
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
Mike Yuan
46b0844743 sd-daemon: add sd_pidfd_get_inode_id()
We nowadays expose pidfdid at various places, e.g. envvars
and dbus properties. Also the sd_notify() MAINPID= message
has been complemented with MAINPIDFDID=. But acquiring
pidfdid is actually non-trivial especially considering
the 32-bit case, hence let's introduce a public helper
in sd-daemon specifically for that purpose.
2025-06-05 01:35:08 +02:00
Mike Yuan
dbb28f7b24 man/sd_pid_get_owner_uid: don't limit -EBADF to socket fds 2025-06-05 00:28:01 +02:00
Yu Watanabe
b525942037 man/pcrlock: fix typo
Follow-up for ccd2bf48b2.
2025-06-04 13:13:14 +09: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
Anton Ryzhov
bd02e15710 man/systemd-creds: fix documentation typo in systemd.exec.xml 2025-06-03 07:42:44 +09: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
Yu Watanabe
0436240dd2 udevadm: allow to specify device by device ID (#37636) 2025-06-02 18:02:36 +09:00
Christian Glombek
0af9937691 portable,sysext: match extension OS ID also against host ID_LIKE 2025-05-31 10:02:11 +09:00
Shubhendra Kushwaha
2948f981dd docs: add man page for sd_device_enumerator_get_device_first() and friends
For #20929.
2025-05-31 04:40:33 +09:00
Zbigniew Jędrzejewski-Szmek
505a5d2bcd Merge remote-tracking branch 'systemd-security/coredump-d' 2025-05-29 17:22:19 +02:00
Shubhendra Kushwaha
fbad1beae4 docs: add man pages for sd_device_enumerator_add_match_* (#37589)
Add man pages for:
- `sd_device_enumerator_add_all_parents`
- `sd_device_enumerator_add_match_parent`
- `sd_device_enumerator_add_match_property`
- `sd_device_enumerator_add_match_property_required`
- `sd_device_enumerator_add_match_subsystem`
- `sd_device_enumerator_add_match_sysattr`
- `sd_device_enumerator_add_match_sysname`
- `sd_device_enumerator_add_match_tag`
- `sd_device_enumerator_add_nomatch_sysname`
- `sd_device_enumerator_allow_uninitialized`.

Related to #20929
2025-05-29 18:40:18 +09:00
Luca Boccassi
868d95577e coredump: add support for new %F PIDFD specifier
A new core_pattern specifier was added, %F, to provide a PIDFD
to the usermode helper process referring to the crashed process.
This removes all possible race conditions, ensuring only the
crashed process gets inspected by systemd-coredump.
2025-05-29 00:10:55 +02:00
Zbigniew Jędrzejewski-Szmek
0c49e0049b coredump: use %d in kernel core pattern
The kernel provides %d which is documented as
"dump mode—same as value returned by prctl(2) PR_GET_DUMPABLE".

We already query /proc/pid/auxv for this information, but unfortunately this
check is subject to a race, because the crashed process may be replaced by an
attacker before we read this data, for example replacing a SUID process that
was killed by a signal with another process that is not SUID, tricking us into
making the coredump of the original process readable by the attacker.

With this patch, we effectively add one more check to the list of conditions
that need be satisfied if we are to make the coredump accessible to the user.

Reportedy-by: Qualys Security Advisory <qsa@qualys.com>

In principle, %d might return a value other than 0, 1, or 2 in the future.
Thus, we accept those, but emit a notice.
2025-05-29 00:10:08 +02:00
Yu Watanabe
d0ba749e8c udevadm: allow to specify device by device ID
We have already exposed device ID in the output of device ID in J
fields. Also sd_device_get_device_id() and sd_device_new_from_device_id()
are already public. Hence, making udevadm accept device IDs may be
useful.

With this change, as we save several data in /run/udev with device ID,
we can call udevadm something like the following:
```
udevadm info $(ls /run/udev/tags/uaccess)
```
Then, we can show all devices that has uaccess tag.
2025-05-29 04:04:22 +09:00
Yu Watanabe
6a907a00be man/udevadm: update command arguments 2025-05-29 04:04:22 +09:00
Jan Čermák
c9f931b737 journal-gatewayd: add /boots endpoint (#37574)
Add endpoint for listing boots. Output format mimics `journalctl
--list-boots -o json`, so it's a plain array containing index, boot ID
and timestamps of the first and last entry. Initial implementation
returns boots ordered starting with the current one and doesn't allow
any filtering (i.e. equivalent of --lines argument).

Fixes: #37573
2025-05-29 03:33:03 +09:00
Zbigniew Jędrzejewski-Szmek
b082968d19 man: better tags, more links, minor grammar and formatting improvements
Closes https://github.com/systemd/systemd/issues/35751.
2025-05-28 15:35:53 +02:00
Zbigniew Jędrzejewski-Szmek
acf3bdf813 man/systemd.network: reword description of MulticastIGMPVersion= 2025-05-28 15:34:47 +02:00
Zbigniew Jędrzejewski-Szmek
f56d9b82b1 man/systemd.timer: change to positive wording 2025-05-28 15:34:47 +02:00
Zbigniew Jędrzejewski-Szmek
de8d2894b8 man: reword descriptions of numerical fields
A "string" is a concept in C. In a text-based API, this is implicit, especially
if we say that something was "formatted". So change occurences of "decimal
string" to just "decimal". Similarly, "numerics" is unclear, say "digits".

Also, a "timestamp is in a clock" just sounds wrong. Reword those sentences.
2025-05-28 15:34:47 +02:00
Zbigniew Jędrzejewski-Szmek
948369983c man/systemd-resolved: update description of routing 2025-05-28 15:34:47 +02:00
Zbigniew Jędrzejewski-Szmek
8bfdba3cb1 man/systemd-analyze: rewrite "Exit status" section 2025-05-28 15:34:47 +02:00