mirror of
				https://github.com/casjaysdevdocker/tor
				synced 2025-10-30 20:02:25 -04:00 
			
		
		
		
	🗃️ Update codebase 🗃️
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
This commit is contained in:
		| @@ -21,7 +21,8 @@ | |||||||
| # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | # shellcheck disable=SC1001,SC1003,SC2001,SC2003,SC2016,SC2031,SC2120,SC2155,SC2199,SC2317,SC2329 | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html | # setup debugging - https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html | ||||||
| [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || DEBUGGER_OPTIONS="${DEBUGGER_OPTIONS:-}" | [ -f "/config/.debug" ] && [ -z "$DEBUGGER_OPTIONS" ] && export DEBUGGER_OPTIONS="$(<"/config/.debug")" || true | ||||||
|  | { [ "$DEBUGGER" = "on" ] || [ -f "/config/.debug" ]; } && set -xo pipefail -x$DEBUGGER_OPTIONS && export DEBUGGER="on" || set -o pipefail | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| __remove_extra_spaces() { sed 's/\( \)*/\1/g;s|^ ||g'; } | __remove_extra_spaces() { sed 's/\( \)*/\1/g;s|^ ||g'; } | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| @@ -633,7 +634,9 @@ __create_service_user() { | |||||||
| 	local random_id="$(__generate_random_uids)" | 	local random_id="$(__generate_random_uids)" | ||||||
| 	local create_home_dir="${create_home_dir:-/home/$create_user}" | 	local create_home_dir="${create_home_dir:-/home/$create_user}" | ||||||
| 	grep -shq "^$create_user:" "/etc/passwd" && grep -shq "^$create_group:" "/etc/group" && return | 	grep -shq "^$create_user:" "/etc/passwd" && grep -shq "^$create_group:" "/etc/group" && return | ||||||
| 	[ "$create_user" = "root" ] && [ "$create_group" = "root" ] && return 0 | 	if [ "$create_user" = "root" ] && [ "$create_group" = "root" ]; then | ||||||
|  | 		return 0 | ||||||
|  | 	fi | ||||||
| 	if [ "$RUNAS_USER" != "root" ] && [ "$RUNAS_USER" != "" ]; then | 	if [ "$RUNAS_USER" != "root" ] && [ "$RUNAS_USER" != "" ]; then | ||||||
| 		create_user="$RUNAS_USER" | 		create_user="$RUNAS_USER" | ||||||
| 		create_group="$RUNAS_USER" | 		create_group="$RUNAS_USER" | ||||||
| @@ -652,17 +655,17 @@ __create_service_user() { | |||||||
| 			break | 			break | ||||||
| 		fi | 		fi | ||||||
| 	done | 	done | ||||||
| 	if ! __check_for_group "$create_group"; then | 	if [ -n "$create_group" ] && ! __check_for_group "$create_group"; then | ||||||
| 		echo "creating system group $create_group" | 		echo "creating system group $create_group" | ||||||
| 		groupadd --force --system -g $create_gid $create_group 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null | 		groupadd --force --system -g $create_gid $create_group 2>/dev/stderr | tee -a "/data/logs/init.txt" >/dev/null | ||||||
|  | 		grep -shq "$create_group" "/etc/group" || exitStatus=$((exitStatus + 1)) | ||||||
| 	fi | 	fi | ||||||
| 	if ! __check_for_user "$create_user"; then | 	if [ -n "$create_user" ] && ! __check_for_user "$create_user"; then | ||||||
| 		echo "creating system user $create_user" | 		echo "creating system user $create_user" | ||||||
| 		useradd --system -u $create_uid -g $create_group -c "Account for $create_user" -d "$create_home_dir" -s /bin/false $create_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null | 		useradd --system --uid $create_uid --gid $create_group --comment "Account for $create_user" --home-dir "$create_home_dir" --shell /bin/false $create_user 2>/dev/stderr | tee -a "/data/logs/init.txt" >/dev/null | ||||||
|  | 		grep -shq "$create_user" "/etc/passwd" || exitStatus=$((exitStatus + 1)) | ||||||
| 	fi | 	fi | ||||||
| 	grep -shq "$create_group" "/etc/group" || exitStatus=$((exitStatus + 1)) | 	if [ $exitStatus -eq 0 ] && [ -n "$create_group" ] && [ -n "$create_user" ]; then | ||||||
| 	grep -shq "$create_user" "/etc/passwd" || exitStatus=$((exitCode + 1)) |  | ||||||
| 	if [ $exitStatus -eq 0 ]; then |  | ||||||
| 		export WORK_DIR="${create_home_dir:-}" | 		export WORK_DIR="${create_home_dir:-}" | ||||||
| 		if [ -n "$WORK_DIR" ]; then | 		if [ -n "$WORK_DIR" ]; then | ||||||
| 			[ -d "$WORK_DIR" ] || mkdir -p "$WORK_DIR" | 			[ -d "$WORK_DIR" ] || mkdir -p "$WORK_DIR" | ||||||
| @@ -673,6 +676,7 @@ __create_service_user() { | |||||||
| 		elif [ -f "/etc/sudoers" ] && ! grep -qs "$create_user" "/etc/sudoers"; then | 		elif [ -f "/etc/sudoers" ] && ! grep -qs "$create_user" "/etc/sudoers"; then | ||||||
| 			echo "$create_user ALL=(ALL)   NOPASSWD: ALL" >"/etc/sudoers" | 			echo "$create_user ALL=(ALL)   NOPASSWD: ALL" >"/etc/sudoers" | ||||||
| 		fi | 		fi | ||||||
|  | 		exitStatus=0 | ||||||
| 		export SERVICE_UID="$create_uid" | 		export SERVICE_UID="$create_uid" | ||||||
| 		export SERVICE_GID="$create_gid" | 		export SERVICE_GID="$create_gid" | ||||||
| 		export SERVICE_USER="$create_user" | 		export SERVICE_USER="$create_user" | ||||||
|   | |||||||
| @@ -194,7 +194,7 @@ TOR_DNS_ENABLED="${TOR_DNS_ENABLED:-yes}" | |||||||
| TOR_RELAY_ENABLED="${TOR_RELAY_ENABLED:-yes}" | TOR_RELAY_ENABLED="${TOR_RELAY_ENABLED:-yes}" | ||||||
| TOR_BRIDGE_ENABLED="${TOR_BRIDGE_ENABLED:-yes}" | TOR_BRIDGE_ENABLED="${TOR_BRIDGE_ENABLED:-yes}" | ||||||
| TOR_HIDDEN_ENABLED="${TOR_HIDDEN_ENABLED:-yes}" | TOR_HIDDEN_ENABLED="${TOR_HIDDEN_ENABLED:-yes}" | ||||||
| RANDOM_NICK="$(head -n50 '/dev/random' | tr -dc 'a-zA-Z' | tr -d '[:space:]\042\047\134' | fold -w "32" | sed 's| ||g' | head -n 1)" | RANDOM_NICK="$(head -n50 '/dev/random' | tr -dc 'a-zA-Z' | tr -d '[:space:]\042\047\134' | fold -w "18" | sed 's| ||g' | head -n 1)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom commands to run before copying to /config | # Custom commands to run before copying to /config | ||||||
| __run_precopy() { | __run_precopy() { | ||||||
|   | |||||||
| @@ -194,7 +194,7 @@ TOR_DNS_ENABLED="${TOR_DNS_ENABLED:-yes}" | |||||||
| TOR_RELAY_ENABLED="${TOR_RELAY_ENABLED:-yes}" | TOR_RELAY_ENABLED="${TOR_RELAY_ENABLED:-yes}" | ||||||
| TOR_BRIDGE_ENABLED="${TOR_BRIDGE_ENABLED:-yes}" | TOR_BRIDGE_ENABLED="${TOR_BRIDGE_ENABLED:-yes}" | ||||||
| TOR_HIDDEN_ENABLED="${TOR_HIDDEN_ENABLED:-yes}" | TOR_HIDDEN_ENABLED="${TOR_HIDDEN_ENABLED:-yes}" | ||||||
| RANDOM_NICK="$(head -n50 '/dev/random' | tr -dc 'a-zA-Z' | tr -d '[:space:]\042\047\134' | fold -w "32" | sed 's| ||g' | head -n 1)" | RANDOM_NICK="$(head -n50 '/dev/random' | tr -dc 'a-zA-Z' | tr -d '[:space:]\042\047\134' | fold -w "18" | sed 's| ||g' | head -n 1)" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Custom commands to run before copying to /config | # Custom commands to run before copying to /config | ||||||
| __run_precopy() { | __run_precopy() { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user