-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remount Tor Browser folder in /home with exec (disable noexec if enab…
- Loading branch information
Patrick Schleizer
committed
Dec 17, 2019
1 parent
9fd05e8
commit 2e0c1c4
Showing
3 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
## Copyright (C) 2019 - 2019 ENCRYPTED SUPPORT LP <adrelanos@riseup.net> | ||
## See the file COPYING for copying conditions. | ||
|
||
Defaults:ALL env_keep += "tb_home_folder" | ||
Defaults:ALL env_keep += "tb_user_home" | ||
user ALL=NOPASSWD: /usr/lib/tb-starter/remount-exec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/bin/bash | ||
|
||
## Copyright (C) 2019 - 2019 ENCRYPTED SUPPORT LP <adrelanos@riseup.net> | ||
## See the file COPYING for copying conditions. | ||
|
||
## test: | ||
## sudo tb_user_home=/home/user tb_home_folder=/home/user/.tb bash -x /usr/lib/tb-starter/remount-exec | ||
|
||
#set -x | ||
set -e | ||
|
||
if [ "$(id -u)" != "0" ]; then | ||
echo "ERROR: Must run as root." >&2 | ||
exit 112 | ||
fi | ||
|
||
## example tb_user_home: | ||
## /home/user | ||
|
||
if [ "$tb_user_home" = "" ]; then | ||
echo "$0: ERROR tb_user_home is empty" >&2 | ||
exit 1 | ||
fi | ||
|
||
## example tb_home_folder: | ||
## /home/user/.tb | ||
|
||
if [ "$tb_home_folder" = "" ]; then | ||
echo "$0: ERROR tb_home_folder is empty" >&2 | ||
exit 1 | ||
fi | ||
|
||
## Check if already correct mount options. | ||
if mount | grep "$tb_home_folder" | grep -q noexec ; then | ||
## noexec mount option found. Therefore remount. | ||
mount --bind -o nosuid,nodev "$tb_home_folder" "$tb_home_folder" | ||
fi | ||
|
||
## results in: | ||
# mount | grep /home/user/.tb | ||
# /dev/xvdb on /home/user/.tb type ext4 (rw,nosuid,nodev,relatime,discard) | ||
# /dev/xvdb on /rw/home/user/.tb type ext4 (rw,nosuid,nodev,relatime,discard) |