Running A TOR socks proxy in Kubernetes for fun ;-)

Philippe Bogaerts
2 min readMay 26, 2021

1. Lets create a TOR socks proxy image

This should be easy via this Dockerfile

FROM ubuntu ENV DEBIAN_FRONTEND=noninteractive 
RUN apt-get update
RUN apt-get install -y bash curl privoxy tor tzdata vim net-tools
COPY config /etc/privoxy/config
CMD [ "/"]

and some (probably to enhance) script to run the proxies in the container/pod. See for a maintained version of this code.

sed -i 's/TorAddress' /etc/tor/torsocks.conf
sed -i 's/#SOCKSPort 9050/SOCKSPort' /etc/tor/torrc service privoxy start
service tor start
/bin/bash -c "trap : TERM INT; sleep infinity & wait"

Feel free to use a pre-build image `xxradar/torproxy:0.1' or build it yourself!

docker build --no-cache -t xxradar/torproxy:0.1 .

We need to modify some listeners in the config file, so better to test if things are working fine.

2. A simple test from within the container

docker run -it -p 9050:9050 xxradar/torproxy:0.1 bash ./ 
* Starting filtering proxy server privoxy [ OK ]
* Starting



Philippe Bogaerts

#BruCON co-founder, #OWASP supporter, Application Delivery and Web Application Security, #Kubernetes and #container, #pentesting enthousiast, BBQ & cocktails !!