mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #4414] Can't open atril from within calibre #2658
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2658
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Boruch-Baum on GitHub (Jul 21, 2021).
Original GitHub issue: https://github.com/netblue30/firejail/issues/4414
In debian, using firejail 0.9.64.4, calibre 5.16.1, and atril 1.20.3 and using the default firejail profiles: From within firejail /usr/bin/calibre, I can't open/view a document with atril.
What does work:
In the following output from
firejail --debug calibre, note that the first line spawned when askin to view a pdf is the line beginning "Error seteuid":EDIT by @rusty-snake: Code-block
@rusty-snake commented on GitHub (Aug 1, 2021):
Running program A in the sandbox made for program B is something that maybe works and maybe don't work.
profile diffs
@Boruch-Baum commented on GitHub (Aug 1, 2021):
On 2021-08-01 00:41, rusty-snake wrote:
I don't seem to have a local copy of the fjp tool installed (debian).
Where / how can I get it so that I can see exactly what's happening
locally?
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
@rusty-snake commented on GitHub (Aug 1, 2021):
fjp is a unoffical tool from me.
repo: https://github.com/rusty-snake/fjp
website: https://rusty-snake.github.io/fjp/
latest release: https://github.com/rusty-snake/fjp/releases/tag/v0.2.0 (v0.3.0-rc1 will come soon)
@Boruch-Baum commented on GitHub (Aug 1, 2021):
Thanks.
On 2021-08-01 02:45, rusty-snake wrote:
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
@rusty-snake commented on GitHub (Aug 1, 2021):
BTW this is a firejail error, if you remove the firecfg symlink, it might work.
But why does mupdf work, it should have a firecfg symlink too.
@Boruch-Baum commented on GitHub (Aug 1, 2021):
I think I have the calibre/atril problem solved.
What seems to have been breaking things is that setting 'net none' in my
calibre.local file was disabling dbus (bug?, documented?). This is
important to me because I'm frightened by calibre's demands for internet
access (to places like amazon.com, etc) and can never be sure of its
scope. For many users, such access may be desirable (eg. to search,
sync, and purchase ebooks directly from calibre), but they probably are
not the type of people who would be interested in firejail in the first place.
Based upon my re-reading of the firejail-profile man page, I have
updated my calibre.local with two additional lines, so it looks like this:
net none
dbus-user filter
dbus-user.talk org.freedesktop.*
My tests indicate that this allows atril and disables internet.
Remaining questions for me:
Am I doing this correctly?
Should I be more restrictive somehow in the use of the dbus filters?
Should 'net none' really be killing dbus access?
On 2021-08-01 03:14, rusty-snake wrote:
I'm not using symlinks. I modify my local copy of the *.desktop file.
Doing so also allows me to do the following (very long line follows may show
up as word-wrapped in your email viewer):
Exec=env CALIBRE_USE_DARK_PALETTE=0 CALIBRE_USE_SYSTEM_THEME=true QT_QPA_PLATFORMTHEME=qt5ct cpulimit -l 50 -- firejail /usr/bin/calibre %F
Aaahh. In my local setup mupdf has no symlink and no modified *.desktop
file (I have mupdf installed for its pdf manipulation tools, not for its
viewer. It was just that while trying to figure out this problem I tried
using it as an alternative).
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
@rusty-snake commented on GitHub (Aug 1, 2021):
If you have modified settings, you should say it already in OP. Even if they seem to be unrelated to the error message/behaviour as there can be strange side effects.
Why using D-Bus filtering at all with this rule?
This allows (
org.freedesktop.DBus),org.freedesktop.Flatpak,org.freedesktop.Notifications,org.freedesktop.PackageKit,org.freedesktop.ScreenSaver,org.freedesktop.Tracker3.Miner.Files.Control,org.freedesktop.impl.portal.PermissionStore,org.freedesktop.impl.portal.desktop.gtk,org.freedesktop.portal.Flatpak,org.freedesktop.secrets,org.freedesktop.systemd1.What's your goal?
General: Adding command to .locals to make things work is right.
See above. btw from where did you got the
org.freedesktop.*?If you use abstract sockets, yes.
@Boruch-Baum commented on GitHub (Aug 1, 2021):
On 2021-08-01 06:16, rusty-snake wrote:
Sorry. As soon as I realized that the file existed, I reported it.
In order to try to debug, I decided to launch firejail from a console in
order to see what it was sending to STDERR. One message was:
"DBusExport: Failed to connect to
DBUS session bus, with error: org.freedesktop.DBus.Error.NoServer:
Failed to connect to socket /tmp/dbus-EnYpF9rDQk: Connection refused"
So I tried that dbus socket, ie.:
However, that caused firejail to send an error message to the console:
Ignoring "dbus-user.talk org.freedesktop.*".
So, I went back to the man page, and saw in the example given that the
dbus.user-talk line was preceded by a line 'dbus filter' and the
documentation seems to say that both are needed. Now I see that line
'dbus filter' alone is enough to enable atril.
I went one-by-one and tested each of the items you listed above, using
an ignore statement to eliminate the others, and it seems none of the
org.freedesktop rules are necessary, and some other dbus feature is
being white-listed by the general statement 'dbus filter'.
I saw an error message on my console: "DBusExport: Failed to connect to
DBUS session bus, with error: org.freedesktop.DBus.Error.NoServer:
Failed to connect to socket /tmp/dbus-EnYpF9rDQk: Connection refused"
Thanks for the support and time you've been giving me on this. I hope
maybe something comes of it that can be useful for others, somehow.
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
@rusty-snake commented on GitHub (Aug 1, 2021):
org.freedesktop.DBus.Error.NoServeris the error type and not the name it tried to access. Unfortunately it does not say which name it tries to accessdbus-user filter(nodbus-user.{own,talk})? And withdbus-user none? (<<The rules (dbus) should not be overly permissive.)net noneis enough to disable internet access. As alternative you can setprotocol unix,netlink+ignore protocol. If you only care about amazon connections (i.e. your goal is privacy) maybe evedns 0.0.0.0works. (<<Calibre should have no internet access.)@Boruch-Baum commented on GitHub (Aug 1, 2021):
On 2021-08-01 07:53, rusty-snake wrote:
Yes, it does launch atril that way.
No, it does not launch atril with that rule.
Do I need both protocol lines in my calibre.local file? In my testing it
seems that line 'protocol unix,netlink' was sufficient to eliminate
internet access even without the other line 'ignore protocol'. What I
get on STDERR on the console with just the single line is:
Warning: networking feature is disabled in Firejail configuration file
Warning: more than one protocol list is present, "unix,netlink" will be
installed
Currently, my calibre.local file looks like this:
net none
protocol unix,netlink
ignore protocol
dbus-user filter
dbus-system none
This does cut off internet and allows atril. I then delayed responding
to you because I thought it may be over-permissive in that allows any
other program to launched. Ideally, it should be limited to
(specific/common/known) document viewers.
So I ran some (many) tests (which could have been expedited with some
kind of strace help probably) and I've come up with the following which
is working for me for documents of type djvu, epub, and pdf. If it can
be useful to you or to some firejail users, that would be great. Note
that I've only been testing this for a matter of minutes, so if you
think it has potential you may still want to wait and get back to me
after further 'life' testing. Also, calibre is chock full of features
that I don't use, so the following may need more permissiveness.
noblacklist /usr/bin/atril*
noblacklist /usr/bin/awk
noblacklist /usr/bin/basename
noblacklist /usr/bin/calibre*
noblacklist /usr/bin/cpulimit
noblacklist /usr/bin/cut
noblacklist /usr/bin/ebook-*
noblacklist /usr/bin/evince
noblacklist /usr/bin/djview
noblacklist /usr/bin/fail2ban*
noblacklist /usr/bin/faillog
noblacklist /usr/bin/file
noblacklist /usr/bin/firecfg
noblacklist /usr/bin/firejail
noblacklist /usr/bin/firejail-ui
noblacklist /usr/bin/firemon
noblacklist /usr/bin/firetools
noblacklist /usr/bin/gawk
noblacklist /usr/bin/mupdf
noblacklist /usr/bin/okular
noblacklist /usr/bin/pdf*
noblacklist /usr/bin/print*
noblacklist /usr/bin/python*
noblacklist /usr/bin/which
noblacklist /usr/bin/www-browser
noblacklist /usr/bin/xpdf
noblacklist /usr/bin/x-www-browser
noblacklist /usr/bin/xdg*
noblacklist /usr/bin/zathura
blacklist /usr/bin/*
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
@rusty-snake commented on GitHub (Aug 1, 2021):
I know this behaviour from some Qt programs with File Open Dialogs (e.g.
d0004b845d)However, I think here it is something else (maybe).
That changed in firejail 0.9.66
See above
Debian package default, nothing to worry (only
net <iface|bridge|tap>,net*,ip*, ... are disable but notnet none)It is. If you can, use
net none: Always addnet noneif you can, it blocks sandbox escapes via abstract unix socketsprotocol unix,netlink: If it does not needinet,inet6, why permit itignore protocol: firejail >= 0.9.66dbus-user filter: (here) to workaroundnet nonebreakageNote that everything that can be done by other programs can be done by calibre too. (from a permission point of view)
/binprivate-bin?@Boruch-Baum commented on GitHub (Aug 1, 2021):
On 2021-08-01 10:11, rusty-snake wrote:
OK. I'll do that.
Would it be helpful to also add dbus-system none? It doesn't seem to
hurt.
The first honest answer is that I didn't remember that it existed.
The more important second honest answer is that I just tried it and for
it to work would require me to perform more work, ie. to discover and
explicitly include the /bin executables needed by calibre.
---- pause as I do more work before hitting send ----
Below is what I have so far that works. It seems sufficient to add just
shells, greps, readlink, and sed to the prior list. However, as I
mentioned in my prior email, calibre has many features and plugins and
my testing so far has been limited to opening, adding, and deleting
ebooks.
private-bin atril*,awk,basename,calibre*,cpulimit,cut,ebook-,evince,djview,fail2ban,faillog,file,firecfg,firejail,firejail-ui,firemon,firetools,gawk,gv,mupdf,okular,pdf*,print*,python*,which,www-browser,xpdf,x-www-browser,xdg*,zathura,bash,dash,egrep,grep,readlink,sed,sh,sh.distrib
Some of the regexes there could be eliminated with some thought (eg.
python stuff).
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
@rusty-snake commented on GitHub (Aug 1, 2021):
Yes
You can generate one with
firejail --build calibre.@rusty-snake commented on GitHub (Oct 9, 2021):
I'm closing here due to inactivity, please fell free to request to reopen if you still have this issue.