From: Robert Woods <robert.woods@use.startmail.com>
To: zsh-workers@zsh.org
Subject: Bug: The capability CAP_WAKE_ALARM should be whitelisted.
Date: Mon, 7 Aug 2023 00:41:05 +0200 [thread overview]
Message-ID: <eb039d89-9f71-407b-9f3c-bd6dbec0a16e@use.startmail.com> (raw)
Hello,
Since a recent update of my ArchLinux, I noticed that zsh consider my
user account as privileged and display the sharp symbol (#) instead of
the percent (%) symbol.
The issue was triggered by the systemd update v254 from July 28, 2023.
But let me explain the details first:
1) I noticed that the zsh package in ArchLinux is built with
the option '--enable-cap'[1]
2) I noticed that the function 'privasserted' that checks if the
current user is privileged or not, uses the linux capability[2]. If
there is some effective capability sets, it considers the users as
privileged.
3) I reproduced the function 'privasserted' on a toy C example to check
the issue, and I noticed that 'CAP_WAKE_ALARM' was enabled. First I
thought this issue was coming from a config error on my system, but
then I figured that this capability was directly inherited from my
"desktop manager" xlogin[3]. (It is not exactly a desktop manager
since it is very lightweight, but you get the idea).
4) Since xlogin is simply a systemctl config to start my Xorg session
I checked the last release of systemd, and sure thing, the release
note of v254 (July 28, 2023) explains the origin of this issue[4].
Section "Security Relevant Changes" of the release v254 of systemd[4]:
> pam_systemd will now by default pass the CAP_WAKE_ALARM ambient
> process capability to invoked session processes of regular users on
> local seats (as well as to systemd --user), unless configured
> otherwise [...]. This is useful in order allow desktop tools such as
> GNOME's Alarm Clock application to set a timer for
> LOCK_REALTIME_ALARM that wakes up the system when it elapses. [...].
> Note that this capability is relatively narrow in focus (in
> particular compared to other process capabilities such as
> CAP_SYS_ADMIN) and we already — by default — permit more impactful
> operations such as system suspend to local users.
This change was made by Lennart Poettering himself in a GitHub PR[5].
My thoughts on that:
* Since systemd is widely use, I expect this issue to become a real
one: users will not understand why they are considered as privileged
on zsh.
* I understand the rationale of using the capabilities to check if a
user is privileged or not, however, I think some capabilities should
be whitelisted like CAP_WAKE_ALARM since it is not very harmful.
* Even if systemd was not allowing CAP_WAKE_ALARM by default, some
desktop manager would still enable it in their systemctl config
anyway. So it doesn't change my previous point in my opinion.
I hope my bug report is clear enough. I would like to take this
opportunity to thank you for all the work you guys are doing on zsh!
Kind regards,
Footnotes:
[1]
https://gitlab.archlinux.org/archlinux/packaging/packages/zsh/-/blob/main/PKGBUILD#L74
[2] https://github.com/zsh-users/zsh/blob/zsh-5.9/Src/utils.c#L7522
[3] https://github.com/joukewitteveen/xlogin
[4] https://github.com/systemd/systemd/releases/tag/v254
[5] https://github.com/systemd/systemd/pull/26548
--
Roberts Woods
next reply other threads:[~2023-08-06 22:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-06 22:41 Robert Woods [this message]
2023-08-14 18:39 ` [PATCH] 52027: whitelist capability CAP_WAKE_ALARM in 'privasserted' function Robert Woods
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=eb039d89-9f71-407b-9f3c-bd6dbec0a16e@use.startmail.com \
--to=robert.woods@use.startmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).