Configuring Your Clearnet Synapse Server to Support Tor
This guide is for spinning up a new*, Tor-enabled, clearnet Synapse Matrix server.
- by Chris Guida and Aiden McClelland.
Why?
There is only one reason why someone would want to do this:
You want users on your clearnet (.com, .org, etc) Synapse server to be able to join rooms that are hosted on Tor (.onion) servers.
Limitation (IMPORTANT)
While enabling Tor on your clearnet Synapse server allows Tor users to join your public rooms, you should not let them. The underlying Matrix protocol does not support the presence of Tor users in clearnet rooms, even if the server itself if Tor-enabled. For this reason, if you enable Tor on your clearnet Synapse server, it is not recommended to have any public rooms at all, unless you are willing to manually remove Tor users who attempt to join.
Again, the purpose of enabling Tor on your clearnet Synapse server is NOT so Tor users can join your rooms, it is so your users can join Tor rooms.
Prerequisites (must be completed first)
- Reserve a domain name using your favorite registrar. This is how other Matrix servers will identify your server forever. Once you set it up, it cannot be changed. So make sure you like it!
- Use your own physical server or provision a VPS
- Point your domain at server’s IP address
Main Setup
- SSH into your server
ssh root@[hosname]
2. Download the setup script from Start9. You can view it here:
wget https://raw.githubusercontent.com/Start9Labs/synapse/update/1.47.1/setup-fresh-tor-matrix-with-clearnet-domain.sh
3. Make the setup script executable:
chmod a+x setup-fresh-tor-matrix-with-clearnet-domain.sh
4. Run the setup script and answer prompts. Heads up, you will need an email address to register with Let’s Encrypt for the SSL Cert. Make sure there are no errors along the way:
./setup-fresh-tor-matrix-with-clearnet-domain.sh
5. Launch docker-compose:
docker-compose up -d
6. Test your site by visiting the hostname in a browser. You should see this:
7. Create an Admin user for your Synapse server:
docker exec -it synapse_synapse_clearnet_1 register_new_matrix_user http://localhost:8008 -c /data/homeserver.yaml --user [username]
Be sure to create a strong password and save it somewhere safe. When prompted. Type yes
to make user an admin
Using your new Tor-Enabled Synapse Matrix server
- Select a Matrix client such as Element
- Log in using the admin user credentials from above
- Join the Start9 Tor party room!
#tor-party:matrix.privacy34kn4ez3y3nijweec6w4g54i3g54sdv7r5mr6soma3w4begyd.onion
- Try joining a few times if it doesn’t work the first time
- Enjoy your day.
* It is also possible (and easy) to update an existing Matirx server to support Tor, but varies depending on your current setup. Please visit the Start9 Matrix server for help.