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