mirror of
https://github.com/casjaysdevdocker/tor
synced 2025-10-30 14:02:32 -04:00
🗃️ Update codebase 🗃️
rootfs/usr/local/bin/entrypoint.sh rootfs/usr/local/etc/docker/functions/entrypoint.sh rootfs/usr/local/etc/docker/init.d/01-tor-bridge.sh rootfs/usr/local/etc/docker/init.d/02-tor-relay.sh rootfs/usr/local/etc/docker/init.d/03-tor-server.sh rootfs/usr/local/etc/docker/init.d/09-unbound.sh rootfs/usr/local/etc/docker/init.d/98-privoxy.sh rootfs/usr/local/etc/docker/init.d/zz-nginx.sh
This commit is contained in:
@@ -84,7 +84,7 @@ SERVICE_UID="${SERVICE_UID:-0}" # set the user id
|
||||
SERVICE_GID="${SERVICE_GID:-0}" # set the group id
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
SERVICE_USER="${SERVICE_USER:-$tor}" # execute command as another user
|
||||
SERVICE_USER="${SERVICE_USER:-tor}" # execute command as another user
|
||||
SERVICE_GROUP="${SERVICE_GROUP:-tor}" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Secondary ports
|
||||
|
||||
@@ -677,17 +677,18 @@ __create_service_user() {
|
||||
echo "$create_user ALL=(ALL) NOPASSWD: ALL" >"/etc/sudoers"
|
||||
fi
|
||||
exitStatus=0
|
||||
export SERVICE_UID="$create_uid"
|
||||
export SERVICE_GID="$create_gid"
|
||||
export SERVICE_USER="$create_user"
|
||||
export SERVICE_GROUP="$create_group"
|
||||
SERVICE_UID="$create_uid"
|
||||
SERVICE_GID="$create_gid"
|
||||
SERVICE_USER="$create_user"
|
||||
SERVICE_GROUP="$create_group"
|
||||
else
|
||||
export USER_UID=0
|
||||
export USER_GID=0
|
||||
export SERVICE_USER=root
|
||||
export SERVICE_GROUP=root
|
||||
SERVICE_UID=0
|
||||
SERVICE_GID=0
|
||||
SERVICE_USER=root
|
||||
SERVICE_GROUP=root
|
||||
exitStatus=2
|
||||
fi
|
||||
export SERVICE_UID SERVICE_GID SERVICE_USER SERVICE_GROUP
|
||||
return $exitStatus
|
||||
}
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -744,6 +745,7 @@ __start_init_scripts() {
|
||||
local retstatus="0"
|
||||
local initStatus="0"
|
||||
local critical_failures="0"
|
||||
local pidFile="/run/__start_init_scripts.pid"
|
||||
local init_dir="${1:-/usr/local/etc/docker/init.d}"
|
||||
local init_count="$(ls -A "$init_dir"/* 2>/dev/null | grep -v '\.sample' | wc -l)"
|
||||
local exit_on_failure="${EXIT_ON_SERVICE_FAILURE:-true}"
|
||||
@@ -754,7 +756,7 @@ __start_init_scripts() {
|
||||
rm -f /run/*.pid /run/init.d/*.pid 2>/dev/null || true
|
||||
fi
|
||||
|
||||
touch /run/__start_init_scripts.pid
|
||||
touch "$pidFile"
|
||||
|
||||
if [ "$init_count" -eq 0 ] || [ ! -d "$init_dir" ]; then
|
||||
mkdir -p "/data/logs/init"
|
||||
@@ -772,6 +774,7 @@ __start_init_scripts() {
|
||||
|
||||
for init in "$init_dir"/*.sh; do
|
||||
if [ -x "$init" ]; then
|
||||
touch "$pidFile"
|
||||
name="$(basename "$init")"
|
||||
service="$(printf '%s' "$name" | sed 's/^[^-]*-//;s|.sh$||g')"
|
||||
__service_banner "🔧" "Executing service script:" "$(basename "$init")"
|
||||
@@ -798,14 +801,19 @@ __start_init_scripts() {
|
||||
fi
|
||||
else
|
||||
# Service uses PID tracking - verify actual running processes
|
||||
set +e # Temporarily disable exit on error
|
||||
retPID=""
|
||||
|
||||
# First, try to find actual running process with various name patterns
|
||||
for name_variant in "$service" "${service//-*/}" "${service//-/_}"; do
|
||||
for name_variant in "$service" "${service}84" "${service}d" "$(echo "$service" | sed 's/-//g')" "$(echo "$service" | tr -d '-')"; do
|
||||
if [ -z "$retPID" ]; then
|
||||
retPID=$(__get_pid "$name_variant" 2>/dev/null || echo "")
|
||||
[ -n "$retPID" ] && found_process="$name_variant" && break
|
||||
fi
|
||||
done
|
||||
|
||||
set -e # Re-enable exit on error
|
||||
|
||||
if [ -n "$retPID" ] && [ "$retPID" != "0" ]; then
|
||||
# Found actual running process
|
||||
initStatus="0"
|
||||
|
||||
@@ -110,8 +110,8 @@ SERVICE_PORT=""
|
||||
RUNAS_USER="root" # normally root
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
#SERVICE_USER="tor" # execute command as another user
|
||||
#SERVICE_GROUP="tor" # Set the service group
|
||||
SERVICE_USER="root" # execute command as another user
|
||||
SERVICE_GROUP="root" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set password length
|
||||
RANDOM_PASS_USER=""
|
||||
|
||||
@@ -110,8 +110,8 @@ SERVICE_PORT=""
|
||||
RUNAS_USER="root" # normally root
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
#SERVICE_USER="tor" # execute command as another user
|
||||
#SERVICE_GROUP="tor" # Set the service group
|
||||
SERVICE_USER="root" # execute command as another user
|
||||
SERVICE_GROUP="root" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set password length
|
||||
RANDOM_PASS_USER=""
|
||||
|
||||
@@ -110,8 +110,8 @@ SERVICE_PORT=""
|
||||
RUNAS_USER="root" # normally root
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
#SERVICE_USER="tor" # execute command as another user
|
||||
#SERVICE_GROUP="tor" # Set the service group
|
||||
SERVICE_USER="root" # execute command as another user
|
||||
SERVICE_GROUP="root" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set password length
|
||||
RANDOM_PASS_USER=""
|
||||
@@ -389,7 +389,8 @@ __post_execute() {
|
||||
(
|
||||
# commands to execute
|
||||
while :; do
|
||||
if pgrep unbound >/dev/null 2>&1; then
|
||||
if __pgrep unbound >/dev/null 2>&1; then
|
||||
get_hidden_service_hostnames=$(find "$DATA_DIR/services" -iname 'hostname' 2>/dev/null | wc -l || echo "0")
|
||||
break
|
||||
else
|
||||
sleep 10
|
||||
@@ -400,8 +401,8 @@ __post_execute() {
|
||||
if [ -d "/data/htdocs/www" ]; then
|
||||
WWW_ROOT_DIR="/data/htdocs/www"
|
||||
fi
|
||||
if [ -d "$DATA_DIR/services" ]; then
|
||||
echo "Begin current hidden services"htdocs
|
||||
if [ -d "$DATA_DIR/services" ] && [ "$get_hidden_service_hostnames" -gt 0 ]; then
|
||||
echo "Begin current hidden services"
|
||||
[ -f "$WWW_ROOT_DIR/hostnames.html" ] && rm -f "$WWW_ROOT_DIR/hostnames.html"
|
||||
for host in "$DATA_DIR/services"/*/hostname; do
|
||||
d="$(dirname -- $host)"
|
||||
|
||||
@@ -110,8 +110,8 @@ SERVICE_PORT="9053"
|
||||
RUNAS_USER="root" # normally root
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
#SERVICE_USER="unbound" # execute command as another user
|
||||
#SERVICE_GROUP="unbound" # Set the service group
|
||||
SERVICE_USER="root" # execute command as another user
|
||||
SERVICE_GROUP="root" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set password length
|
||||
RANDOM_PASS_USER=""
|
||||
|
||||
@@ -112,8 +112,8 @@ SERVICE_PORT="8118"
|
||||
RUNAS_USER="root" # normally root
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
#SERVICE_USER="privoxy" # execute command as another user
|
||||
#SERVICE_GROUP="privoxy" # Set the service group
|
||||
SERVICE_USER="root" # execute command as another user
|
||||
SERVICE_GROUP="root" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set password length
|
||||
RANDOM_PASS_USER=""
|
||||
|
||||
@@ -110,8 +110,8 @@ SERVICE_PORT="80"
|
||||
RUNAS_USER="root" # normally root
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# User and group in which the service switches to - IE: nginx,apache,mysql,postgres
|
||||
#SERVICE_USER="nginx" # execute command as another user
|
||||
#SERVICE_GROUP="nginx" # Set the service group
|
||||
SERVICE_USER="root" # execute command as another user
|
||||
SERVICE_GROUP="root" # Set the service group
|
||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
# Set password length
|
||||
RANDOM_PASS_USER=""
|
||||
|
||||
Reference in New Issue
Block a user