Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding tor hidden address by default #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ help:

up: ## Build and run the required containers by fetching binaries
docker-compose -f docker-compose.yaml up -d
docker-compose -f docker-compose.yaml exec tor cat /var/lib/tor/monero/hostname

up-full: ## Build and run the required containers by compiling source
docker-compose -f docker-compose.full.yaml up -d
Expand All @@ -29,3 +30,9 @@ logs: ## Get logs from the containers

logs-full: ## Get logs from the containers
docker-compose -f docker-compose.full.yaml logs -f monerod

tor: ## Get onion address for the Monero node
docker-compose -f docker-compose.yaml exec tor cat /var/lib/tor/monero/hostname

post: ## Post onion address to monero.fail
docker-compose -f docker-compose.yaml exec tor bash /post.sh
23 changes: 23 additions & 0 deletions docker-compose.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@ services:
PORT: 8080
ports:
- 127.0.0.1:8080:8080
tor:
container_name: tor
build:
context: dockerfiles
dockerfile: tor
restart: unless-stopped
ports:
- 127.0.0.1:9050:9050
volumes:
- tor:/var/lib/tor
networks:
monero:
ipv4_address: 172.96.0.15
monerod:
container_name: monerod
build:
Expand All @@ -62,10 +75,20 @@ services:
restart: unless-stopped
volumes:
- ${DATA_DIR:-./data}:/data
networks:
monero:
ipv4_address: 172.96.0.20
ports:
- ${P2P_PORT:-18080}:18080 # p2p
- ${RESTRICTED_PORT:-18081}:18081 # restricted rpc
- 127.0.0.1:${ZMQ_PORT:-18082}:18082 # zmq
- 127.0.0.1:${UNRESTRICTED_PORT:-18083}:18083 # unrestricted rpc
command:
monerod --data-dir=/data --p2p-bind-ip=0.0.0.0 --p2p-bind-port=18080 --rpc-restricted-bind-ip=0.0.0.0 --rpc-restricted-bind-port=18081 --zmq-rpc-bind-ip=0.0.0.0 --zmq-rpc-bind-port=18082 --rpc-bind-ip=0.0.0.0 --rpc-bind-port=18083 --non-interactive --confirm-external-bind --public-node --log-level=0 --enable-dns-blocklist
networks:
monero:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.96.0.0/16
26 changes: 25 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ version: '3'
volumes:
grafana:
prometheus:
tor:
services:
prometheus:
image: prom/prometheus:v2.18.0
Expand Down Expand Up @@ -54,6 +55,19 @@ services:
PORT: 8080
ports:
- 127.0.0.1:8080:8080
tor:
container_name: monerod_tor
build:
context: dockerfiles
dockerfile: tor
restart: unless-stopped
ports:
- 127.0.0.1:9051:9051
volumes:
- tor:/var/lib/tor
networks:
monero:
ipv4_address: 172.96.0.15
monerod:
container_name: monerod
build:
Expand All @@ -62,10 +76,20 @@ services:
restart: unless-stopped
volumes:
- ${DATA_DIR:-./data}:/data
networks:
monero:
ipv4_address: 172.96.0.20
ports:
- ${P2P_PORT:-18080}:18080 # p2p
- ${RESTRICTED_PORT:-18081}:18081 # restricted rpc
- 127.0.0.1:${ZMQ_PORT:-18082}:18082 # zmq
- 127.0.0.1:${UNRESTRICTED_PORT:-18083}:18083 # unrestricted rpc
command:
monerod --data-dir=/data --p2p-bind-ip=0.0.0.0 --p2p-bind-port=18080 --rpc-restricted-bind-ip=0.0.0.0 --rpc-restricted-bind-port=18081 --zmq-rpc-bind-ip=0.0.0.0 --zmq-rpc-bind-port=18082 --rpc-bind-ip=0.0.0.0 --rpc-bind-port=18083 --non-interactive --confirm-external-bind --public-node --log-level=0 --enable-dns-blocklist
monerod --data-dir=/data --p2p-bind-ip=0.0.0.0 --p2p-bind-port=18080 --rpc-restricted-bind-ip=0.0.0.0 --rpc-restricted-bind-port=18081 --zmq-rpc-bind-ip=0.0.0.0 --zmq-rpc-bind-port=18082 --rpc-bind-ip=0.0.0.0 --rpc-bind-port=18083 --non-interactive --confirm-external-bind --public-node --log-level=0 --enable-dns-blocklist --tx-proxy tor,172.96.0.15:9051
networks:
monero:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.96.0.0/16
6 changes: 6 additions & 0 deletions dockerfiles/conf/post.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

ONION_ADDR=$(cat /var/lib/tor/monero/hostname)
ONION_URL="http://${ONION_ADDR}:18081"

curl -q -X POST https://monero.fail/add -d node_url=${ONION_URL}
16 changes: 16 additions & 0 deletions dockerfiles/conf/torrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
BridgeRelay 1
ControlSocket /run/tor/control
ControlSocketsGroupWritable 1
CookieAuthentication 1
CookieAuthFileGroupReadable 1
CookieAuthFile /run/tor/control.authcookie
DataDirectory /var/lib/tor
ExitPolicy reject6 *:*, reject *:*
ExitRelay 0
IPv6Exit 0
Log notice stdout
ORPort 9001
PublishServerDescriptor 0
SOCKSPort 0.0.0.0:9051
HiddenServiceDir /var/lib/tor/monero
HiddenServicePort 18081 172.96.0.20:18081
17 changes: 17 additions & 0 deletions dockerfiles/tor
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM ubuntu:20.04

RUN apt-get update && apt-get install tor curl -y

RUN mkdir -p /run/tor \
&& chown -R debian-tor:debian-tor /run/tor \
&& chmod 700 -R /run/tor

COPY conf/torrc /etc/tor/torrc

COPY conf/post.sh /post.sh

USER debian-tor

EXPOSE 9050

ENTRYPOINT ["tor"]