Code Monkey home page Code Monkey logo

firejail-profiles's Introduction

firejail-profiles

Tight Firejail profiles

This is a collection of tighter firejail (https://github.com/netblue30/firejail) profiles for certain applications. These may or may not work on your computer since some of them use seccomp filters, which may depend on architecture and OS. These were designed on Debian sid/experimental x86_64.

I am slowly switching the profiles to use a common.inc file so that maintenance becomes easier and I cut down on duplicate stuff.

Just a note: I would highly recommend using systemd to sandbox system processes. I personally do not use firejail to sandbox system processes since I'm using systemd to start the process anyway (so it's easier to use the sandboxing capabilities of systemd itself).

Utilities

Currently there is one utility file in this repository: gen_libraries. gen_libraries is a collection of bash functions which helps dynamically resolve the libraries needed by a program in a more powerful way than the built-in one shipped with firejail. Most pertinently, it allows passing a folder as the first argument, in which case it will use find to locate all files within the folder and run ldd on each of them. This makes it easier, say, to compile a list for firefox.

An example script, private-profile.sh, which makes use of gen_libraries is provided in this repository as well. private-profile.sh makes it easy to generate a temporary profile for an application (usually a browser) and run the application with that profile. There are five possible arguments to the script. Positional arguments come at the end. The arguments are as follows:

  • The only positional argument is the path to a .private file. .private files define several application-specific variables which are used later in the script. More on this below.
  • -p is the path to an existing profile. This will be used in certain circumstances.
  • -t toggles whether the script should create a temporary profile.
  • -c toggles whether the script should copy certain files or folders from the existing profile to the temporary profile.
  • -n enables a network namespace on the given interface.

