Commit Graph
70229 Commits
Author SHA1 Message Date
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
Antonio Alvarez Feijoo 5e16328506 analyze: clarify that security --offline=true requires an argument
Without `--root` or `--image`, the `security` command inspects all currently
loaded service units if no unit name is specified. But with `--root` or
`--image` with `--offline=true`, the `security` command exits silently if no
unit name is specified.

Also, fixed description of `--root` and `--image` in the man page, and added
missing `--unit` option to help text.
2024-01-11 12:19:20 +00:00
Frantisek Sumsal ec6c7bac5c test: fix dbus installation on Arch
Arch finally made dbus-broker the default dbus daemon [0], but unlike
Fedora they don't use Alias=dbus.service to make the dbus.symlink under
/etc, instead they create the symlink manually under /usr/lib, so let's
account for that.

[0] https://gitlab.archlinux.org/archlinux/packaging/packages/dbus-broker/-/commit/b24d15795addeb15f9532f28deae9475fad8b9fa
2024-01-11 12:01:42 +00:00
Antonio Alvarez Feijoo 1c585a4ccd Revert "initrd-parse-etc: override argv[0] to avoid dracut issue"
This reverts commit db5276215a.

dracut is patched since https://github.com/dracutdevs/dracut/commit/23684e4a,
and this commit is included in the latest dracut-059 release.
2024-01-11 10:41:30 +00:00
Lennart Poettering e992753e58 Merge pull request #30879 from yuwata/dhcp-client-id-json
dhcp: introduce json_dispatch_client_id() and friends
2024-01-11 10:22:31 +01:00
Yu Watanabe 0705e05c3d sd-dhcp-client-id: introduce json_dispatch_client_id() 2024-01-11 17:03:25 +09:00
Yu Watanabe 72278e62d9 json: introduce json_dispatch_byte_array_iovec() and json_dispatch_in_addr() 2024-01-11 17:03:25 +09:00
Yu Watanabe cf9b425749 sd-dhcp-client-id/duid: do not trigger assertion when invalid size is passed
The data may be from user input or file. We usually use assertion for
programming error. Hence, using assert is not a good choise there.

Preparation for later commits.
2024-01-11 17:03:25 +09:00
Diego Viola 25cbc42d93 test-systemctl-enable: make titles more consistent 2024-01-11 14:13:40 +09:00
Rose ed0cf4171f boot/efi: use Header field of hd directly instead of casting to EFI_DEVICE_PATH
The header of EFI_DEVICE_PATH is the first member of hd, which means that we can use that directly instead of casting one struct to another.
2024-01-11 14:03:13 +09:00
Rose aa9ff6c28d tree-wide: replace string functions with fundamental functions 2024-01-11 13:36:25 +09:00
David Tardon 5656cdfeea conf-parser: generalize config_parse_config_file() 2024-01-11 13:24:32 +09:00
Lennart Poettering 658169e6d3 network: take explicit ownership of our own interfaces
This is a follow-up for #30786 and uses it to assign
ID_NET_MANAGED_BY=io.systemd.Network to all all network interfaces that
we consider ours to manage. This should hopefully have the effect that
other well-behaving managers won't fight for these devices.

This doesn't bother with network interfaces we match inside containers,
since udev is not available there anyway.
2024-01-10 19:56:43 +00:00
Luca Boccassi d6b39152a9 Merge pull request #30717 from yuwata/network-ref-unref
network: introduce address_ref() and friends
2024-01-10 19:34:48 +00:00
Luca Boccassi 3df2b718b2 Merge pull request #30716 from yuwata/network-cancel-request
network: also remove configuration on cancelling request
2024-01-10 19:33:16 +00:00
Carlos Garnacho 501d8b8bc6 logind: Mark LidClosed property as "emits change"
It may be useful for DEs to follow changes on this property, esp. now that
recent UPower has removed its own lid handling code.

Related: https://gitlab.freedesktop.org/upower/upower/-/commit/07565ef6a1aa4a115f8ce51e259e408edbaed4cc
2024-01-10 19:31:06 +00:00
Luca Boccassi 09263532b6 Merge pull request #30720 from yuwata/dhcp-server-address-verification
dhcp-server: several fixlets for address verification
2024-01-10 19:29:25 +00:00
Luca Boccassi 311f80cee2 Merge pull request #30764 from yuwata/network-queue-fix-assertion
network/queue: exit from loop of processing request when a new request is queued
2024-01-10 19:27:57 +00:00
Luca Boccassi 31056154dd Merge pull request #30811 from yuwata/network-route-metric
network/route-metric: introduce RouteMetric to unify route metric handling
2024-01-10 19:25:52 +00:00
Luca Boccassi dadd7d46d9 Merge pull request #30809 from yuwata/resolve-fix-EDE-handling
resolve: fix EDE handling
2024-01-10 19:21:55 +00:00
Holger Assmann f681046ede watchdog: ensure configured timeout is used instead of USEC_INFINITY
In some rare cases, a watchdog driver might neither be able to change
the watchdog timeout value, nor read it from the hardware at runtime.

