mirror of
https://github.com/r3bo0tbx1/tor-guard-relay.git
synced 2026-04-05 16:22:01 +02:00
21 lines
472 B
Bash
21 lines
472 B
Bash
#!/bin/sh
|
|
# Validates Tor configuration regardless of source (mounted file or ENV vars) 🐋💚
|
|
|
|
set -e
|
|
|
|
TOR_CONFIG="${TOR_CONFIG:-/etc/tor/torrc}"
|
|
|
|
if [ ! -f "$TOR_CONFIG" ]; then
|
|
echo "ERROR: Config file not found: $TOR_CONFIG"
|
|
exit 1
|
|
fi
|
|
if [ ! -r "$TOR_CONFIG" ]; then
|
|
echo "ERROR: Config file not readable: $TOR_CONFIG"
|
|
exit 1
|
|
fi
|
|
if tor --verify-config -f "$TOR_CONFIG" >/dev/null 2>&1; then
|
|
exit 0
|
|
else
|
|
echo "ERROR: Invalid Tor configuration"
|
|
exit 1
|
|
fi |