Commit Graph

70215 Commits

Author SHA1 Message Date
Luca Boccassi
ffcb8647ca Merge pull request #30904 from YHNdnzj/no-selinux-reload
core/execute: don't reload selinux before spawning executor
2024-01-12 15:51:54 +00:00
Daan De Meyer
52842bb2c5 mkosi: Build a directory image by default
Both building and booting a directory image is much faster than
building or booting a disk image so let's default to a directory
image.

In CI, we stick to a disk image to make sure that keeps working as
well.

The only extra dependency this introduces is virtiofsd which is
packaged in all distributions except Debian stable. For users
hacking on systemd on Debian stable, a disk image can be built by
writing the following to mkosi.local.conf:

```
[Output]
Format=disk
```
2024-01-12 16:19:48 +01:00
Yu Watanabe
be89a76a46 network/ndisc: do not try to set too large value for ICMP ratelimting
Follow-up for 6197db53ba.

When we set too large value, the kernel just refuse it. So, this does
not change the net behavior.

Prompted by https://github.com/systemd/systemd/pull/30490#discussion_r1449477125.
2024-01-12 14:38:30 +00:00
Lennart Poettering
f4220d8c05 json: downgrade extension log message to LOG_DEBUG
This is not supposed to be something we should complain about loudly
after all.

Follow-up for: a617fd9047
2024-01-12 14:37:17 +00:00
Daan De Meyer
50cc0ee647 Add --root= support for list and prepare add-all for --root= support
Let's make sure these follow the rest of kernel-install and always
operate on the given root directory, even if the verb itself can't
support --root= just yet.
2024-01-12 14:37:00 +00:00
Frantisek Sumsal
a0b50e4d25 test: use systemd-id128 from the build dir
As distro sd-id128 might not have all the options we need.

Follow-up for: 378712c
Replaces: #30901
2024-01-12 14:34:04 +00:00
Lennart Poettering
14adc1ab4b man: fix typo AV_VSOCK → AF_VSOCK
A reported by Arian van Putten:

https://github.com/systemd/systemd/pull/30777#pullrequestreview-1816817988
2024-01-12 13:50:32 +00:00
Mike Yuan
73090a38b0 core/execute: don't reload selinux before spawning executor
With the introduction of sd-executor, SELinux needs to be re-initialized
after execve() anyway.
2024-01-12 17:17:37 +08:00
Mike Yuan
a399804225 selinux-util: reorder functions 2024-01-12 17:17:37 +08:00
Lennart Poettering
64b74c86d0 homed: add helpers for checking reference status of homes
Just some refactoring to make things more readable.
2024-01-12 09:25:17 +09:00
Lennart Poettering
776c2b8e72 update TODO 2024-01-11 22:44:13 +01:00
Yu Watanabe
967cd1712c Merge pull request #30867 from dtardon/udev-conf-dropins
Allow dropins for udev.conf
2024-01-12 06:37:23 +09:00
Yu Watanabe
fa552ea1b1 Merge pull request #30893 from yuwata/add-trailing-NUL
json,netlink: add trailing NUL byte when we read binary data
2024-01-12 06:36:46 +09:00
Lennart Poettering
28795e4dca Merge pull request #30777 from poettering/ssh-generator
ssh-generator which makes VMs and containers accessible to ssh via AF_UNIX and AF_VSOCK
2024-01-11 21:31:28 +01:00
Lennart Poettering
25f8d3856a Merge pull request #30884 from poettering/logind-background-light
logind: add "background-light" + "manager" session classes
2024-01-11 21:20:01 +01:00
David Tardon
dddf640cab test: use dropin dir 2024-01-12 05:12:44 +09:00
David Tardon
810a5895e6 man: update udev.conf man page 2024-01-12 05:12:44 +09:00
David Tardon
09dd8e77fc udev: factor out config parser call into function
... which is then called from both places. This makes sure that the
configuration is parsed by udevd and other tools in exactly the same
way.
2024-01-12 05:12:42 +09:00
David Tardon
a1c7dc7d16 udev-util: drop unused function 2024-01-12 05:11:18 +09:00
David Tardon
07f5e35fe7 udev-util: use config. parser to parse udev.conf 2024-01-12 05:11:14 +09:00
David Tardon
343c8514c1 udevd: use config. parser to parse udev.conf
This adds support for the usual config. file hierarchy (including
dropins).

