handling and host sanitization.
This commit is contained in:
parent
824cf12529
commit
2182220c52
1 changed files with 13 additions and 3 deletions
|
|
@ -3,8 +3,15 @@ set -e
|
||||||
|
|
||||||
# --- Configuration ---
|
# --- Configuration ---
|
||||||
# Check if command is passed
|
# Check if command is passed
|
||||||
|
# If the first argument is 'vanguards', skip Tor setup and just run vanguards
|
||||||
|
if [ "$1" = "vanguards" ]; then
|
||||||
|
echo "Starting Vanguards Sidecar Mode..."
|
||||||
|
shift # remove 'vanguards' from the arguments
|
||||||
|
exec vanguards "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# If other arguments are passed, exec them (fallback)
|
||||||
if [ "$#" -gt 0 ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
# If arguments are passed (like 'vanguards ...'), run them
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
@ -57,8 +64,11 @@ if [ -n "$HIDDEN_SERVICE_HOSTS" ]; then
|
||||||
HOST=$(echo "$rule" | cut -d: -f2)
|
HOST=$(echo "$rule" | cut -d: -f2)
|
||||||
INT_PORT=$(echo "$rule" | cut -d: -f3)
|
INT_PORT=$(echo "$rule" | cut -d: -f3)
|
||||||
|
|
||||||
echo "Adding Hidden Service Rule: Onion:$EXT_PORT -> $HOST:$INT_PORT"
|
# Sanitize HOST (remove carriage returns)
|
||||||
echo "HiddenServicePort $EXT_PORT $HOST:$INT_PORT" >> "$TOR_CONFIG"
|
HOST_CLEAN=$(echo "$HOST" | tr -d '\r')
|
||||||
|
|
||||||
|
echo "Adding Hidden Service Rule: Onion:$EXT_PORT -> $HOST_CLEAN:$INT_PORT"
|
||||||
|
echo "HiddenServicePort $EXT_PORT $HOST_CLEAN:$INT_PORT" >> "$TOR_CONFIG"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo "Warning: HIDDEN_SERVICE_HOSTS is empty. Tor will run but host nothing."
|
echo "Warning: HIDDEN_SERVICE_HOSTS is empty. Tor will run but host nothing."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue