1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-26 17:27:41 +03:00
Commit Graph

57 Commits

Author SHA1 Message Date
Yu Watanabe
e7c567cc78 man: insert a comma before 'and'
Follow-up for bd91f23acf.
2024-10-24 16:42:59 +09:00
Lennart Poettering
bd91f23acf logind: add CanIdle + CanLock dbus properties to session object
Clients should be able to know if the idle logic is available on a
session without secondary knowledge about the session class. Let's hence
expose a property for that.

Similar for the screen lock concept.

Fixes: #34844
2024-10-22 18:44:05 +02:00
Allison Karlitskaya
2bdf027de1 man: document "web" session type
This has been supported since e9e74f28d7 but never got documented.
Add it to the man pages (plus one comment in a header).

Closes #34127.
2024-08-26 16:54:59 +01:00
Mike Yuan
1aeea8a60a
logind: DesignatedMaintenanceTime is added in v257 and constant
Follow-up for 0e10c3d872

Addresses https://github.com/systemd/systemd/pull/25049#discussion_r1647513862
2024-08-22 20:06:31 +02:00
Luca Boccassi
1e0ef01439 logind: add PreparingForShutdownWithMetadata property
The PrepareForShutdownWithMetadata signal was added via
e4aab5cf1a but a corresponding property
was not. A property has to be a single type, so the bool needs to be
one of the key/value pairs as 'ba{sv}' is not a valid property.
2024-08-05 19:30:15 +02:00
Luca Boccassi
804874d26a logind: always check for inhibitor locks
Currently inhibitors are bypassed unless an explicit request is made to
check for them, or even in that case when the requestor is root or the
same uid as the holder of the lock.

But in many cases this makes it impractical to rely on inhibitor locks.
For example, in Debian there are several convoluted and archaic
workarounds that divert systemctl/reboot to some hacky custom scripts
to try and enforce blocking accidental reboots, when it's not expected
that the requestor will remember to specify the command line option
to enable checking for active inhibitor locks.

Also in many cases one wants to ensure that locks taken by a user are
respected by actions initiated by that same user.

Change logind so that inhibitors checks are not skipped in these
cases, and systemctl so that locks are checked in order to show a
friendly error message rather than "permission denied".

Add new block-weak and delay-weak modes that keep the previous
behaviour unchanged.
2024-07-25 12:22:36 +01:00
nerdopolis
952b26c75d login: Add a new SecureAttentionKey dbus signal when Ctrl+Alt+Shift+Esc is pressed 2024-06-24 22:29:38 +02:00
Ludwig Nussel
0e10c3d872 logind: implement maintenance time
Update frameworks that work automatically in the background
occasionally need to schedule reboots. Systemd-logind already
provides a nice mechanism to schedule shutdowns, send notfications
and block logins short before the time. Systemd has a framework for
calendar events, so we may conveniently use logind to define a
maintenance time for reboots.

The existing ScheduleShutdown DBus method in logind expects a usec_t
with an absolute time. Passing USEC_INFINITY as magic value now tells
logind to take the time from the configured maintenance time if set.

"shutdown -r" leverages that and uses the maintenance time
automatically if configured. The one minute default is still used if
nothing was specified.

Similarly the new 'auto' setting for the --when parameter of systemctl
uses the maintenance time if configured or a one minute timer like the
shutdown command.
2024-06-20 14:37:42 +02:00
Zbigniew Jędrzejewski-Szmek
cd2fb04960 Fix confusion between killer and prey
"who" is the entity doing the killing, "whom" is the target.
Follow-up for 4ccde410a3.
2024-06-19 16:22:23 +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
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
Lennart Poettering
955502121d man: update D-Bus docs with new calls 2024-02-14 15:08:03 +01:00
Lennart Poettering
6e9bf0ad29 logind: add ability to upgrade session class from 'user-incomplete' to 'user' 2024-02-14 15:00:46 +01:00
Frantisek Sumsal
43b238f1c1 man: suffix signals with ()
Since signals can take arguments, let's suffix them with () as we
already do with functions. To make sure we remain consistent, make the
`update-dbus-docs.py` script check & fix any occurrences where this is
not the case.

