mirror of
https://github.com/casjaysdevdocker/tor
synced 2025-11-24 11:47:03 -05:00
🗃️ Update codebase 🗃️
All checks were successful
release-tag / release-image (push) Successful in 5m30s
All checks were successful
release-tag / release-image (push) Successful in 5m30s
rootfs/tmp/etc/nginx/vhosts.d/template rootfs/usr/local/etc/docker/init.d/03-tor-server.sh rootfs/usr/local/etc/docker/init.d/zz-nginx.sh
This commit is contained in:
@@ -191,6 +191,7 @@ CMD_ENV=""
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Per Application Variables or imports
|
||||
TOR_DNS_ENABLED="${TOR_DNS_ENABLED:-yes}"
|
||||
TOR_HIDDEN_IP="${TOR_HIDDEN_IP:-127.0.0.1}"
|
||||
TOR_RELAY_ENABLED="${TOR_RELAY_ENABLED:-yes}"
|
||||
TOR_BRIDGE_ENABLED="${TOR_BRIDGE_ENABLED:-yes}"
|
||||
TOR_HIDDEN_ENABLED="${TOR_HIDDEN_ENABLED:-yes}"
|
||||
@@ -282,7 +283,7 @@ HashedControlPassword 16:C30604D1D90F341360A14D9A1048C1DF4A3CA2411444E52EE5B954C
|
||||
##### bandwidth and accounting (monitoring only)
|
||||
Nickname ${TOR_SERVER_NICK_NAME:-$RANDOM_NICK}
|
||||
ContactInfo ${TOR_SERVER_ADMIN:-tor-admin@$HOSTNAME}
|
||||
AccountingMax ${TOR_SERVER_ACCOUNT_MAX:-250 GBytes}
|
||||
AccountingMax ${TOR_SERVER_ACCOUNT_MAX:-500 GBytes}
|
||||
AccountingStart month 1 00:00
|
||||
|
||||
##### directiories and files
|
||||
@@ -333,6 +334,11 @@ EOF
|
||||
mkdir -p "$CONF_DIR/hidden.d"
|
||||
mkdir -p "$TOR_HIDDEN_SERVICE_DIR/default"
|
||||
chmod -f 700 "$TOR_HIDDEN_SERVICE_DIR/default"
|
||||
if ! grep -shq "" ""; then
|
||||
cat <<EOF >>"$CONF_DIR/server.conf"
|
||||
%include $CONF_DIR/hidden.d/*.conf
|
||||
EOF
|
||||
fi
|
||||
for HiddenService in $CONF_DIR/hidden.d/*.conf; do
|
||||
HiddenServiceDir="$(grep -si '^HiddenServiceDir ' "$HiddenService" | awk '{print $2}' 2>/dev/null)"
|
||||
if [ -n "$HiddenServiceDir" ]; then
|
||||
@@ -340,11 +346,10 @@ EOF
|
||||
chmod 700 "$HiddenServiceDir" 2>/dev/null
|
||||
fi
|
||||
done
|
||||
cat <<EOF >>"$CONF_DIR/server.conf"
|
||||
cat <<EOF >"$CONF_DIR/hidden.d/default.conf"
|
||||
#### hidden services
|
||||
HiddenServiceDir $TOR_HIDDEN_SERVICE_DIR/default
|
||||
HiddenServicePort ${TOR_HIDDEN_SERVICE_PORT:-80 127.0.0.1:80}
|
||||
%include $CONF_DIR/hidden.d/*.conf
|
||||
HiddenServicePort ${TOR_HIDDEN_SERVICE_PORT:-80 $TOR_HIDDEN_IP:80}
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
@@ -171,7 +171,8 @@ user_pass="${NGINX_USER_PASS_WORD:-}" # normal user password
|
||||
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Additional variables
|
||||
TOR_HIDDEN_SERVICE_DIR="${TOR_HIDDEN_SERVICE_DIR:-$DATA_DIR/hidden}"
|
||||
TOR_HIDDEN_IP="${TOR_HIDDEN_IP:-}"
|
||||
TOR_HIDDEN_SERVICE_DIR="${TOR_HIDDEN_SERVICE_DIR:-/data/tor/server/hidden}"
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Specifiy custom directories to be created
|
||||
ADD_APPLICATION_FILES=""
|
||||
@@ -279,12 +280,9 @@ __update_conf_files() {
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# define actions
|
||||
while :; do
|
||||
sleep 30
|
||||
echo "The nginx server is waiting for tor to start"
|
||||
sites="$(ls -A /run/tor/sites/* 2>/dev/null | wc -l)"
|
||||
if [ ! -f "/tmp/init_tor_services" ]; then break; fi
|
||||
[ -d "/run/tor/sites" ] && sites="$(ls -A /run/tor/sites/* 2>/dev/null | wc -l)"
|
||||
if [ ! -f "/tmp/init_tor_services" ]; then echo "The tor server seems to have started" && break; else echo "The nginx server is waiting for tor to start" && sleep 30; fi
|
||||
done
|
||||
echo "The tor server seems to have started"
|
||||
if [ "$sites" -eq 0 ]; then
|
||||
echo "No onion sites found in /run/tor/sites" >&2
|
||||
else
|
||||
@@ -307,8 +305,8 @@ __update_conf_files() {
|
||||
cp -Rf "/config/nginx/vhosts.d/template" "/config/nginx/vhosts.d/$onion_site.onion.conf"
|
||||
fi
|
||||
if [ -f "/config/nginx/vhosts.d/$onion_site.onion.conf" ]; then
|
||||
sed -i 's|REPLACE_ONION_PORT|'$SERVICE_PORT'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf"
|
||||
sed -i 's|REPLACE_ONION_SITE|'$onion_site.onion'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf"
|
||||
sed -i 's|REPLACE_ONION_PORT|'$TOR_HIDDEN_IP:$SERVICE_PORT'|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"
|
||||
fi
|
||||
if [ -f "/data/htdocs/onions/$onion_site/index.html" ]; then
|
||||
@@ -316,6 +314,9 @@ __update_conf_files() {
|
||||
sed -i 's|REPLACE_DEFAULT_TOR_ADDRESS|'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html"
|
||||
sed -i 's|REPLACE_ONION_WWW_DIR|/data/htdocs/onions/'$onion_site'|g' "/data/htdocs/onions/$onion_site/index.html"
|
||||
fi
|
||||
if [ "$TOR_HIDDEN_IP" = "0.0.0.0" ] || [ -z "$TOR_HIDDEN_IP" ]; then
|
||||
sed -i 's|'$TOR_HIDDEN_IP:$SERVICE_PORT'|'$SERVICE_PORT'|g' "/config/nginx/vhosts.d/$onion_site.onion.conf"
|
||||
fi
|
||||
echo "Created $onion_site.onion in /data/htdocs/onions/$onion_site"
|
||||
done
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user