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 19def2b..580d9b3 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 @@ -21,7 +21,7 @@ # shellcheck disable=SC1003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Exit if service is disabled -[ -z "$TOR_BRIDGE_ENABLED" ] || { [ "$TOR_BRIDGE_ENABLED" != "no" ] && [ "$TOR_BRIDGE_ENABLED" != "false" ]; } || exit 0 +if [ "$TOR_BRIDGE_ENABLED" != "yes" ]; then exit 0; fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # run trap command on exit trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM 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 0fa250a..495fc6f 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 @@ -21,7 +21,7 @@ # shellcheck disable=SC1003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Exit if service is disabled -[ -z "$TOR_RELAY_ENABLED" ] || { [ "$TOR_RELAY_ENABLED" != "no" ] && [ "$TOR_RELAY_ENABLED" != "false" ]; } || exit 0 +if [ "$TOR_RELAY_ENABLED" != "yes" ]; then exit 0; fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # run trap command on exit trap 'retVal=$?;[ "$SERVICE_IS_RUNNING" != "yes" ] && [ -f "$SERVICE_PID_FILE" ] && rm -Rf "$SERVICE_PID_FILE";exit $retVal' SIGINT SIGTERM 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 2701a57..93e0430 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 @@ -303,14 +303,6 @@ 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 cat <>"$CONF_DIR/server.conf" ##### include configurations @@ -364,7 +356,7 @@ __post_execute() { if pgrep unbound >/dev/null 2>&1; then break else - sleep 30 + sleep 10 fi done # show message @@ -373,7 +365,7 @@ __post_execute() { WWW_ROOT_DIR="/data/htdocs/www" fi if [ -d "$DATA_DIR/services" ]; then - echo "Begin current hidden services" + echo "Begin current hidden services"htdocs [ -f "$WWW_ROOT_DIR/hostnames.html" ] && rm -f "$WWW_ROOT_DIR/hostnames.html" for host in "$DATA_DIR/services"/*/hostname; do d="$(dirname -- $host)" diff --git a/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh b/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh index f59b9d5..725055d 100755 --- a/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh +++ b/rootfs/usr/local/etc/docker/init.d/zz-nginx.sh @@ -53,7 +53,7 @@ done printf '%s\n' "# - - - Initializing $SERVICE_NAME - - - #" # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Custom functions -__onion_site_dir_is_empty() { [ "$(ls -A "${1:-/data/htdocs/onions/$onion_site}" | wc -l)" -eq 0 ] || return 1; } +__onion_site_dir_is_empty() { [ "$(ls -A "/data/htdocs/onions/${1:-$onion_site}" 2>/dev/null | wc -l)" -eq 0 ] || return 1; } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # Script to execute START_SCRIPT="/usr/local/etc/docker/exec/$SERVICE_NAME" @@ -236,8 +236,9 @@ __run_pre_execute_checks() { __update_conf_files() { local exitCode=0 # default exit code local sysname="${SERVER_NAME:-${FULL_DOMAIN_NAME:-$HOSTNAME}}" # set hostname + local default_host="$DEFAULT_ONION_SITE" if [ -f "$WWW_ROOT_DIR/default_host.txt" ]; then - default_host="${DEFAULT_ONION_SITE:-$(<"$WWW_ROOT_DIR/default_host.txt")}" + default_host="${default_host:-$(<"$WWW_ROOT_DIR/default_host.txt")}" rm -Rf "$WWW_ROOT_DIR/default_host.txt" fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -253,7 +254,7 @@ __update_conf_files() { # replace variables recursively # __find_replace "" "" "$CONF_DIR" if [ -n "$default_host" ] && [ -f "$WWW_ROOT_DIR/index.html" ]; then - sed -i 's|imtulbcjer7mohs62lpycyod2c3pnil2x6xjirrojedbluh4d7z2g6ad|'$default_host'|g' "$WWW_ROOT_DIR/index.html" + sed -i 's|REPLACE_DEFAULT_TOR_ADDRESS|'$default_host'|g' "$WWW_ROOT_DIR/index.html" fi # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # define actions @@ -264,10 +265,10 @@ __update_conf_files() { echo "The tor server seems to have started " for site in "/run/tor/sites"/*; do onion_site="$(basename -- $site)" - __onion_site_dir_is_empty && NEW_SITE="yes" + __onion_site_dir_is_empty "$onion_site" && NEW_SITE="yes" [ -d "/data/htdocs/onions/$onion_site" ] || mkdir -p "/data/htdocs/onions/$onion_site" if [ "$default_host" = "$onion_site" ]; then - if __onion_site_dir_is_empty; then + if __onion_site_dir_is_empty "$onion_site"; then cp -Rfa "$WWW_ROOT_DIR/." "/data/htdocs/onions/$onion_site/" fi else @@ -285,7 +286,7 @@ __update_conf_files() { sed -i 's|REPLACE_ONION_SITE|'$onion_site.onion'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf" sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf" sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html" - sed -i 's|imtulbcjer7mohs62lpycyod2c3pnil2x6xjirrojedbluh4d7z2g6ad|'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html" + sed -i 's|REPLACE_DEFAULT_TOR_ADDRESS|'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html" fi unset NEW_SITE echo "Created $onion_site.onion in /data/htdocs/onions/$onion_site" diff --git a/rootfs/usr/share/httpd/default/index.html b/rootfs/usr/share/httpd/default/index.html index 7dd0121..76d15f8 100644 --- a/rootfs/usr/share/httpd/default/index.html +++ b/rootfs/usr/share/httpd/default/index.html @@ -14,7 +14,7 @@



Tor DNS is running on port 9053 and Tor Socks on 9050
- Server address is: imtulbcjer7mohs62lpycyod2c3pnil2x6xjirrojedbluh4d7z2g6ad.onion
+ Server address is: REPLACE_DEFAULT_TOR_ADDRESS

Other usefull onion sites
DuckDuckGo Search