Commit graph

8728 commits

Author SHA1 Message Date
Дамјан Георгиевски d357f129b2 vsock-mux ssh proxy
allow the ssh-proxy to connect to cloud-hypervisor/Firecracker guests,
via their unix-domain socket to AF_VSOCK multiplexer:

https://github.com/cloud-hypervisor/cloud-hypervisor/blob/main/docs/vsock.md
https://github.com/firecracker-microvm/firecracker/blob/main/docs/vsock.md
2024-06-12 18:36:21 +09:00
Yu Watanabe f7da67db58
Merge pull request #32720 from poettering/hostnamed-no-varlink-exit-on-idle
hostnamed: exit-on-idle tweaks
2024-06-12 18:25:24 +09:00
Matthieu Baerts (NGI0) 3f69070598 core/socket: allow MPTCP protocol
Multipath TCP (MPTCP), standardized in RFC8684 [1], is a TCP extension
that enables a TCP connection to use different paths. It allows a device
to make use of multiple interfaces at once to send and receive TCP
packets over a single MPTCP connection. MPTCP can aggregate the
bandwidth of multiple interfaces or prefer the one with the lowest
latency, it also allows a fail-over if one path is down, and the traffic
is seamlessly re-injected on other paths.

To benefit from MPTCP, both the client and the server have to support
it. Multipath TCP is a backward-compatible TCP extension that is enabled
by default on recent Linux distributions (Debian, Ubuntu, Redhat, ...).
Multipath TCP is included in the Linux kernel since version 5.6 [2]. To
use it on Linux, an application must explicitly enable it when creating
the socket:

  int sd = socket(AF_INET(6), SOCK_STREAM, IPPROTO_MPTCP);

No need to change anything else in the application.

This patch allows MPTCP protocol in the Socket unit configuration. So
now, a <unit>.socket can contain this to use MPTCP instead of TCP:

  [Socket]
  SocketProtocol=mptcp

MPTCP support has been allowed similarly to what has been already done
to allow SCTP: just one line in core/socket.c, a very simple addition
thanks to the flexible architecture already in place.

On top of that, IPPROTO_MPTCP has also been added in the list of allowed
protocols in two other places, and in the doc. It has also been added to
the missing_network.h file, for systems with an old libc -- note that it
was also required to include <netinet/in.h> in this file to avoid
redefinition errors.

Link: https://www.rfc-editor.org/rfc/rfc8684.html [1]
Link: https://www.mptcp.dev [2]
2024-06-12 00:14:08 +01:00
Kamil Szczęk 608bfe76c1 core: populate $REMOTE_ADDR for AF_UNIX sockets
Set the $REMOTE_ADDR environment variable for AF_UNIX socket connections
when using per-connection socket activation (Accept=yes). $REMOTE_ADDR
will now contain the remote socket's file system path (starting with a
slash "/") or its address in the abstract namespace (starting with an
at symbol "@").