Fixes #30460.
2024-01-12 05:08:18 +09:00
Yu Watanabe
70c24d0d9f sd-netlink: add trailing NUL byte for safety in sd_netlink_message_read_data()
Then, drop sd_netlink_message_read_data_suffix0().
2024-01-12 04:48:26 +09:00
Yu Watanabe
1f179b37f2 json: add trailing NUL byte in json_dispatch_byte_array_iovec()
For safety.

Addresses https://github.com/systemd/systemd/pull/30879#discussion_r1448518226.
2024-01-12 04:44:51 +09:00
Frantisek Sumsal
378712c830 test: use correct type for the root partition 2024-01-12 03:48:22 +09:00
Yu Watanabe
41c5937f02 Merge pull request #30887 from poettering/id128-no-legend
id128: add --no-pager, --no-legend, --json=/-j switches to systemd-id128 tool
2024-01-12 03:46:48 +09:00
Frantisek Sumsal
45a3c02564 shell-completion: add new systemd-id128 options 2024-01-11 18:35:37 +01:00
Lennart Poettering
68fbd9a09c logind: also restrict on which session classes one cange the session type 2024-01-11 18:24:44 +01:00
Lennart Poettering
87dc8bbd86 logind: allow taking control of devices only in some session types
Let's restrict the logic a bit, so that "manage" session types are not
misused.
2024-01-11 18:24:44 +01:00
Lennart Poettering
a50666e376 id128: add --no-pager, --no-legend, --json=/-j switches to systemd-id128 tool 2024-01-11 17:54:19 +01:00
Lennart Poettering
0f6827bdd1 man: document the expanded catalogue of session classes 2024-01-11 17:47:41 +01:00
Lennart Poettering
3b52ef6f00 test: add integration test for new 'background-light' session class 2024-01-11 17:47:41 +01:00
Lennart Poettering
ad23439eae logind: tighten for which classes of sessions we do stop-on-idle
We only want to do this for fully set up, interactive sessions, i.e.
user and user-early, but not for any others, hence restrict the rules a
bit.

Follow-up for: 508b4786e8
2024-01-11 17:23:48 +01:00
Lennart Poettering
d2a4c37972 logind: rework GC logic
In logind we generally want to stop user@.service for a user once they
log out. So the usual rule is that whenever a User object is around that
has no pinning sessions we should close it.

Except that it isn't that easy. We allow that user@.service is also
manually started, in which case the User object is created but not
pinned by any session.

Let's rework how this is handled: we define two different GC modes. In
one GC mode we'll keep the User object around whenever *any* session
exists (thus: including the user@.service session), and one where we
only keep it around whenever a *pinning* session exists (i.e. when a
user actually logs in, but the user@.service session doesn't count like
that).

And the trick is now that we start out in the *any* GC mode, and switch
to the *pinning* GC mode once the first user session logs in.

This should make things more robust as we know exactly in which state we
are and when to GC a user.
2024-01-11 17:23:48 +01:00
Lennart Poettering
b4f01bc1df logind: rework logic to decide whether lock + idle + display applies to a session
Let's streamline the logic that decides whether the screen lock, idle
timeout or display election mechanism applies to a session class. Let's
add explicitly SESSION_CLASS_IS_XYZ() macros for each, and then resue
them at all suitable places, and refuse any attempts to use the
functionality on the wrong clases with a friendly error message.
2024-01-11 17:23:47 +01:00
Lennart Poettering
b5100c736f logind: add "background-light" session class
This is the same as the "background" class, but does *not* pull in a
service manager. It might be useful for things like select cron jobs
that do not intend to call per-user IPC calls.

Replaces: #23569
Fixes: #23978
2024-01-11 17:23:47 +01:00
Lennart Poettering
4cb4e6cf6d pam_systemd: register systemd user service manager as class='manager'
Now that we have thew new class, start making us of it in pam_systemd.so
when running for user@.service.
2024-01-11 17:23:47 +01:00
Lennart Poettering
5099a50d43 logind: track user service managers as 'manager' session class
Previously, all user code was part of a session except for the code run
as part of user@.service, which wasn't. This tries to make this more
uniform: we'll track the user@.service runtime also as a session, but of
the special type "manager".

