Added existing project files
This commit is contained in:
parent
3d02504d7f
commit
ff20e94032
20
Dockerfile
Normal file
20
Dockerfile
Normal file
|
@ -0,0 +1,20 @@
|
|||
FROM alpine
|
||||
|
||||
ARG SVC_LISTEN_PORT
|
||||
ARG SVC_TARGET_HOST
|
||||
ARG SVC_TARGET_PORT
|
||||
|
||||
WORKDIR /etc/tor
|
||||
|
||||
RUN apk add --no-cache curl tor && \
|
||||
echo -e "HiddenServiceDir /var/lib/tor/svc/\nHiddenServicePort $SVC_LISTEN_PORT $SVC_TARGET_HOST:$SVC_TARGET_PORT" > ./torrc
|
||||
|
||||
HEALTHCHECK --interval=60s --timeout=15s --start-period=20s \
|
||||
CMD curl -s --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
|
||||
|
||||
COPY tor.sh /usr/local/bin/
|
||||
COPY svc-hostname /usr/local/bin/
|
||||
|
||||
#USER tor
|
||||
|
||||
CMD [ "tor.sh", "$SVC_TARGET_HOST" ]
|
26
README.md
26
README.md
|
@ -0,0 +1,26 @@
|
|||
Tor Proxy
|
||||
===========================
|
||||
|
||||
This is a Tor Proxy Docker container for "torifying" other Docker-based services in a Docker Compose project. It creates a Tor Hidden Service with an onion hostname that persists as long as it's underlying storage volume. The Tor Hidden Service listens on the specified port and proxies traffice to the specified target host:port.
|
||||
|
||||
### Example Usage
|
||||
|
||||
`docker-compose.yml`:
|
||||
```
|
||||
...
|
||||
|
||||
mysvc_tor_proxy:
|
||||
build:
|
||||
context: ./tor
|
||||
args:
|
||||
- SVC_LISTEN_PORT=80
|
||||
- SVC_TARGET_HOST=mysvc
|
||||
- SVC_TARGET_PORT=8080
|
||||
volumes:
|
||||
- mysvc_config:/var/lib/tor
|
||||
depends_on:
|
||||
- mysvc
|
||||
restart: unless-stopped
|
||||
|
||||
...
|
||||
```
|
8
svc-hostname
Executable file
8
svc-hostname
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/sh
|
||||
|
||||
while ! curl -s -N --socks5 127.0.0.1:9050 'https://check.torproject.org/' | grep -qm1 Congratulations
|
||||
do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
echo $(cat /var/lib/tor/svc/hostname)
|
Loading…
Reference in New Issue
Block a user