diff --git a/Dockerfile b/Dockerfile index 24750e6..306a4a9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -54,7 +54,7 @@ ARG PHP_SERVER ARG SHELL_OPTS ARG PATH -ARG PACK_LIST="tor torsocks privoxy php socat" +ARG PACK_LIST="tor torsocks lyrebird privoxy php socat" ENV ENV=~/.profile ENV SHELL="/bin/sh" diff --git a/rootfs/tmp/etc/tor/torrc b/rootfs/tmp/etc/tor/torrc index 3874dd4..91c1f06 100644 --- a/rootfs/tmp/etc/tor/torrc +++ b/rootfs/tmp/etc/tor/torrc @@ -10,7 +10,7 @@ DataDirectory /data/tor ControlSocket /run/tor/control.sock CookieAuthFile /run/tor/control.authcookie ##### logging -Log notice file /dev/sdout +Log notice file /data/logs/tor/notice.log ##### This section is just for location-hidden services HiddenServiceDir /data/tor/hidden_service/default @@ -25,15 +25,3 @@ HTTPTunnelPort 9080 DNSPort 9053 AutomapHostsOnResolve 1 AutomapHostsSuffixes .exit,.onion - -##### This section is just for relays -#Nickname whateveryouwant -#ContactInfo tor-admin@example.com -#ORPort 443 -#Exitpolicy accept *:* -#AccountingMax 1000 GBytes -#AccountingStart month 1 00:00 -#RelayBandwidthRate 5120 KBytes -#RelayBandwidthBurst 10240 KBytes -#DisableDebuggerAttachment 0 -#HardwareAccel 1 diff --git a/rootfs/usr/local/etc/docker/init.d/tor.sh b/rootfs/usr/local/etc/docker/init.d/tor.sh index 5009c08..5d408e8 100755 --- a/rootfs/usr/local/etc/docker/init.d/tor.sh +++ b/rootfs/usr/local/etc/docker/init.d/tor.sh @@ -168,7 +168,7 @@ CMD_ENV="" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Per Application Variables or imports - +RANDOM_NICK="$(head -n50 '/dev/random' | tr -dc 'a-zA-Z' | tr -d '[:space:]\042\047\134' | fold -w "32" | sed 's| ||g' | head -n 1)" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Custom commands to run before copying to /config __run_precopy() { @@ -235,7 +235,21 @@ __update_conf_files() { # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # define actions - + if [ "$TOR_BRIDGE" = "enabled" ] && ! grep -sq 'BridgeRelay' '/config/tor/torrc'; then + cat <>/config/tor/torrc +BridgeRelay 1 +ExtORPort auto +Nickname ${TOR_NICK_NAME:-$RANDOM_NICK} +ServerTransportPlugin obfs4 exec /usr/bin/lyrebird +ORPort ${TOR_OR_PORT:-8444} +ServerTransportListenAddr obfs4 0.0.0.0:${TOR_PT_PORT:-8445} +ContactInfo ${TOR_ADMIN:-tor-admin@$HOSTNAME} +Exitpolicy accept *:* +AccountingMax ${TOR_ACCOUNT_MAX:-1000} GBytes +AccountingStart month 1 00:00 +AddressDisableIPv6 0 +EOF + fi # allow custom functions if builtin type -t __update_conf_files_local | grep -q 'function'; then __update_conf_files_local; fi # exit function