This means we have a really good overview finally of all user code that
is running and can make decisions on what to start when and how long to
keep it around. The pam_systemd client side will now be reasonably
uniform: it just calls the CreateSession() bus call with the right
class, and we'll return any data it needs. This means the weird
"side-channel" we previously used to initialize XDG_RUNTIME_DIR for the
user@.service goes away (see next commit).

This conditionalizes various behaviours now cleanly depending on the
session class:

1. SESSION_CLASS_WANTS_SCOPE() will be true for all classes except for
   the manager class. It declares whther the client shall be migrated
   into their own scope, which we generally want for sessions but not
   for the manager, since it already has its own service unit.

2. SESSION_CLASS_WANTS_SERVICE_MANAGER() will be true for all classes
   except for the manager class. It declares whether we shall start the
   service manager if a session of this class is around. Of course, this
   is off for the service manager, since this would always pin itself.

3. SESSION_CLASS_PIN_USER() will be true for all classes except for the
   manager class. It declares whether the we shall keep the User
   structure around for a user as long as the session is around.

Now you might wonder why have these as three functions, even though they
mostly give the same answers?

That's because this all is preparation to add further session classes
later that will return different answers for the three calls. (For
example, a later patch adds "background-light" which will return true
for SESSION_CLASS_WANTS_SCOPE() and SESSION_CLASS_PIN_USER(), but false
for SESSION_CLASS_WANTS_SERVICE_MANAGER(). i.e. it will get a scope, and
pin user tracking, but not start a service manager.
2024-01-11 17:23:47 +01:00
Lennart Poettering
9a1dc7549f update TODO 2024-01-11 16:18:26 +01:00
Lennart Poettering
52d863defc test: add testcase for ssh generator 2024-01-11 16:18:26 +01:00
Lennart Poettering
62b3e5fd41 doc: document new /run/host/ inodes in container interface doc 2024-01-11 16:05:20 +01:00
Lennart Poettering
613fb4b601 nspawn: expose a dir in the container where it can bind AF_UNIX sockets that will appear on the host 2024-01-11 16:05:20 +01:00
Lennart Poettering
0abd510f7f ssh-proxy: add ssh ProxyCommand tool that can connect to AF_UNIX + AF_VSOCK sockets
This adds a tiny binary that is hooked into SSH client config via
ProxyCommand and which simply connects to an AF_UNIX or AF_VSOCK socket
of choice.

The syntax is as simple as this:

     ssh unix/some/path     # (this connects to AF_UNIX socket /some/path)

or:

     ssh vsock/4711

I used "/" as separator of the protocol ID and the value since ":" is
already taken by SSH itself when doing sftp. And "@" is already taken
for separating the user name.
2024-01-11 16:05:20 +01:00
Lennart Poettering
0e3220684c ssh-generator: add simple new generator 2024-01-11 16:05:20 +01:00
Lennart Poettering
045f7b8fe4 iovec-util: add helper for a single NUL byte iovec 2024-01-11 16:05:20 +01:00
Lennart Poettering
e09c255d2e install: optionally return discovered unit file path in unit_file_exists() 2024-01-11 16:05:20 +01:00
Lennart Poettering
3392079e4b generator: teach generator_add_symlink_full() to optionally make alias symlinks rather than just .wants/ style symlinks 2024-01-11 16:05:20 +01:00
Lennart Poettering
7ceb76b63c generator: optionally return resulting unit file path in generator_open_unit_file_full()
This is useful if we want to make symlinks to it later.
2024-01-11 16:05:20 +01:00
Lennart Poettering
78cdb9b50a mkosi: also add ssh client, to make it easier to test ssh logins via AF_UNIX/AF_VSOCK 2024-01-11 16:05:20 +01:00
Yu Watanabe
bc02f03561 network: fix Name= -> OriginalName= in the default .link files
Follow-up for 658169e6d3.
2024-01-11 12:20:10 +00:00
Lennart Poettering
658dc909dc man: fix references to systemd.exec(5)
For some reason the section for the systemd.exec man page was added
incorrectly and then copypasted everywhere else incorrectly too. Let's
fix that.
2024-01-11 12:19:44 +00:00