This information is essential for identifying the remote peer in AF_UNIX
socket connections, but it's not easy to obtain in a shell script for
example without pulling in a ton of additional tools. By setting
$REMOTE_ADDR, we make this information readily available to the
activated service.
2024-06-12 00:11:10 +01:00
Lennart Poettering 48ce0824dc sd-bus: add new sd_bus_pending_method_calls() call 2024-06-11 23:17:38 +01:00
Zbigniew Jędrzejewski-Szmek 7b529bfc47 man: document that separate /usr/local/ must not be used for config
Since we document /usr/local/lib/systemd/ and other paths for various things,
add notes that this is not supported if /usr/local is a separate partition. In
systemd.unit, I tried to add the footnote in the table where
/usr/local/lib/systemd/ is listed, but that get's rendered as '[sup]a[/sup]'
with a mangled footnote at the bottom of the table :( .

Also, split paragraphs in one place where the subject changes without any
transition.

Follow-up for 02f35b1c90.
Replaces https://github.com/systemd/systemd/pull/33231.
2024-06-11 18:02:31 +01:00
Zbigniew Jędrzejewski-Szmek 6eddfeebdb man/systemd-soft-reboot.service: upgrade drop-in to unit file for slice
Follow-up for d91c7c91bf.
Closes https://github.com/systemd/systemd/issues/33260.
2024-06-11 10:36:50 +01:00
Luca Boccassi d91c7c91bf man: note that templated surviving units need a drop-in for their slice
As reported on the mailing list, this is non-obvious, so document it.

https://lists.freedesktop.org/archives/systemd-devel/2024-June/050351.html
2024-06-07 12:33:18 +01:00
Jörg Behrmann 02f35b1c90 man: document /usr/local/lib in search paths 2024-06-06 12:07:08 +02:00
hanjinpeng 9246d16d3d man: mention that ExecCondition= in COMMAND LINES section for systemd.service 2024-06-02 09:23:12 +09:00
Yu Watanabe 4ccaf512d7 man: fix typo
Follow-up for d24ceef937.
2024-06-01 14:42:19 +09:00
Yu Watanabe d24ceef937 man: mention that IPMasquerade= and IPv6SendRA= implies IPv4Forwarding=/IPv6Forwarding=
It has been mentioned in IPv4Forwarding= and IPv6Forwarding=,
but let's also explain in the settings who imply these settings.

Follow-up for 3976c43092 and
485f5148b3.
2024-05-30 10:20:33 +02:00
Zbigniew Jędrzejewski-Szmek b95914f4b0 man: capsule support was added in v256
The version info added directly to --capsule. If we add the
same switch in other places in the future, we will have to move
this.

Closes https://github.com/systemd/systemd/issues/33048.
2024-05-28 16:30:54 +02:00
Zbigniew Jędrzejewski-Szmek 75ced6d5ee various: update links to usr-merge 2024-05-28 14:48:56 +02:00
Zbigniew Jędrzejewski-Szmek a37454bd90 man: update links to "API File Systems" 2024-05-28 14:48:56 +02:00
Zbigniew Jędrzejewski-Szmek d5c17aceb3 various: update links to more wiki pages 2024-05-28 14:48:53 +02:00
Zbigniew Jędrzejewski-Szmek 5507480cf4 man: update links to "Inhibitor Locks" 2024-05-28 14:48:53 +02:00
Zbigniew Jędrzejewski-Szmek b346d72c79 man: update links to "Compatibility with SysV" 2024-05-28 14:46:44 +02:00
Zbigniew Jędrzejewski-Szmek f81af0b082 man: update links to "New Control Group Interfaces" 2024-05-28 14:46:44 +02:00
Zbigniew Jędrzejewski-Szmek 03d35b5d18 man: update links to catalog docs 2024-05-28 14:46:44 +02:00
Mike Yuan 8d4fa6531b man/run0: remove @ syntax for --machine=
For run0 (as opposed to systemd-run in general), connecting to
the system bus (of localhost or container) as a different user
than root and then trying to elevate privilege from that
makes little sense:
https://github.com/systemd/systemd/issues/32997#issuecomment-2127992973

The @ syntax is mostly useful when connecting to the user bus,
which is not a use case for run0. Hence, let's remove the example.
The syntax will be properly refused in #32999.
2024-05-27 09:40:47 +09:00
Mike Yuan 006c02b371 man/run0: remove -M alias for --machine=
run0 doesn't know about the former.
2024-05-27 09:40:47 +09:00
Yu Watanabe 4c42df8166 man: update machine-id-setup(1)
- mention that /run/machine-id is used if exist.
- mention system.machine_id credential,
- credential, VM uuid, and container uuid are not read when --root=
  is specified or running in a chroot environment.
2024-05-25 02:13:00 +09:00
Luca Boccassi 5f5ee2eb07 man: mention that NFTSet is only available for system services 2024-05-24 11:21:04 +02:00
Yu Watanabe a328b24edd man: swap the order of soft-reboot.service and .target
Follow-up for the previous revert commit.
2024-05-23 00:08:14 +09:00
Mike Yuan d73a47d259
man/systemd-run: beef up info regarding interaction between --pty, --pipe, and --wait 2024-05-21 21:40:01 +08:00
Zbigniew Jędrzejewski-Szmek fc0bb7ccc7 logind: make ReleaseSession "unprivileged" and allow closing of own session
Fixes https://github.com/systemd/systemd/issues/28514.

Quoting https://github.com/systemd/systemd/issues/28514#issuecomment-1831781486:
> Whenever PAM is enabled for a service, we set up the PAM session and then
> fork off a process whose only job is to eventually close the PAM session when
> the service dies. That services we run with service privileges, both to
> minimize attack surface and because we want to use PR_SET_DEATHSIG to be get
> a notification via signal whenever the main process dies. But that only works
> if we have the same credentials as that main process.
>
> Now, if pam_systemd runs inside the PAM stack (which it normally does) it's
> session close hook will ask logind to synchronously end the session via a bus
> call. Currently that call is not accessible to unprivileged clients. And
> that's the part we need to relax: allow users to end their own sessions.

The check is implemented in a way that allows the kill if the sender is in
the target session.

I found 'sudo systemctl --user -M "zbyszek@" is-system-running' to
be a convenient reproducer.

Before:
May 16 16:25:26 x1c systemd[1]: run-u24754.service: Deactivated successfully.
May 16 16:25:26 x1c dbus-broker[1489]: A security policy denied :1.24757 to send method call /org/freedesktop/login1:org.freedesktop.login1.Manager.ReleaseSession to org.freedesktop.login1.
May 16 16:25:26 x1c (sd-pam)[3036470]: pam_systemd(login:session): Failed to release session: Access denied
May 16 16:25:26 x1c systemd[1]: Stopping session-114.scope...
May 16 16:25:26 x1c systemd[1]: session-114.scope: Deactivated successfully.
May 16 16:25:26 x1c systemd[1]: Stopped session-114.scope.
May 16 16:25:26 x1c systemd[1]: session-c151.scope: Deactivated successfully.
May 16 16:25:26 x1c systemd-logind[1513]: Session c151 logged out. Waiting for processes to exit.
May 16 16:25:26 x1c systemd-logind[1513]: Removed session c151.
After:
May 16 17:02:15 x1c systemd[1]: run-u24770.service: Deactivated successfully.
May 16 17:02:15 x1c systemd[1]: Stopping session-115.scope...
May 16 17:02:15 x1c systemd[1]: session-c153.scope: Deactivated successfully.
May 16 17:02:15 x1c systemd[1]: session-115.scope: Deactivated successfully.
May 16 17:02:15 x1c systemd[1]: Stopped session-115.scope.
May 16 17:02:15 x1c systemd-logind[1513]: Session c153 logged out. Waiting for processes to exit.
May 16 17:02:15 x1c systemd-logind[1513]: Removed session c153.

Edit: this seems to also fix https://github.com/systemd/systemd/issues/8598.
It seems that with the call to ReleaseSession, we wait for the pam session
close hooks to finish. I inserted a 'sleep(10)' after the call to ReleaseSession
in pam_systemd, and things block on that, nothing is killed prematurely.
2024-05-20 20:59:15 +02:00
drewbug 2fa7626e18
man: fix grammar for Name= option in systemd.link 2024-05-20 11:11:22 +01:00
Yu Watanabe 6da7485176 man: refer FailureAction= and SuccessAction= for explaining allowed values in JobTimeoutAction=
The allowed values are explained in FailureAction= and SuccessAction=,
rather than StartLimitAction=.
2024-05-18 02:51:34 +09:00
Yu Watanabe 2a2d9539f0 core: refuse invalid emergency actions for SuccessAction= and friends in user service manager
Especially, soft-reboot is not supported by user service manager.

Fixes a bug in 13ffc60749 and
3cf848f6cd.
2024-05-18 02:51:34 +09:00
Yu Watanabe 067857196c man: mention soft-reboot in bootup(7) 2024-05-18 02:51:24 +09:00
Mike Yuan 3acc318591 man/soft-reboot: order surviving services before shutdown.target
Prompted by #32895

Rather than ordering with each power operation targets,
ordering against shutdown.target which is a valid
synchronization point. This has no effect if soft-reboot
is being performed.
2024-05-17 16:49:58 +02:00
Zbigniew Jędrzejewski-Szmek 759e8fe7f6 man: add note about selinux to rc-local
This feature is deprecated, but if users use it, they are likely to be
tripped up by the wrong selinux context, so add a note.

https://discussion.fedoraproject.org/t/systemd-rc-local-service-doesnt-work-on-fedora-40-until-selinux-contexts-are-set-on-rc-local-script
2024-05-17 15:16:07 +02:00
Luca Boccassi ad450ebab7 man: fix typo 'ot' -> 'or' 2024-05-15 14:19:01 +02:00
Luca Boccassi 93df5217b9 tree-wide: 'allows to' -> 'allows one to'
As flagged by Lintian
2024-05-14 18:33:27 +02:00
Yu Watanabe 6fe998037a man: fix typo
Follow-up for 7df0297ac5.
2024-05-14 18:12:30 +09:00
Yu Watanabe 13c8a3d926 man: add v257 tag
Even though v256-final is not released yet, let's v257 tag now to make
not PRs for v257 conflict with each other.
2024-05-13 19:53:51 +09:00
Daan De Meyer 82c2214539 debug-generator: Allow specifying name of unit-dropin credential
A fixed name is too rigid, let's give users the ability to define
custom drop-in names which at the same time also allows defining
multiple dropins per unit.

We use ~ as the separator because:
- ':' is not allowed in credential names
- '=' is used to separate credential from value in mkosi's --credential
  argument.
- '-' is commonly used in filenames
- '@' already has meaning as the unit template specifier which might be
  confusing when adding dropins for template units
2024-05-11 19:46:15 +02:00
Yu Watanabe d0936a7266 journalctl: make --list-boots support -n/--lines= option
Also mention that -r/--reverse is supported by the command.
2024-05-10 11:43:57 +09:00
Luca Boccassi 7e10dfae96
Merge pull request #32689 from YHNdnzj/cred-missing
core/exec-credential: complain louder if inherited credential is missing
2024-05-09 13:21:44 +02:00
Colin Watson 566491c971 docs,man: Avoid some ambiguous uses of "may not"
Like much English text, the systemd documentation uses "may not" in the
sense of both "will possibly not" and "is forbidden to".  In many cases
this is OK because the context makes it clear, but in others I felt it
was possible to read the "is forbidden to" sense by mistake: in
particular, I tripped over "the target file may not exist" in
systemd.unit(5) before realizing the correct interpretation.

Use "might not" or "may choose not to" in these cases to make it clear
which sense we mean.
2024-05-08 17:14:32 +02:00
Luca Boccassi 867e2987a2
Merge pull request #32709 from bluca/machined_ssh
machined: add GetMachineSSHInfo method and varlink interface to register machines
2024-05-08 14:37:55 +02:00
Luca Boccassi 667fe27e5d
Merge pull request #32705 from YHNdnzj/hibernate-error
hibernate-util: differentiate some errors from the generic ENOSPC; systemctl: adjust the fallback behavior for sleep operations
2024-05-08 14:19:07 +02:00
MaxHearnden bd96d63787 Use the correct name of CEL
It's Canonical Event Format, not Common
2024-05-08 13:34:07 +02:00
Sam Leonard 5b44c81ff8 machined: add varlink interface for registering machines
This commit adds the new varlink interface io.systemd.Machine at
/run/systemd/machine/io.systemd.Machine with a single method Register

It supports all combinations of RegisterMachine[WithSSH,WithNetwork] all
under the same method.
2024-05-08 11:54:31 +01:00
Sam Leonard 1f815bf164 machined: add GetMachineSSHInfo method
Also adds three properties:
- VsockCid: the VSOCK CID of the VM
- SshAddress: the address of the VM in a format SSH can connect to
- SshPrivateKeyPath: the path to the SSH private key to use to connect
  to the VM.

GetMachineSSHInfo is essentially a convenience method to query both the
SshAddress and SshPrivateKeyPath properties at once.
2024-05-08 09:56:42 +01:00
Mike Yuan 18303adcd3 man/run0: remove the --user example for --machine=
run0's --user= option is different from other tools,
and the whole point of run0 is to connect to the system
manager. So the example is spurious.
2024-05-08 10:08:53 +02:00
Mike Yuan 4f344de792
systemctl: do not fall back to StartUnit automatically for sleep operations
In the majority of cases, this is caused by
sleep_supported() returning error. Hence it's
very likely that it would fail again, so
the fallback is not really useful. Instead,
honor the --force option for these verbs.
2024-05-08 13:45:49 +08:00
Mike Yuan 6b34871f5d
core/exec-credential: complain louder if inherited credential is missing
Also document that a missing inherited credential
is not considered fatal.

Closes #32667
2024-05-07 22:02:42 +08:00
Zbigniew Jędrzejewski-Szmek b36a3f0aea man: reword text and fix tense in description of sd_event_source_set_io_fd
Follow-up for 2fa480592d.
2024-05-07 08:53:58 +02:00