mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3714] How would it be possible to have specified commands run automatically with firejail? (e.g. youtube-dl becomes firejail youtube-dl) #2339
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#2339
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 @mYnDstrEAm on GitHub (Oct 31, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3714
For example instead of having to write
firejail youtube-dlfor command-line programs orfirejail firefox-esrin apps' launch commands I'd likeyoutube-dlandfirefox-esr(the latter also for any other app that might call this command) to automatically use firejail.So far I think two options for this are using aliases (e.g. reassigning the command
firefox-esr) andfirecfg. I'm not sure how firecfg works or whether there are additional options - are there any?Also I'd prefer not having to assign aliases for this, at least not manually (and one problem with aliases is that it disguises and hides the actual command being run). What would be the best way this could be either implemented as an additional feature in firejail/firecfg or used by the user? I'd like to specify which apps should run with firejail by default and for all others to require
firejailbeing put in front of the command. (Maybe at a later point there could be a user-prompt when running a new software for the first time if there is a firejail profile for its name.)@SkewedZeppelin commented on GitHub (Oct 31, 2020):
sudo ln -s /usr/bin/firejail /usr/local/bin/youtube-dl
@rusty-snake commented on GitHub (Oct 31, 2020):
aliases are not applied for desktop starter and non-interactive shells (depending where you set them).
On how they work to the user there are some alternatives: https://github.com/netblue30/firejail/issues/3665#issuecomment-707689049.
Under the hud they all do (mostly) the same.
So your goal is that only a few selected programs (e.g. firefox, thunderbird and youtube-dl) are firejailed by default, right?
@mYnDstrEAm commented on GitHub (Oct 31, 2020):
Wouldn't this make
youtube-dlbecomefirejailand notfirejail youtube-dl? If the target location of the symbolic can be appended like this: I'd like to use the commandyoutube-dland not e.g.fjyoutube-dl.Couldn't they simply be set in the
~/.bashrcfile?Thanks, this looks very useful for this. Even though it doesn't seem to be very convenient / natively well-supported currently.
Exactly. And that they don't require
firejailto be put in front of the command but are launched via the command of the same name and are guaranteed to only run firejailed.@rusty-snake commented on GitHub (Nov 1, 2020):
~/.bashrcis only read by interactive non-login shells by default.yes, and firejail detects that it is started through a symlink named youtube-dl and will act like
firejail youtube-dl.You can always start a program by path (=unfirejailed). If you want guarantee, you need to use a LSM like AppArmor or SELinux.
@mYnDstrEAm commented on GitHub (Nov 1, 2020):
I think that would be sufficient in my case. But why not in other shells? Is there a simply way to make it get read by all shells?
Great - so that's exactly what I was looking for. There's just a problem with running it like this of course:
ln: failed to create symbolic link '/usr/local/bin/youtube-dl': File existsso I guess one has to rename youtube-dl to something else first. The problem with that is that it probably will break the updating procedure because after updating it probably is calledyoutube-dlagain.Maybe there's a way to make software not executable when starting it via path but only otherwise. This would be tricky I guess. I'm already using AppArmor.
@rusty-snake commented on GitHub (Nov 1, 2020):
This would mean you must start programs in a terminal.
Because bashrc is the starup-file for interactive non-login bash sessions.
There are other starup-files too.
How did you installed ytdl?
... and then you make a update and the file is executable again. Uhh, and how should firejail start a program if it is not executable?
@mYnDstrEAm commented on GitHub (Nov 1, 2020):
Alright, thanks for the infos!
It's usually updated with pip
sudo pip install --upgrade youtube_dlI guess there's no good way around renaming the file/command.
Exactly. Maybe it would be possible for Linux/GNU/Debian/other software to have a table of executables that are allowed to be run on the machine with everything else not getting executed even when the executable flag is set. This table could also define the way that the software is allowed to be called with the default option allowing direct calls and otherwise it only allows e.g. certain commands to launch it. Like this:
That's just one idea. Please let me know what you think of it, whether you know if something like it already exists, if you maybe have suggestions for alternative and if you know of a place to best ask about it.
@rusty-snake commented on GitHub (Nov 1, 2020):
https://github.com/linux-application-whitelisting/fapolicyd
sudo pip install --upgrade --target=/usr/bin youtube-dl@rusty-snake commented on GitHub (Dec 16, 2020):
I'm closing here due to inactivity, please fell free to request to reopen if you have more questions.