This repository has been archived on 2021-09-23. You can view files and clone it, but cannot push or open issues or pull requests.
hidden-service/entrypoint.sh

24 lines
478 B
Bash
Raw Permalink Normal View History

2021-01-27 17:13:48 +00:00
#!/bin/bash
2021-01-27 22:32:19 +00:00
if [[ -z "${PRIVATE_KEY}" ]]; then
echo 'PRIVATE_KEY missing'
exit 1
fi
if [[ -z "${REDIRECT}" ]]; then
echo 'REDIRECT missing'
exit 1
fi
2021-01-27 17:13:48 +00:00
2021-01-27 22:32:19 +00:00
echo "Starting tor listener at port ${LISTEN_PORT:-80}, redirecting to ${REDIRECT}"
echo "${PRIVATE_KEY}" > /web/private_key
cat >> /etc/tor/torrc << EOF
Log notice stdout
2021-01-27 17:13:48 +00:00
DataDirectory /tmp/tor
HiddenServiceDir /web/
HiddenServicePort ${LISTEN_PORT:-80} ${REDIRECT}
2021-01-27 22:32:19 +00:00
HiddenServiceVersion 3
2021-01-27 17:13:48 +00:00
EOF
tor -f /etc/tor/torrc