Resolves: #31002
2024-01-23 16:27:50 +01:00
Mike Yuan
b3cb952c03
logind-dbus: introduce ListSessionsEx() call
As per https://github.com/systemd/systemd/pull/30884#discussion_r1448938737
2024-01-17 11:25:48 +08: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: 07565ef6a1
2024-01-10 19:31:06 +00:00
David Tardon
eea10b26f7 man: use same version in public and system ident. 2023-12-25 15:51:47 +01:00
Mike Yuan
cd4dd90b99
logind: introduce Sleep() call and action that automatically choose a sleep operation 2023-12-05 22:18:32 +08:00
Frantisek Sumsal
f1e02423a9 login: mark the TTY property as "emits change"
Triggered by the SetTTY() method.

Follow-up to 092e6cd19a.
Addresses: https://github.com/systemd/systemd/pull/30043#pullrequestreview-1733628935
2023-11-16 11:26:26 +00:00
Frantisek Sumsal
236cb01622 login: mark the Display property as "emits change"
With the introduction of SetDisplay() method in 4885d7490b the Display
property emits a "properties changed" message every time the display is
changed using this method, so mark it appropriately.

Caught by systemd/systemd#30029:

systemd-logind[1366]: Got message type=method_call sender=:1.165 destination=org.freedesktop.login1 path=/org/freedesktop/login1/session/_310 interface=org.freedesktop.login1.Session member=SetDisplay  cookie=8 reply_cookie=0 signature=s error-name=n/a error-message=n/a
systemd-logind[1366]: Assertion 'v->vtable->flags & SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE || v->vtable->flags & SD_BUS_VTABLE_PROPERTY_EMITS_INVALIDATION' failed at src/libsystemd/sd-bus/bus-objects.c:2141, function emit_properties_changed_on_interface(). Ignoring.

Follow-up to 4885d7490b.
2023-11-15 22:41:24 +01:00
Michal Sekletar
76f2191d8e logind: introduce CreateSessionWithPIDFD()
This new D-Bus API uses pidfd to refer to the session leader. Also,
pam_systemd will try to make use of it when pidfd support is available.
2023-10-26 14:28:48 +01:00
Luca Boccassi
665a3d6d15 systemctl: automatically softreboot/kexec if set up on reboot
Automatically softreboot if the nextroot has been set up with an OS
tree, or automatically kexec if a kernel has been loaded with kexec
--load.

Add SYSTEMCTL_SKIP_AUTO_KEXEC and SYSTEMCTL_SKIP_AUTO_SOFT_REBOOT to
skip the automated switchover.
2023-10-20 11:45:37 +01:00
Abderrahim Kitouni
d9d2d16aea man: add version information for dbus interfaces
These only go back to version 250 which is the first version to provide the
export-dbus-interfaces build target.
2023-09-19 14:33:34 +01:00
Luca Boccassi
e4aab5cf1a logind: add PrepareForShutdownWithMetadata signal
The existing signal doesn't say which type of shutdown is going to happen.
With the introduction of soft-reboot, it is useful to have this information
broadcasted, so that clients can choose to do different things based on the
reboot type.
Add a{sv} as the payload so that more metadata can be added later if
needed, without needing to add yet another signal.
Send both old and new signal for backward compatibility, and send the new
one first so that clients can just wait for the first one on both old and
new systems.
2023-09-11 12:56:00 +01:00
Lennart Poettering
4de665812a man: document the soft reboot operation 2023-06-02 18:43:10 +02:00
Thorsten Kukuk
092e6cd19a sd-login: add SetTTY session object #26611 2023-04-25 14:33:09 +02:00
Lennart Poettering
5b9ae04c65
Merge pull request #24242 from msekletar/terminate-idle-sessions
Add option to stop idle sessions after specified timeout
2022-08-25 11:39:42 +02:00
Michal Sekletar
82325af3ae logind: add option to stop idle sessions after specified timeout
Thanks to Jan Pazdziora <jpazdziora@redhat.com> for providing a patch
which implemeted a PoC of this feature.
2022-08-24 14:50:48 +02:00
Zbigniew Jędrzejewski-Szmek
15102ced42 man: similar → similarly
Something *is* similar
Something *works* similarly
Something does something, similarly to how something else does something

