Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profiles: thunderbird: fix access to wayland socket #6659

Closed
wants to merge 1 commit into from

Conversation

sudoAlphaX
Copy link
Contributor

@sudoAlphaX sudoAlphaX commented Feb 22, 2025

Denying access to ${RUNUSER} (/run/user/$(id -u)) denies access to
Wayland socket which results in thunderbird running under X11.

whitelist-runuser-common.inc is included in firefox-common.profile, which is
included by firefox.profile, which is in turn included by
thunderbird.profile. But it is ignored by the thunderbird.profile.
This patch removes the ignore whitelist-runuser-common.inc to allow
thunderbird to access wayland sockets.

Denying access to ${RUNUSER} (/run/user/$(id -u)) denies access to
Wayland socket which results in thunderbird running under X11.

whitelist-runuser-common.inc is included in firefox-common.profile, which is
included by firefox.profile, which is in turn included by
thunderbird.profile. But it is ignored by the thunderbird.profile.
This patch removes the ignore whitelist-runuser-common.inc to allow
thunderbird to access wayland sockets.
@kmk3 kmk3 changed the title thunderbird use wayland instead of X11 profiles: thunderbird: fix access to wayland socket Feb 22, 2025
Copy link
Collaborator

@kmk3 kmk3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change I see less paths in ${RUNUSER} than before (which makes
sense when using whitelisting) with the following command:

firejail --ignore='include globals.local' \
  --ignore='include thunderbird.local' --profile=thunderbird \
  ls -l "/run/user/$(id -u)"

Are you sure that this increases the access to the wayland socket?

Access to that socket is available by default AFAIK (see the
blacklist ${RUNUSER}/wayland-* entry in many profiles).

Have you tested this with firejail-git and no profile modifications?

Copy link
Collaborator

@rusty-snake rusty-snake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thunderbird does not use wruc for reason. If you enabled whitelist ${RUNUSER}/app/org.keepassxc.KeePassXC or something else in your firefox-common.local, you need to ignore it in your Thunderbird.local.

@sudoAlphaX
Copy link
Contributor Author

Have you tested this with firejail-git and no profile modifications?

I current use firejail-git without any modifications to the thunderbird.local. I have a few changes to globals.local and they are as follows:

# Allow the runtime clipboard
include runtime-clipboard.local

# Do not join the same sandbox (multi-user fix)
ignore join-or-start

runtime-clipboard.local

mkdir ${RUNUSER}/clipboard
noblacklist ${RUNUSER}/clipboard
whitelist ${RUNUSER}/clipboard

Which i dont think would affect RUNUSER access.

Just to be extra sure, I removed all my firejail local overrides launched thunderbird again

What the heck? whitelisting ${RUNUSER}/clipboard in globals.local blocks access to /run/user/$(id -u) (from runtime-clipboard.local).
This is a problem with my configuration. I have removed the file and thunderbird launches with wayland. Any ideas on how to fix this?

Here's are my local overrides:

firefox-common.local

# private-etc support
private-etc alternatives,asound.conf,ca-certificates,crypto-policies,dconf,fonts,group,gtk-2.0,gtk-3.0,hostname,hosts,ld.so.cache,ld.so.conf,ld.so.conf.d,ld.so.preload,localtime,machine-id,mailcap,mime.types,nsswitch.conf,pango,passwd,pki,pulse,resolv.conf,selinux,ssl,X11,xdg

firefox.local

# Private dirs support
private-bin bash,dbus-launch,dbus-send,env,firefox,sh,which
private-etc firefox

# Inhibit screensaver
dbus-user.talk org.freedesktop.ScreenSaver

# Native notifications
dbus-user.talk org.freedesktop.Notifications

# Wayland Screensharing
#dbus-user.talk org.freedesktop.portal.Desktop
# Add the next line to your firefox.local if screen sharing sharing still does not work
# with the above lines (might depend on the portal implementation).
#ignore noroot

globals.local

# Allow the runtime clipboard
include runtime-clipboard.local

# Do not join the same sandbox (multi-user fix)
ignore join-or-start

runtime-clipboard.local

mkdir ${RUNUSER}/clipboard
noblacklist ${RUNUSER}/clipboard
whitelist ${RUNUSER}/clipboard

@sudoAlphaX sudoAlphaX closed this Feb 22, 2025
@sudoAlphaX sudoAlphaX deleted the thunderbird-wayland branch February 22, 2025 08:46
@sudoAlphaX
Copy link
Contributor Author

Thunderbird does not use wruc for reason. If you enabled whitelist ${RUNUSER}/app/org.keepassxc.KeePassXC or something else in your firefox-common.local, you need to ignore it in your Thunderbird.local.

Ah i see. I have whitelisted a particular directory under ${RUNUSER} globally. That is the reason. How do I do something like that without affecting other files? I was ${RUNUSER}/clipboard to be available everywhere but not any parent directory.

Do i use noblacklist?

Thanks for the help.

sudoAlphaX added a commit to sudoAlphaX/dotfiles that referenced this pull request Feb 22, 2025
sudoAlphaX added a commit to sudoAlphaX/dotfiles that referenced this pull request Feb 22, 2025
@rusty-snake
Copy link
Collaborator

rusty-snake commented Feb 22, 2025

If you want to make sure all sandboxes can access /run/user/$UID/clipboard:

whitelist-runuser-common.local:

whitelist ${RUNUSER}/clipboard

~/.config/user-tmpfiles.d/runuser-clipboard.conf:

d %t/clipboard 700 - - - -

@kmk3 kmk3 added the notabug The behavior is as intended or the issue was caused by user error or by an old version label Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notabug The behavior is as intended or the issue was caused by user error or by an old version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants