From e735cfd9ca3ee89ef6b7739facb2604ef11fb2c5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 10 May 2018 00:03:51 +0800 Subject: [PATCH] Add test with mounted torrc, obfuscated bridge --- .travis.yml | 15 +++++++++++---- tests/secret_id_key | 15 +++++++++++++++ tests/torrc | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 4 deletions(-) create mode 100644 tests/secret_id_key create mode 100644 tests/torrc diff --git a/.travis.yml b/.travis.yml index bb69816..6b52ac7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,20 +13,27 @@ script: # Test running the container with the commands in the Readme - docker run -d --init --name=tor_relay_1 -p 9001:9001 --restart=always local-tor-server - - sleep 60 + - sleep 30 - docker logs tor_relay_1 - docker stop tor_relay_1 - docker rm tor_relay_1 - docker run -d --init --name=tor_relay_1 -p 9001:9001 -e TOR_NICKNAME=Tor4docker -e CONTACT_EMAIL=tor4@example.org --restart=always local-tor-server - - sleep 60 + - sleep 30 - docker logs tor_relay_1 - docker cp tor_relay_1:/var/lib/tor/keys/secret_id_key ./ - cat secret_id_key - docker stop tor_relay_1 - docker rm tor_relay_1 - # Also test docker-compose file + - docker run -d --init --name=tor_relay_1 -p 9001:9001 -v $PWD/tests/torrc:/etc/tor/torrc -v $PWD/tests/secret_id_key:/var/lib/tor/keys/secret_id_key --restart=always local-tor-server + - sleep 30 + - docker logs tor_relay_1 + - docker stop tor_relay_1 + - docker rm tor_relay_1 + + # Also test docker-compose file (probably with the previous build on docker hub) + - docker-compose --version - docker-compose up -d - docker-compose logs - - docker-compose docker-compose exec -T relay cat /var/lib/tor/fingerprint + - docker-compose exec -T relay cat /var/lib/tor/fingerprint diff --git a/tests/secret_id_key b/tests/secret_id_key new file mode 100644 index 0000000..5d64f04 --- /dev/null +++ b/tests/secret_id_key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQC/+MYHaTVWjNaYy6MjTSbRKZwZsvvLLGdD/6pCaZwZvIbtCg5F +ygm0b8s1DFDu4qi8sIAqClqm3sxADFOCO7FB20bAErsa/0uxLhk92yTh0IpHMFGx +YbbCI3ZO0S+zur8QNT9CF626YgIz/0LQ1KZIMNbq1iW7vWMHlz2zETsg7wIDAQAB +AoGBAKcYDqZcuQSAyjls5q7PdL4SjcEAvZH3MFtLqhLsgecU5gxk+E9esFvSAvpF +ohyMRXsX1jbBlG4y9224TOfKtVmunGaVb1v1YRn3llWrH7K8QEkvu74xFLS/TD6G +OED/MOs/ytacdZEfQZW500qDYv+o7XzWk7GjkJOHoqwRhaPBAkEA7IJnXl4AGM+P +nFR/jOLkTcK4iUXauTgb5hhNnbQ+9vKY5yfupVpn0XZ3+XMvZySd7J7Pk5y9XR3Z +iCRmrzNPSQJBAM/KxIKmBBljqrHGHrbaOY6venm3NWZwleLjsitkTYIkoXNwGeF1 +rHpPbrXMc6P7LhlvyGEs2ZRoecsk6f4JFncCQD7yulZ4iGgSHnQKXWR/Iyq7L+iB +aiSwFWTZhRb7WWLa0O19SFxEQquSb346NRyrt0i6QB9WsWPuRO6iWZ459tkCQCtm +NlTzR7fl0SkAMDoQqiTbEcGKOmUC7stMs1HMyUN9UxtBNqaYZUXGgWEHKr/9HkvB +xSBGtcsBZy6+rwCX9VECQA1nc+PWg4tAGi+fjF7IwUUv4uM6L9uMugeiMGXIrXhD +2HOcuCjgbG6DYbRjfK0po1Limfvtzq3Ss549vZtTBpk= +-----END RSA PRIVATE KEY----- diff --git a/tests/torrc b/tests/torrc new file mode 100644 index 0000000..10d7786 --- /dev/null +++ b/tests/torrc @@ -0,0 +1,40 @@ +### /etc/torrc ### +# see /etc/torrc/torrc.default and https://www.torproject.org/docs/tor-manual.html.en + +# Server's public IP Address (usually automatic) +#Address 10.10.10.10 + +# Port to advertise for incoming Tor connections. +# common ports are 9001, 443 +ORPort 9001 + +# Mirror directory information for others (optional) +# common ports are 9030, 80 +DirPort 9030 + +# Run as a relay only (not as an exit node) +ExitPolicy reject *:* # no exits allowed + +# Set limits +RelayBandwidthRate 1024 KB # Throttle traffic to +RelayBandwidthBurst 2048 KB # But allow bursts up to +MaxMemInQueues 512 MB # Limit Memory usage to + +# Run Tor as obfuscated bridge +# https://trac.torproject.org/projects/tor/wiki/doc/PluggableTransports/obfs4proxy +ServerTransportPlugin obfs4 exec /usr/bin/obfs4proxy +ServerTransportListenAddr obfs4 0.0.0.0:54444 +ExtORPort auto +BridgeRelay 1 + +# Run Tor only as a server (no local applications) +SocksPort 0 + +# Run Tor as a regular user (do not change this) +User debian-tor +DataDirectory /var/lib/tor + +## If no Nickname or ContactInfo is set, docker-entrypoint will use +## the environment variables to add Nickname/ContactInfo here +Nickname Tor4tests # only use letters and numbers +ContactInfo tor4tests@example.org