Skip to content

Commit

Permalink
torrc configuration from host inclusion by flag
Browse files Browse the repository at this point in the history
introducing --host-torrc flag to include host torrc
in tor launched by orjail. This was enabled by default
but causing to many strange things :)
would be nice to specify a path within this option
  • Loading branch information
lesion committed Sep 18, 2018
1 parent 00961d5 commit 044cd9e
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions usr/sbin/orjail
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ TRANSPORT=9040
DNSPORT=5354
SUDOBIN="$(command -v sudo)"
NOSETUPERROR=n
HOSTTORRC=n

# Functions
# ~~~~~~~~~
Expand Down Expand Up @@ -169,7 +170,8 @@ help_and_exit() {
print N " Enable Tor as an hidden service forwarding request from/to specified port."
print N " -d, --hiddendir <dir>"
print N " Specify where to search for hidden service 'hostname' and 'private_key'."
print N " -s, --shell Execute a shell."
print N " -s, --shell Execute a shell (using your current one)"
print N " --host-torrc Include your torrc host."
print N " -r, --routing <ip_host> <ip_ns> <netmask>"
print N " Set custom IPs. By default $IPHOSTDEFAULT/$IPNETNSDEFAULT/$NETMASKDEFAULT."
print N " --trans-port <port>"
Expand Down Expand Up @@ -311,7 +313,12 @@ while [[ $# -gt 0 ]]; do
[ "$TRANSPORT" ] || die "$key requires an argument."
;;

# DnsPort
# EnableHostTorrc
--host-torrc)
HOSTTORRC=y
;;

# DnsPort
--dns-port)
DNSPORT="$2"
shift
Expand Down Expand Up @@ -478,7 +485,7 @@ if ! ip netns list | eno grep -e \\b"$NAME"\\b; then

TORCONFIGFILE=$(mktemp /tmp/torXXXXXX)
chown "$USERNAME" "$TORCONFIGFILE"
if [ -f /etc/tor/torrc ]; then
if [ "$HOSTTORRC" = "y" ] && [ -f /etc/tor/torrc ]; then
echo '%include /etc/tor/torrc' >> "$TORCONFIGFILE"
fi

Expand Down

0 comments on commit 044cd9e

Please sign in to comment.