Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ok how to serve your mastodon instance over a .onion address as well as clear text.
- First install tor via your distros package manager.
- For debian based use
- apt-get install tor -y
- for RHEL based
- yum -y install tor
- Next this step is optional and you can skip it if you do not wish to have a custom .onion address.
- git clone
- https://github.com/katmagic/Shallot.git
- cd Shallot
- ./configure && make
- ./shallot ^foo
- where foo is the word you want a custom address for, the more letters it is the longer it will take and i dont recommend anything over 6 letters as 7 letters will take a whole day. But if you need 7 and you have the time dont let me stop you.
- When its done it will spit out a private key. Save this in a text file for now.
- Next edit your tor config file.
- nano /etc/tor/torrc
- and add these lines to the bottom
- HiddenServiceDir /var/lib/tor/domain.com/
- HiddenServicePort 80 xxx.xxx.xxx.xxx:80
- HiddenServicePort 443 xxx.xxx.xxx.xxx:443
- replace the x'es with your servers IP address and domain.com with your instance domain name.
- then save and close the file.
- run the following command
- service tor restart
- or whatever command your distro used to restart a running service.
- next
- cd /var/lib/tor/domain.com/ replacing domain.com with your instance domain name you selected in the tor config
- If you created a private key for a custom .onion address you will want to
- nano private_key
- and replace the one there with the one you created and saved then run
- service tor restart
- otherwise if you did not want a custom .onion run
- cat hostname
- to get your .onion address
- Next go to your mastodon instance config for nginx, on my vps its located in /etc/nginx/conf.d but other distros may be different.
- Find the area that says
- server {
- # redirect from http to https
- listen 80;
- listen [::]:80;
- server_name mastodon.starrevolution.org www.mastodon.starrevolution.org;
- return 301 https://$server_name$request_uri;
- }
- server {
- listen 443 ssl;
- listen [::]:443 ssl;
- server_name mastodon.starrevolution.org www.mastodon.starrevolution.org;
- and change it to
- server {
- # redirect from http to https
- listen 80;
- listen [::]:80;
- server_name mastodon.starrevolution.org www.mastodon.starrevolution.org xxxxxxxxx.onion www.xxxxxxxxx.onion;
- return 301 https://$server_name$request_uri;
- }
- server {
- listen 443 ssl;
- listen [::]:443 ssl;
- server_name mastodon.starrevolution.org www.mastodon.starrevolution.org xxxxxxxxx.onion www.xxxxxxxxx.onion;
- Replacing the x;es of course with the .onion address you either created before or the one you discovered via cat hostname and please dont edit your config to match my domain names, leave the ones you have there already im just using mine as an example.
- Finally run.
- nginx -t
- service nginx reload
- now open torbrowser and navigate to your new .onion address.
- Mine is https://www.starrev3tah2dnhj.onion
- You may get a certificate warning, add an exception.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement