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 rootfs/usr/local/etc/docker/init.d/03-tor-server.sh rootfs/usr/local/etc/docker/init.d/zz-nginx.sh rootfs/usr/share/httpd/default/hidden_service.html rootfs/usr/share/httpd/default/hidden_services.html
This commit is contained in:
		| @@ -614,10 +614,10 @@ __set_user_group_id() { | |||||||
| 	[ -n "$set_user" ] && [ "$set_user" != "root" ] || return | 	[ -n "$set_user" ] && [ "$set_user" != "root" ] || return | ||||||
| 	if grep -shq "^$set_user:" "/etc/passwd" "/etc/group"; then | 	if grep -shq "^$set_user:" "/etc/passwd" "/etc/group"; then | ||||||
| 		if __check_for_guid "$set_gid"; then | 		if __check_for_guid "$set_gid"; then | ||||||
| 			groupmod -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null && chown -Rf ":$set_gid" | 			groupmod -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null | ||||||
| 		fi | 		fi | ||||||
| 		if __check_for_uid "$set_uid"; then | 		if __check_for_uid "$set_uid"; then | ||||||
| 			usermod -u "${set_uid}" -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null && chown -Rf $set_uid:$set_gid | 			usermod -u "${set_uid}" -g "${set_gid}" $set_user 2>/dev/stderr | tee -p -a "/data/logs/init.txt" >/dev/null | ||||||
| 		fi | 		fi | ||||||
| 	fi | 	fi | ||||||
| 	export SERVICE_UID="$set_uid" | 	export SERVICE_UID="$set_uid" | ||||||
|   | |||||||
| @@ -285,8 +285,8 @@ SocksTimeout ${TOR_SOCKS_TIMEOUT:-10} | |||||||
|  |  | ||||||
| ##### logging | ##### logging | ||||||
| LogMessageDomains 1 | LogMessageDomains 1 | ||||||
| Log notice file $LOG_DIR/bridge.log | Log notice file $LOG_DIR/$SERVICE_NAME.log | ||||||
| #Log debug file $LOG_DIR/bridge.debug | #Log debug file $LOG_DIR/$SERVICE_NAME.debug | ||||||
|  |  | ||||||
| ##### Bridge Settings | ##### Bridge Settings | ||||||
| BridgeRelay 1 | BridgeRelay 1 | ||||||
|   | |||||||
| @@ -285,8 +285,8 @@ SocksTimeout ${TOR_SOCKS_TIMEOUT:-10} | |||||||
|  |  | ||||||
| ##### logging | ##### logging | ||||||
| LogMessageDomains 1 | LogMessageDomains 1 | ||||||
| Log notice file $LOG_DIR/relay.log | Log notice file $LOG_DIR/$SERVICE_NAME.log | ||||||
| #Log debug file $LOG_DIR/relay.debug | #Log debug file $LOG_DIR/$SERVICE_NAME.debug | ||||||
|  |  | ||||||
| ##### Relay Settings | ##### Relay Settings | ||||||
| ServerTransportPlugin obfs4 exec /usr/bin/lyrebird | ServerTransportPlugin obfs4 exec /usr/bin/lyrebird | ||||||
|   | |||||||
| @@ -168,7 +168,7 @@ user_pass="${TOR_USER_PASS_WORD:-}" # normal user password | |||||||
| [ -f "/config/env/tor.sh" ] && . "/config/env/tor.sh"               # Overwrite the variabes | [ -f "/config/env/tor.sh" ] && . "/config/env/tor.sh"               # Overwrite the variabes | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Additional predefined variables | # Additional predefined variables | ||||||
| TOR_HIDDEN_SERVICE_DIR="${TOR_HIDDEN_SERVICE_DIR:-$DATA_DIR/hidden_service}" | TOR_HIDDEN_SERVICE_DIR="${TOR_HIDDEN_SERVICE_DIR:-$DATA_DIR/hidden}" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Additional variables | # Additional variables | ||||||
| TOR_HIDDEN_SERVERS="${TOR_HIDDEN_SERVERS//,/ }" | TOR_HIDDEN_SERVERS="${TOR_HIDDEN_SERVERS//,/ }" | ||||||
| @@ -254,8 +254,9 @@ __update_conf_files() { | |||||||
| 	# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 	# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| 	# custom commands | 	# custom commands | ||||||
| 	chmod 600 $RUN_DIR | 	chmod 600 $RUN_DIR | ||||||
| 	chown -Rf ${SERVICE_USER:-$RUNAS_USER}:${SERVICE_GROUP:-$RUNAS_USER} $RUN_DIR |  | ||||||
| 	mkdir -p "/run/tor/sites" && chmod 777 "/run/tor/sites" | 	mkdir -p "/run/tor/sites" && chmod 777 "/run/tor/sites" | ||||||
|  | 	chown -Rf ${SERVICE_USER:-$RUNAS_USER}:${SERVICE_GROUP:-$RUNAS_USER} $RUN_DIR | ||||||
|  | 	[ -d "$TOR_HIDDEN_SERVICE_DIR" ] || { mkdir -p "$TOR_HIDDEN_SERVICE_DIR" && chmod -f 700 "$TOR_HIDDEN_SERVICE_DIR" 2>/dev/null; } | ||||||
| 	# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 	# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| 	# replace variables | 	# replace variables | ||||||
|  |  | ||||||
| @@ -292,7 +293,8 @@ SocksTimeout ${TOR_SOCKS_TIMEOUT:-10} | |||||||
|  |  | ||||||
| ##### logging | ##### logging | ||||||
| LogMessageDomains 1 | LogMessageDomains 1 | ||||||
| Log notice file $LOG_DIR/server.log | Log notice file $LOG_DIR/$SERVICE_NAME.log | ||||||
|  | #Log debug file $LOG_DIR/$SERVICE_NAME.debug | ||||||
|  |  | ||||||
| ##### port mappings | ##### port mappings | ||||||
| TransPort 0.0.0.0:9040 | TransPort 0.0.0.0:9040 | ||||||
| @@ -314,7 +316,7 @@ EOF | |||||||
| 		mkdir -p "$CONF_DIR/conf.d" | 		mkdir -p "$CONF_DIR/conf.d" | ||||||
| 		cat <<EOF >>"$CONF_DIR/server.conf" | 		cat <<EOF >>"$CONF_DIR/server.conf" | ||||||
| #### dns forwarder | #### dns forwarder | ||||||
| Log notice file $LOG_DIR/dns.log | Log notice file $LOG_DIR/tor-dns.log | ||||||
| DNSPort 0.0.0.0:8053 | DNSPort 0.0.0.0:8053 | ||||||
| DNSListenAddress 0.0.0.0,[::] | DNSListenAddress 0.0.0.0,[::] | ||||||
| AutomapHostsOnResolve 1 | AutomapHostsOnResolve 1 | ||||||
| @@ -325,8 +327,15 @@ EOF | |||||||
|  |  | ||||||
| 	if [ "$TOR_HIDDEN_ENABLED" = "yes" ]; then | 	if [ "$TOR_HIDDEN_ENABLED" = "yes" ]; then | ||||||
| 		mkdir -p "$CONF_DIR/hidden.d" | 		mkdir -p "$CONF_DIR/hidden.d" | ||||||
| 		mkdir -p "$TOR_HIDDEN_SERVICE_DIR" | 		mkdir -p "$TOR_HIDDEN_SERVICE_DIR/default" | ||||||
| 		chmod 700 "$TOR_HIDDEN_SERVICE_DIR" | 		chmod -f 700 "$TOR_HIDDEN_SERVICE_DIR/default" | ||||||
|  | 		for HiddenService in $CONF_DIR/hidden.d/*.conf; do | ||||||
|  | 			HiddenServiceDir="$(grep -si '^HiddenServiceDir ' "$HiddenService" | awk '{print $2}' 2>/dev/null)" | ||||||
|  | 			if [ -n "$HiddenServiceDir" ]; then | ||||||
|  | 				mkdir -p "$HiddenServiceDir" 2>/dev/null | ||||||
|  | 				chmod 700 "$HiddenServiceDir" 2>/dev/null | ||||||
|  | 			fi | ||||||
|  | 		done | ||||||
| 		cat <<EOF >>"$CONF_DIR/server.conf" | 		cat <<EOF >>"$CONF_DIR/server.conf" | ||||||
| #### hidden services | #### hidden services | ||||||
| HiddenServiceDir $TOR_HIDDEN_SERVICE_DIR/default | HiddenServiceDir $TOR_HIDDEN_SERVICE_DIR/default | ||||||
|   | |||||||
| @@ -171,7 +171,7 @@ user_pass="${NGINX_USER_PASS_WORD:-}" # normal user password | |||||||
|  |  | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Additional variables | # Additional variables | ||||||
|  | TOR_HIDDEN_SERVICE_DIR="${TOR_HIDDEN_SERVICE_DIR:-$DATA_DIR/hidden}" | ||||||
| # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| # Specifiy custom directories to be created | # Specifiy custom directories to be created | ||||||
| ADD_APPLICATION_FILES="" | ADD_APPLICATION_FILES="" | ||||||
| @@ -201,7 +201,7 @@ __run_precopy() { | |||||||
| 		mkdir -p "$WWW_ROOT_DIR" | 		mkdir -p "$WWW_ROOT_DIR" | ||||||
| 		if [ -d "/usr/share/httpd/default" ]; then | 		if [ -d "/usr/share/httpd/default" ]; then | ||||||
| 			cp -Rf "/usr/share/httpd/default/." "$WWW_ROOT_DIR/" | 			cp -Rf "/usr/share/httpd/default/." "$WWW_ROOT_DIR/" | ||||||
| 			[ -f "$WWW_ROOT_DIR/hidden_service.html" ] && rm -Rf "$WWW_ROOT_DIR/hidden_service.html" | 			[ -f "$WWW_ROOT_DIR/hidden_services.html" ] && rm -Rf "$WWW_ROOT_DIR/hidden_services.html" | ||||||
| 		else | 		else | ||||||
| 			echo "Welcome" >"$WWW_ROOT_DIR/index.php" | 			echo "Welcome" >"$WWW_ROOT_DIR/index.php" | ||||||
| 		fi | 		fi | ||||||
| @@ -281,10 +281,15 @@ __update_conf_files() { | |||||||
| 	# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 	# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||||
| 	# define actions | 	# define actions | ||||||
| 	while :; do | 	while :; do | ||||||
|  | 		sleep 30 | ||||||
| 		echo "waiting for tor to start" | 		echo "waiting for tor to start" | ||||||
| 		[ -f "/tmp/init_tor_services" ] && sleep 30 || break | 		sites="$(ls -A /run/tor/sites 2>/dev/null | wc -l)" | ||||||
|  | 		if [ ! -f "/tmp/init_tor_services" ]; then break; fi | ||||||
| 	done | 	done | ||||||
| 	echo "The tor server seems to have started                                    " | 	echo "The tor server seems to have started                                    " | ||||||
|  | 	if [ "$sites" -eq 0 ]; then | ||||||
|  | 		echo "No onion sites found in /run/tor/sites" >&2 | ||||||
|  | 	else | ||||||
| 		for site in "/run/tor/sites"/*; do | 		for site in "/run/tor/sites"/*; do | ||||||
| 			onion_site="$(basename -- $site)" | 			onion_site="$(basename -- $site)" | ||||||
| 			__onion_site_dir_is_empty "$onion_site" && NEW_SITE="yes" | 			__onion_site_dir_is_empty "$onion_site" && NEW_SITE="yes" | ||||||
| @@ -295,8 +300,8 @@ __update_conf_files() { | |||||||
| 				fi | 				fi | ||||||
| 			else | 			else | ||||||
| 				if [ "$NEW_SITE" = "yes" ]; then | 				if [ "$NEW_SITE" = "yes" ]; then | ||||||
| 				if [ -f "/usr/share/httpd/default/hidden_service.html" ]; then | 					if [ -f "/usr/share/httpd/default/hidden_services.html" ]; then | ||||||
| 					cp -Rf "/usr/share/httpd/default/hidden_service.html" "/data/htdocs/onions/$onion_site/index.html" | 						cp -Rf "/usr/share/httpd/default/hidden_services.html" "/data/htdocs/onions/$onion_site/index.html" | ||||||
| 					else | 					else | ||||||
| 						echo '<html><body><br /><center>HTML Document Root: /data/htdocs/onions/'$onion_site'</center><br /></body></html>' >"/data/htdocs/onions/$onion_site/index.html" | 						echo '<html><body><br /><center>HTML Document Root: /data/htdocs/onions/'$onion_site'</center><br /></body></html>' >"/data/htdocs/onions/$onion_site/index.html" | ||||||
| 					fi | 					fi | ||||||
| @@ -313,6 +318,7 @@ __update_conf_files() { | |||||||
| 			unset NEW_SITE | 			unset NEW_SITE | ||||||
| 			echo "Created $onion_site.onion in /data/htdocs/onions/$onion_site" | 			echo "Created $onion_site.onion in /data/htdocs/onions/$onion_site" | ||||||
| 		done | 		done | ||||||
|  | 	fi | ||||||
| 	# allow custom functions | 	# allow custom functions | ||||||
| 	if builtin type -t __update_conf_files_local | grep -q 'function'; then __update_conf_files_local; fi | 	if builtin type -t __update_conf_files_local | grep -q 'function'; then __update_conf_files_local; fi | ||||||
| 	# exit function | 	# exit function | ||||||
|   | |||||||
| @@ -1,4 +1,4 @@ | |||||||
| <!doctype html> | <!DOCTYPE html> | ||||||
| <html lang="en"> | <html lang="en"> | ||||||
|   <head> |   <head> | ||||||
|     <meta charset="utf-8" /> |     <meta charset="utf-8" /> | ||||||
		Reference in New Issue
	
	Block a user