A .private file defines several application-specific variables. The following variables are recognized:

  • $privlib enables the dynamic generation of a private-lib filter. If enabled, the following variables should be defined:
    • $genlib is the path to the gen_libraries path.
    • $libdir is the path to the application's lib folder.
    • $extralibs [optional] is the list of hard-coded libraries which are not automatically detected. Can be left unset if no hard-coded libraries are required.
  • $use_systemd enables systemd integration.
  • $use_firejail enables firejail integration.
  • $profiledir is the path to the directory where profiles are stored.
  • $tocopy is the list of files to copy to the temporary profile.
  • $destdir [optional] is the directory to generate inside the temporary profile directory. If set to "" or unset, then the temporary directory itself is treated as the profile.
  • $progname is the command to run.
  • $progargs is the array of arguments to pass when the program is not already running.
  • $rprogargs is the array of arguments to pass when the program is already running.
  • $envvars [optional] is a bash array used for setting any environment variables (now uses firejail's environment handling!). If set to an empty array (()) or unset, no extra environment variables are passed along.

There are two example .private files in this repo, private-profiles/firefox.private and private-profiles/chromium.private.

Another example script, dropbox, is also provided which uses gen_libraries to dynamically generate the library dependencies needed to get dropbox working with a private-lib filter.

Yet another example script, google-earth-pro, is provided which uses gen_libraries to dynamically generate the library dependencies needed to get google-earth-pro working with a private-lib filter. Also note that due to some issues with google-earth-pro, the script manually removes the lock file generated by Google Earth after quitting.

Profiles

List of currently-supported programs:

  • Ardour 5
  • Akregator
  • aMule
  • Blender
  • Brackets
  • BRL-CAD (experimental) - use the generator script brlcad-gen.sh to generate aliased profiles and setup the private-bin predicate.
  • calcurse
  • Calligra
  • Darktable
  • Dia
  • Discord
  • Dropbox
  • ELinks
  • Feh
  • Fetchmail
  • Firefox (regular and ESR)
  • Flameshot
  • Flowblade
  • Fontforge
  • FreeCAD
  • Geany
  • Gerbera
  • GIMP
  • Git
  • Google Chrome
  • Google Earth Pro
  • Gradio
  • Hugin
  • ImageJ
  • Inkscape
  • Kdenlive
  • Libreoffice
  • Linphone
  • LMMS
  • Luminance HDR
  • Macrofusion
  • Matlab
  • Messenger For Desktop
  • MPD
  • mps-youtube (mpsyt)
  • MPV
  • MuPDF
  • Mutt
  • Natron (thanks @triceratops1!)
  • Newsboat
  • OpenShot
  • Opera
  • Pidgin
  • ping
  • Qemu (VMs should be stored in ${HOME}/qemu-vms or edit qemu-system-common.profile to whitelist the folder you store your VMs in) - profiles included for qemu-system-{i386,x86_64}, but you can create your own by building off of qemu-system-common.profile
  • QPDFView
  • Ricochet
  • rtv
  • Scribus
  • Scrot
  • Shotcut
  • Signal Desktop
  • Skype
  • Slack Desktop
  • SSH
  • Synfig Studio
  • Telegram Desktop
  • Tor Browser Bundle (through the torbrowser-launcher package on Debian)
  • Tor Browser profile for Arch (thanks @robotanarchy!)
  • Viber
  • Viewnior
  • Virtualbox
  • Generic terminal emulator (the profile is called x-terminal-emulator because of the /etc/alternatives system in Debian)
  • Xfburn
  • Youtube-dl
  • Zart (thanks @triceratops1!)

firejail-profiles's People

Contributors

bundy01 avatar chiraag-nataraj avatar skewedzeppelin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

firejail-profiles's Issues

Request: amule profile

p2p its still popular
but with the increased issues with it (censorship/copyright-censorship)

would be extremely good have a firejail profile for amule (protecting you from "misfortunes")

best regards

Adapting firefox.common to other programs

@esotericDisciple commented the following in netblue30/firejail#2217:

Still can't figure out how to run a "firejail --private inox" command that allows for copying over an /.config/inox directory from an external hard drive, so that the end result is the ability to run multiple inox/ungoogled-chromium browsers separately like Multiloginapp or Firefox Containers offers, but also lets me use a custom browser profile, settings, extensions and all, for each one...

Thanks, but how do I use is that or any .common script with firejail?

signal does not start

hello,

so i have tried to get signal-desktop to start in firejail

by default, signal installs in /opt/Signal and sets up a symlink in /usr/local/bin/signal-desktop -> /opt/Signal/signal-desktop

when i run the command firejail signal-desktop all i get in return is

~$ firejail signal-desktop
Reading profile /etc/firejail/signal-desktop.profile
Parent pid 4752, child pid 4753
Child process initialized

Parent is shutting down, bye...

biscuit profile

Name of the program
Name of the program
biscuit.AppImage
Website
Website for the program (if the program is in most major repositories, you can optionally skip this).
https://github.com/agata/dl.biscuit
Already available in stock firejail?
Is the requested profile already available in regular firejail (that is, are you requesting an enhanced profile or a completely new profile?)?
No
Additional info
Anything else you think I should know before working on this profile.
No debugging output given, firejail just shuts down unless "--noprofile" is used....Also running with "--noblacklist=/.config/biscuit --whitelist=/.config/biscuit" doesn't work either (though it does for Rambox)...

cool profiles

  • openvpn
  • eddie (for airvpn...A VERY COOL vpn but premium),
  • i2p (taking as base the i2prouter with systemd services installed at /opt)
  • freenet
  • dia (ms visio like)
  • geany (a COOL IDE)

New Profile for LyX

Name of the program
LyX

Website
LyX

Already available in stock firejail?
No

Additional info
You may take a look at my profile. I tested on manjaro.But you may do further testing with other distros & most likely it needs some changes for other distros.

Buggy profiles

Synfigstudio

irejail synfigstudio
Reading profile /etc/firejail/synfigstudio.profile
Warning: user namespaces not available in the current kernel.
Parent pid 4557, child pid 4558
Child process initialized

synfig studio -- starting up application...

** (synfigstudio:7): WARNING **: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-sDCGkevOjL: Conexión rehusada
mlt_repository_init: failed to dlopen /usr/lib/mlt/libmltopengl.so
(libmovit.so.4: no se puede abrir el fichero del objeto compartido: No existe el fichero o el directorio)
Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.
Standard Exception: std::exception
terminate called after throwing an instance of 'std::runtime_error'
what(): Unable to open module list file 'synfig_modules.cfg'

Parent is shutting down, bye...

Add profile: Natron

i've created a natron profile

blacklist /usr/local/bin
blacklist /usr/local/sbin
blacklist /boot
blacklist /media
blacklist /mnt
whitelist ${HOME}/.Natron
whitelist ${HOME}/.cache/INRIA/Natron/
whitelist ${HOME}/.config/INRIA/
whitelist ${HOME}/.gtkrc-2.0
whitelist ${HOME}/.themes
whitelist ${DOWNLOADS}
whitelist ${HOME}/Videos

whitelist /opt/natron/

private-bin natron
private-etc fonts,X11,pulse
whitelist /tmp/.X11-unix/
noexec ${HOME}
noexec /tmp
shell none
ipc-namespace

What's the OS/architecture?

What's the OS/architecture the profiles were designed for? Latest version of Arch Linux 64-bit? Would be nice to include this information in the README.

Tvheadend profile

Name of the program
Tvheadend

Website
https://tvheadend.org/

Already available in stock firejail?
Not present

Additional info

Here is the profile I created. The problem is on the 'private-bin' line. If I decomment it, the program does not start.
I would like to know the programs in "/user/bin" that are essential for the proper functioning of Tvheadend.

# Firejail profile for Tvheadhend
# This file is overwritten after every install/update
quiet
# Persistent local customizations
include tvheadend.local
# Persistent global definitions
include globals.local

noblacklist ${HOME}/.hts
blacklist ${HOME}/Public

include disable-common.inc
include disable-devel.inc
include disable-passwdmgr.inc
include disable-programs.inc
include disable-interpreters.inc
include disable-exec.inc
include disable-xdg.inc

mkdir ${HOME}/.hts
whitelist ${HOME}/.hts

apparmor
caps.drop all
netfilter
nodvd
nogroups
nonewprivs
noroot
nou2f
#protocol unix,inet,inet6
machine-id

disable-mnt
#private-bin tvheadend,tv_grab_file,sh
private-dev
private-tmp
private-etc alternatives

Thank you very much.

[discussion] discord.profile: Doesn't need access to the entirety of /tmp

It'd be nice if there was a way to allow discord to only access /tmp/discord.sock, while leaving the rest of /tmp hidden. Right now, discord.profile ignores the private-tmp command, exposing the host's /tmp folder.
I've attempted creating the socket beforehand, and whitelisting it in the discord profile, but it seems discord tries to remove the file on bootup.
To fix this, we'd need to either:

  • Modify discord itself to not remove the file (the "base" client doesn't update very often so this might be feasible, but I'm not sure if this is even possible due to how sockets work)
  • Allow the file to be removed and re-created, without compromising the entirety of /tmp (don't think this is possible due to the way firejail works)
  • Have firejail ignore the unlink syscall, so the program thinks it's "unlinked" the file successfully (requires an update to firejail itself)

I'm opening this issue mostly to open dialogue about this, since there's more applications that do similar things, and you might want to be able to communicate with them over sockets outside of the sandbox, or somehow share the same tmpfs mount. Are there any more possible options for doing such a thing?

Keepassxc does not start in firejail mode

Hi,

I created a shortcut for keepassxc 'firejail keepassxc %f' or 'firejail --profile=/etc/firejail/keepassxc keepassxc %f' but I don't have keepassxc by checking with 'firejail --list'.
It works if I launch it with 'firejail keepassxc' in a terminal.

Do you have any idea how to make my shortcut work?

Better Documentation

Hi. Sorry, maybe that's a dumb question. I'm not that versatile with deep linux security. Please provide a little more understandable documemtation for nongeeks ;).
Concrete:
What is the commandline syntax of your script?
What does it do exactly?
And what do you recommend for secure profiles with your script in combination with firejail?
Regards

More profiles

can you make profiles for these apps?

1 brl-cad (a millitary-veteran CAD..but common at civilian enviorments)

2 freecad (a civil-use CAD)

3 dia (an oss alternative to ms visio)

4 fontforge

New profiles

could you provide these profiles?
cinelerra
lmms
gimp
inkscape

Steam does not show

Hello,

when i start steam in firejail, i don't see the client anywhere

not even in the icon drawer at the bottom left of the screen, which has dropbox in it (working inside firejail too)

Another request

I was hoping if possible you may add akregator to your list as I find it simmilar to using firefox & especially since its develpopers have added adblock which has given it the extra security it needs.
Thanks

tmate

Name of the program
tmate

Website
https://tmate.io/

Already available in stock firejail?
no

Additional info
Tmate is a remote tmux/ssh session sharing tool. There could be different profiles with one that restrict access to the directory where tmate is started.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.