docker-samples/onion-service/setup.sh
2025-05-01 11:51:09 -06:00

26 lines
490 B
Bash
Executable file

#!/bin/bash
usage() {
echo "Usage: $0 {init|show}"
exit 1
}
case "$1" in
init)
mkdir -p data/tor
chown 100:100 data/tor
echo "Initialized data/tor with ownership 100:100"
;;
show)
if [[ -f data/tor/hs_site/hostname ]]; then
tor_hostname=$(cat data/tor/hs_site/hostname)
echo "Your hidden service is http://$tor_hostname"
else
echo "Hostname file not found: data/tor/hs_site/hostname"
exit 1
fi
;;
*)
usage
;;
esac