With an otherwise functional watchdog setup, this constellation worked
until systemd v249. Since then, systemd ends up ignoring the timeout
defined by the system.conf and rather uses USEC_INFINITY. Consequently,
the watchdog is not pinged anymore and eventually resets the system.

We therefore want to ensure that the system keeps running with the
originally configured timeout.
2024-01-10 19:14:38 +00:00
Antonio Alvarez Feijoo ecb4c5a63e repart: fix memory leak
With the `--image` option, if `arg_node` is NULL, it's being assigned via
`strdup`.
2024-01-10 19:07:21 +00:00
Lennart Poettering 52e5b950dc pam-util: implement our own pam_prompt() replacement, that doesn't log loudly
pam_prompt() will log very noisely at high error levels if it is called
without a conversation function that works. This is however a frequent
case, given that ssh doesn't provide one. To tone down the misleading
logging a bit, implement our own pam_prompt_graceful() that is just like
pam_prompt(), but reports errors back the caller who then logs (which we
generally do anyway).
2024-01-10 19:06:40 +00:00
Mike Yuan 54cc0367cb logind-action: query HandleActionData.sleep_operation where appropriate 2024-01-10 19:04:38 +00:00
Luca Boccassi d5f270fdbb Merge pull request #30870 from aafeijoo-suse/firstboot-help-fix
firstboot: minor fixes
2024-01-10 19:04:18 +00:00
Yu Watanabe 28815fdac4 test-resolved-dummy-server: several modernization
- use sd-event,
- use DEFINE_MAIN_FUNCTION(),
- use log_setup().
2024-01-11 02:13:32 +09:00
Frantisek Sumsal f1caa5d6e7 test: introduce a dummy DNS test server
Introduce a _very_ simple DNS server using our internal DNS-related
code, that responds to queries with specifically crafted packets, to
cover scenarios that are difficult to reproduce with well-behaving DNS
servers.

Also, hide the test DNS server behind Knot using the dnsproxy module, so
we don't have to switch DNS servers during tests.
2024-01-11 02:13:29 +09:00
Frantisek Sumsal ed6c51781f resolve: export sendmsg_loop()
So we can use it in tests.
2024-01-11 02:10:32 +09:00
Yu Watanabe a068e06da6 resolve: notify DNSSEC failure, EDE code, and EDE message 2024-01-11 02:10:32 +09:00
Yu Watanabe d9f9b8ce8a resolve: make manager_monitor_send() take DnsQuery* 2024-01-11 02:10:32 +09:00
Yu Watanabe 37baa00fe0 resolve: also read EDE code and message from cached packet 2024-01-11 02:10:32 +09:00
Yu Watanabe a72cf22d06 resolve: introduce DNSSEC_UPSTREAM_FAILURE
and include EDE code and message in the error messages.

This replaces 9ca133e97a, and implements
originally suggested at
https://github.com/systemd/systemd/pull/30513#discussion_r1433823737
2024-01-11 02:10:32 +09:00
Yu Watanabe 0c61995d80 resolvectl: use JSON_ALLOW_EXTENSIONS
Follow-up for f0e4244b2f.
2024-01-11 02:10:32 +09:00
Yu Watanabe 41398e8793 resolve: several follow-ups for 9ca133e97a.
- add missing initialization for DnsQuery.answer_ede_rcode,

- clear EDE code and message in dns_transaction_reset_answer(),
  otherwise the previous EDE code or message may be mistakenly reused
  on restart. This fixes memory leak of DnsTransaction.answer_ede_msg.

- also clear EDE code and message in dns_query_reset_answer(),
  otherwise ede message is leaked if dns_query_accept() is called
  multiple times for the same DnsQuery.

Follow-up for 9ca133e97a.

Fixes #30752.
2024-01-11 02:10:11 +09:00
Lennart Poettering 563c5511ad pam_systemd_home: move two bool flags into a proper flags parameter
We are going to add more shortly, but this makes sense on its own.

No changes in behaviour.
2024-01-10 17:53:57 +01:00
Antonio Alvarez Feijoo 4f464e7419 firstboot: fix memory leak 2024-01-10 17:31:49 +01:00
Antonio Alvarez Feijoo 981644edc9 firstboot: fix typo and add missing option to help text 2024-01-10 17:29:56 +01:00