Replies: 2 comments
-
Thank you @kmk3 for gathering the related info regarding this topic. In relation to the Regarding the
If I understand correctly the socket approach needs one part inside the sandbox and the counterpart runs outside of this. In that context I don't see much difference between fireurl/fireurld (from @rusty-snake or as rewriten here in POSIX shell by @kmk3) and url-writer/url-reader. I do have a question about how the handling web browser is determined in the POSIX shell fireurld version and url-reader in their above state. If URL handling should be offered in Firejail, shouldn't hyperlinks get relayed to a firejailed web browser? If so, perhaps the checks could be made against available (firecfg-made) symlinks in /usr/local/bin instead?
Yes, that's a valid point. FWIW I've seen applications using:
Each of these tools has commands to query/set the default handlers for text/html and/or x-scheme-handler/http{,s}, so there's a few things we could build on. |
Beta Was this translation helpful? Give feedback.
-
No problem; glad it made sense :)
Yes, all of the listed implementations should work similarly. I just used generic names in the examples to make it clearer what each part
In that regard I don't think that the implementation matters as much as how For example, using Firefox as the browser, there are multiple ways to try to
Or:
That can be probably be configured wherever fireurld is started, for example:
Yes, a given program may try any of the methods used in the implementation Ideally the default browser would always be overridable through an env var, to That is, hopefully it would first try I'm not sure what it would take to override it in every program, but as one |
Beta Was this translation helpful? Give feedback.
-
Background
Currently, some non-browser-related programs (such as email clients) are unable
to open URLs through Firefox. To work around this, access to
~/.mozilla/firefox/profiles.ini
and/or to opening Firefox through D-Bus wasadded to some profiles, but sometimes that is not enough (see also #5566).
As an alternative method, it has been suggested to write to and read from a
socket to open URLs. Example workflow using "url-writer" and "url-reader":
url-writer
as the default browser somehowurl-writer $url
url-writer
writes to the socketurl-reader
(from outside of the sandbox) reads from the socket and opensthe URL in the desired browser (and/or performs any other desired action)
The benefit of this approach is that it does not require allowing access to
D-Bus nor making profiles less restrictive to allow opening Firefox (or any
other web browser).
Implementation
If the functionality is handed off to an optional external tool called at
runtime, the main benefits are that the tool is fully responsible for all of
its own code/build complexity and dependencies and that this is transparent to
firejail (and to the program that would run it). The downside is that the user
might need to install a separate tool (and that this requirement might not be
obvious).
With regards to adding fireurl to this repository (as mentioned in #5574),
the main concerns from the following comment also apply to it:
Besides that, I think that it would be more fitting to deal with such
simple/highly customizable tasks in a more scripting-oriented language.
For example, here are shell script implementations of a URL writer and reader:
url-writer
url-reader
Note: I'm not 100% sure about the order used when searching for a web browser.
Note2:
x-www-browser
is looked up byxdg-open
IIRC.Another example, using the same executable names and paths as fireurl
v0.1.0:
fireurl
fireurld
In either case, they do not require any tooling other than a POSIX shell, while
also being relatively easy to customize and maintain.
Custom Handlers
Regardless of any given implementation, keep in mind that standalone custom URL
handlers are already a thing (independently of firejail) and that there are
multiple different actions that a user might want to take when a program tries
to open a URL, for example:
notify-send
)(The same goes for custom
xdg-open
-like scripts that forward the argument todifferent programs depending on what file extension it contains, for example)
I haven't looked into this in a while, but last I checked it was my impression
that users creating their own custom URL handlers was not too uncommon,
especially considering that performing the above actions in shell scripting is
trivial (as it just requires gluing a few different programs together).
So I wonder if there are common tools/paths used for this which we could
leverage.
Ideally they would all use a standardized program name and socket path (so that
we would only have to worry about those in the profiles).
But if there isn't anything fitting, then I suppose that using a
fireurl
executable and
${RUNUSER}/fireurl
path would make sense.Which Browser
There is also the issue of how a given program may try to determine what is the
default web browser (which may vary between different programs), and how easy
it would be to convince all applicable programs to use something like fireurl,
though this issue might warrant its own discussion.
Relates to:
Beta Was this translation helpful? Give feedback.
All reactions