See https://sites.ulethbridge.ca/roussel/2017/11/29/similar-and-similarly-are-they-similar/
for a clear explanation.
2022-08-23 12:14:58 +02:00
David Tardon
4885d7490b logind-session-dbus: allow to set display name via dbus
Currently, the only way to set display name of a graphical session is to
pass it to CreateSession(). But modern display managers like gdm start
the display server as part of the user session, which means that the
display name isn't known yet when the session is being created. Hence,
let's make it possible to set it later.
2022-06-22 22:34:29 +02:00
Yu Watanabe
3c60643848 man: fix typo 2022-05-07 15:17:56 +09:00
Zbigniew Jędrzejewski-Szmek
e4239a34d7 man: deduplicate dbus versioning ref 2022-05-05 11:48:22 +02:00
Zbigniew Jędrzejewski-Szmek
01942823ae man: beef up o.fd.login1 page a bit and recommend busctl too
gdbus is an external program, so it makes sense to recommend busctl.
2022-05-05 11:48:22 +02:00
Lennart Poettering
c4db78fce6 logind: expose long press actions on D-Bus
The settings and internal varables were added, but this was never
exposed on the bus. Add that.

Follow-up-for: a520bb6654
Follow-up-for: #19917
2022-04-05 16:09:52 +02:00
Zbigniew Jędrzejewski-Szmek
931bc1957b docs: use https:// for fd.o links 2022-01-12 16:05:59 +01:00
Yu Watanabe
34b5684846 man: also add anotations for methods
Fixes #21882.
2021-12-24 10:18:11 +00:00
Deepak Rawat
0d96caa5c0 logind: Add new flag for kexec reboot
Add new flag to allow kexec reboot if kernel is already loaded.
2021-03-31 10:48:48 +02:00
Deepak Rawat
8885fed4e3 logind: Introduce RebootWithFlags and others
Add new systemd-logind WithFlags version for Reboot and others. These
methods add a unit64 parameter, with which can send additional control flags.
2021-02-02 11:55:16 +00:00
Yu Watanabe
db9ecf0501 license: LGPL-2.1+ -> LGPL-2.1-or-later 2020-11-09 13:23:58 +09:00
Zbigniew Jędrzejewski-Szmek
515736d0f3 tree-wide: update web link to logind description
https://www.freedesktop.org/wiki/Software/systemd/multiseat/ says that it
is obsoleted by sd-login(3), so it doesn't make much sense to link to the former.
2020-10-19 15:23:37 +02:00
Zbigniew Jędrzejewski-Szmek
3b1211574b man: use trailing slash on directories in more places 2020-10-05 18:44:05 +02:00
Zbigniew Jędrzejewski-Szmek
d3fcecf3c9 man: import lxml formatting changes
lxml insists on this, see 4fb222c4b2.
2020-08-22 12:28:49 +02:00
Nicolas Fella
07b4f44968 Fix function description in logind man page
Fix a presumed copy&paste error. SetLockedHint corresponds to the "locked hint", not the "idle hint".
2020-08-18 22:44:45 +02:00
Zbigniew Jędrzejewski-Szmek
b7a4734551 man: fix links to various external man pages
In cases where we used both die-net and man-pages for the same reference,
I switched to use man-pages everywhere.
2020-06-25 14:41:44 +02:00
Topi Miettinen
cc1c85fbc3 login: limit nr_inodes for /run/user/$UID
Limit number of inodes for tmpfs mounts on /run/user/$UID. Default is
RuntimeDirectorySize= divided by 4096.
2020-05-24 22:54:17 +02:00
Zbigniew Jędrzejewski-Szmek
b61cc5fdad man: update login1(5) for SetType()
Added in db72aea4a9.
2020-05-06 09:13:42 +02:00
Zbigniew Jędrzejewski-Szmek
38b52b6918 man: drop CanMultiSession from documention
Removed in 8f8cc84ba4.
2020-05-05 22:41:23 +02:00
Zbigniew Jędrzejewski-Szmek
48f99d7c06 man: use --bus-introspect to autogenerate dbus api docs
This has the advantage that the executables are always in place and we don't
need any units to exist on the bus, so we can eventually hook this up into
a normal build system. (Probably as a build time check.)
2020-05-05 22:41:23 +02:00
Zbigniew Jędrzejewski-Szmek
beb1d28654 man: remove gendered pronoun and reindent a paragraph 2020-04-21 17:10:21 +02:00
Zbigniew Jędrzejewski-Szmek
98ab0daeeb docs: use "polkit" to refer to PolicyKit
See d35f51ea84 for justification.

First use in each file is turned into a link to the documentation page.
2020-04-21 17:10:02 +02:00