Tor docker: parameterized hostname and added command for onion hostname output
This commit is contained in:
parent
ab0521b401
commit
cbe45426ce
|
@ -11,10 +11,9 @@ RUN apk add --no-cache curl tor && \
|
||||||
HEALTHCHECK --interval=60s --timeout=15s --start-period=20s \
|
HEALTHCHECK --interval=60s --timeout=15s --start-period=20s \
|
||||||
CMD curl -s --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
|
CMD curl -s --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
|
||||||
|
|
||||||
COPY tor.sh /usr/bin/
|
COPY tor.sh /usr/local/bin/
|
||||||
|
COPY svc-hostname /usr/local/bin/
|
||||||
#VOLUME ["/var/lib/tor/svc"]
|
|
||||||
|
|
||||||
#USER tor
|
#USER tor
|
||||||
|
|
||||||
CMD ["tor.sh"]
|
CMD [ "tor.sh", "$SVC_HOST" ]
|
||||||
|
|
10
tor/svc-hostname
Executable file
10
tor/svc-hostname
Executable file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
while ! curl -s --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
|
||||||
|
do
|
||||||
|
sleep 0.5
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "*****"
|
||||||
|
echo "* Service Onion Hostname: $(cat /var/lib/tor/svc/hostname)"
|
||||||
|
echo "*****"
|
|
@ -1,5 +1,10 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
IP_BROKER=$(nslookup broker | awk '/^Address: / { print $2 }' | tail -n1 | sed -e 's/[[:space:]]//g')
|
HOSTNAME=$1
|
||||||
sed -i "s/broker/$IP_BROKER/g" /etc/tor/torrc
|
|
||||||
|
IP_BROKER=$(nslookup $HOSTNAME | awk '/^Address: / { print $2 }' | tail -n1 | sed -e 's/[[:space:]]//g')
|
||||||
|
sed -i "s/$HOSTNAME/$IP_BROKER/g" /etc/tor/torrc
|
||||||
|
|
||||||
|
/usr/local/bin/svc-hostname &
|
||||||
|
|
||||||
tor
|
tor
|
Loading…
Reference in New Issue
Block a user