diff --git a/assets/entrypoint.sh b/assets/entrypoint.sh index c590370..5271f21 100755 --- a/assets/entrypoint.sh +++ b/assets/entrypoint.sh @@ -3,8 +3,15 @@ set -e # --- Configuration --- # 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 arguments are passed (like 'vanguards ...'), run them exec "$@" fi @@ -57,8 +64,11 @@ if [ -n "$HIDDEN_SERVICE_HOSTS" ]; then HOST=$(echo "$rule" | cut -d: -f2) INT_PORT=$(echo "$rule" | cut -d: -f3) - echo "Adding Hidden Service Rule: Onion:$EXT_PORT -> $HOST:$INT_PORT" - echo "HiddenServicePort $EXT_PORT $HOST:$INT_PORT" >> "$TOR_CONFIG" + # Sanitize HOST (remove carriage returns) + 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 else echo "Warning: HIDDEN_SERVICE_HOSTS is empty. Tor will run but host nothing."