-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjailbird.sh
More file actions
executable file
·73 lines (67 loc) · 1.58 KB
/
jailbird.sh
File metadata and controls
executable file
·73 lines (67 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
JAILBIRD_DIR="${HOME}/.local/share/jailbird/"
PROFILE_NAME=default
XEPHYR_SIZE=1280x960
JAIL_X11=
while getopts "hp:ld:w:x" opt; do
case ${opt} in
h)
echo
echo "$0 - starts Thunderbird in a security jail"
echo
echo "Options:"
echo " -x Use nested Xephyr X11 server"
echo " -w Use custom firejail window size (default: ${XEPHYR_SIZE})"
echo " -p <profile> Use the profile named <profile> "
echo " (default profile is called 'default')"
echo " -l List profiles"
echo " -d <profile> Delete the given profile"
echo " -h Display this help message"
echo
exit 0
;;
p)
PROFILE_NAME=${OPTARG:-default}
;;
l)
exec ls "${FRESHFOX_DIR}/"
;;
d)
exec rm -r "${FRESHFOX_DIR}/${OPTARG:-default}"
;;
w)
XEPHYR_SIZE=${OPTARG:-1280x960}
JAIL_X11=1
;;
x)
JAIL_X11=1
;;
\?)
echo "Invalid Option: -$OPTARG" 1>&2
exit 1
;;
:)
echo "Invalid Option: -$OPTARG requires an argument" 1>&2
exit 1
;;
esac
done
shift $((OPTIND -1))
cd
PROFILE_DIR="${JAILBIRD_DIR}/${PROFILE_NAME}"
mkdir -p ${PROFILE_DIR}
if [ "_${JAIL_X11}" != '_' ]
then
FIREJAIL_X11_OPTS="--x11=xephyr --xephyr-screen=${XEPHYR_SIZE/[^0-9]/x}"
THUNDERBIRD_X11_OPTS="--window-size ${XEPHYR_SIZE/[^0-9]/,}"
else
FIREJAIL_X11_OPTS=
THUNDERBIRD_X11_OPTS=
fi
firejail --name="jailbird-${PROFILE_NAME}" \
${FIREJAIL_X11_OPTS} \
--whitelist="${PROFILE_DIR}" \
thunderbird \
${THUNDERBIRD_X11_OPTS} \
--profile "${PROFILE_DIR}" \
"$@"