diff --git a/rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh b/rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh index f789362..6228d71 100755 --- a/rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh +++ b/rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh @@ -259,6 +259,7 @@ SocksTimeout ${TOR_SOCKS_TIMEOUT:-10} #### bridge LogMessageDomains 1 Log notice file $LOG_DIR/tor-bridge.log +#Log debug file $LOG_DIR/debug.log SOCKSPort 0 @@ -284,7 +285,9 @@ EOF else unset EXEC_CMD_BIN EXEC_CMD_ARGS fi - + if [ "$TOR_DEBUG" = "yes" ]; then + sed -i 's|#Log debug|Log debug|g' "$CONF_DIR/bridge.conf" + fi # allow custom functions if builtin type -t __update_conf_files_local | grep -q 'function'; then __update_conf_files_local; fi # exit function diff --git a/rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh b/rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh index 8ebc258..ad0211d 100755 --- a/rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh +++ b/rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh @@ -65,7 +65,7 @@ RESET_ENV="yes" WWW_ROOT_DIR="/usr/share/httpd/default" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Default predefined variables -DATA_DIR="/data/tor/relay" # set data directory +DATA_DIR="/data/tor/relay" # set data directory CONF_DIR="/config/tor/relay" # set config directory # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # set the containers etc directory @@ -75,7 +75,7 @@ ETC_DIR="/etc/tor/relay" VAR_DIR="" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - TMP_DIR="/tmp/tor" # set the temp dir -RUN_DIR="/run/tor/relay" # set scripts pid dir +RUN_DIR="/run/tor/relay" # set scripts pid dir LOG_DIR="/data/logs/tor" # set log directory # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Set the working dir @@ -259,6 +259,7 @@ SocksTimeout ${TOR_SOCKS_TIMEOUT:-10} ##### relay LogMessageDomains 1 Log notice file $LOG_DIR/tor-relay.log +#Log debug file $LOG_DIR/debug.log SOCKSPort 0 @@ -282,6 +283,9 @@ EOF else unset EXEC_CMD_BIN EXEC_CMD_ARGS fi + if [ "$TOR_DEBUG" = "yes" ]; then + sed -i 's|#Log debug|Log debug|g' "$CONF_DIR/relay.conf" + fi # allow custom functions if builtin type -t __update_conf_files_local | grep -q 'function'; then __update_conf_files_local; fi diff --git a/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh b/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh index f89062d..5ad3c6b 100755 --- a/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh +++ b/rootfs/usr/local/etc/docker/init.d/03-tor-server.sh @@ -265,6 +265,7 @@ SOCKSPort 0.0.0.0:9050 ##### logging LogMessageDomains 1 Log notice file $LOG_DIR/tor-server.log +#Log debug file $LOG_DIR/debug.log ##### port mappings TransPort 0.0.0.0:9040 @@ -281,7 +282,6 @@ EOF mkdir -p "$CONF_DIR/conf.d" cat <>"$CONF_DIR/server.conf" #### dns forwarder -LogMessageDomains 1 Log notice file $LOG_DIR/tor-dns.log DNSPort 8053 @@ -303,20 +303,23 @@ HiddenServicePort 80 127.0.0.1:80 EOF fi -# if [ -n "$TOR_HIDDEN_SERVERS" ]; then -# for hidden_server in $TOR_HIDDEN_SERVERS: do -# name="$(echo "$hidden_server"|awk -F: '{print $1}')" -# port="$(echo "$hidden_server"|awk -F: '{print $2}')" -# host="$(echo "$hidden_server"|awk -F: '{print $3":"$4}')" -# echo "" -# done -# fi + # if [ -n "$TOR_HIDDEN_SERVERS" ]; then + # for hidden_server in $TOR_HIDDEN_SERVERS: do + # name="$(echo "$hidden_server"|awk -F: '{print $1}')" + # port="$(echo "$hidden_server"|awk -F: '{print $2}')" + # host="$(echo "$hidden_server"|awk -F: '{print $3":"$4}')" + # echo "" + # done + # fi cat <>"$CONF_DIR/server.conf" ##### include configurations %include $CONF_DIR/conf.d/*.conf EOF + if [ "$TOR_DEBUG" = "yes" ]; then + sed -i 's|#Log debug|Log debug|g' "$CONF_DIR/server.conf" + fi # allow custom functions if builtin type -t __update_conf_files_local | grep -q 'function'; then __update_conf_files_local; fi @@ -358,7 +361,7 @@ __post_execute() { ( # commands to execute while :; do - if pgrep unbound >/dev/null 2>&1;then + if pgrep unbound >/dev/null 2>&1; then break else sleep 30 @@ -371,13 +374,11 @@ __post_execute() { fi if [ -d "$DATA_DIR/services" ]; then [ -f "$WWW_ROOT_DIR/hostnames.html" ] && rm -f "$WWW_ROOT_DIR/hostnames.html" - for d in "$DATA_DIR/services"/*;do - for host in "$d"/hostname; do - name="$(basename "$d")" - url="$(<"$host")" - echo "$name: $url" - echo ''$name'
' >>"$WWW_ROOT_DIR/hostnames.html" - done + for host in "$DATA_DIR/services"/*/hostname; do + name="$(basename "$d")" + url="$(<"$host")" + echo "$name: $url" + echo ''$name'
' >>"$WWW_ROOT_DIR/hostnames.html" done fi # show exit message