Skip to content

Instantly share code, notes, and snippets.

@mricon mricon/ff
Last active Sep 25, 2019

Embed
What would you like to do?
Convenient wrapper for firejail and firefox
#!/bin/bash
# ff: convenient wrapper for firejail and firefox
#
# You can mix and match most keywords. Anything that's not a keyword
# will become the name of the private profile.
#
# Examples:
# ff
# - use basic defaults (no private directory, system resolver)
# ff 1dns personal
# - use a private directory in $HOME/firefox-profiles/personal
# - use the 1.1.1.1 server for domain resolution
# ff 8dns personal
# - use a private directory in $HOME/firefox-profiles/personal
# - use Google DNS servers for domain resolution
# ff 9dns junk
# - create a blank private profile and throw it away at the end of the
# session
# - use Quad DNS resolver
# ff work novirbr
# - use a private directory in $HOME/firefox-profiles/work
# - don't use a virtual bridge even if one is available
# ff nojail
# - just start firefox without firejail
#
if ip link show virbr0 2>/dev/null; then
net='--net=virbr0'
fi
while (( "$#" )); do
case "$1" in
nojail)
/usr/bin/firefox
exit 0
;;
1dns)
dns='--dns=1.1.1.1'
;;
8dns)
dns='--dns=8.8.8.8 --dns=8.8.4.4'
;;
9dns)
dns='--dns=9.9.9.9'
;;
junk)
private="--private=$(mktemp -d)"
;;
novirbr)
net=''
;;
*)
private="--private=$HOME/firefox-profiles/$1"
mkdir -p $HOME/firefox-profiles/$1
;;
esac
shift
done
firejail $dns $net $private firefox -no-remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.