-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add tor_hidden_service.md #190
Conversation
5da3b38
to
5ed6694
Compare
|
||
# Test connectivity over Tor | ||
|
||
Using `torsocks`, verify your hidden service is available on the Tor network. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is your instance not reachable over clearnet? Then federation with other instances can only work if they use tor proxy for outgoing requests (not currently supported). So effectively federation is only possible over clearnet for now.
You can see how Mitra handles Tor. Its necessary to set a onion_proxy_url
config value to federate over Tor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My instance is reachable over clearnet. I assumed federation over Tor was impossible, so yes all federation tasks are still handled by the clearnet HTTPS server.
Full federation over Tor would be nice for a siloed instance but in my case, if I'm only hosting the same site "twice" the federation traffic would become redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay then mention that please to avoid any confusion. Additionally you can mention in the beginning that it requires an existing Lemmy installation according to one of the other installation guides.
Also you need to link the file from SUMMARY.md so it shows up in the navigation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I mentioned the requirement at the beginning and added a link to SUMMARY.md
``` | ||
dnf install -y epel-release | ||
dnf install -y tor | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Current instructions are for Ubuntu, so I would prefer to use apt here for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
fef915e
to
92270c0
Compare
Password: [authenticate with root's password] | ||
``` | ||
|
||
Note: To return to your account run: `exit`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You dont need to explain sudo.
Can you also add an example server config for caddyserver? |
* Add "Running a Tor Hidden Service" to SUMMARY.md
707fc54
to
bf7c404
Compare
I've used the docker-compose from here: https://github.com/LemmyNet/lemmy-ansible/blob/main/templates/docker-compose.yml |
@jhunkeler thanks for doing this!
You can run a .onion with SSL, but it doesn't add much security because Onion Services already have a better PKI encryption solution than SSL's X.509. Here's a list of popular Onion Services. Note some have https and some have http Currently you have to pay for an https cert, but there is a pending ticket for support of Onion Services in Let's Encrypt |
Maybe? (I don't know much about this) the limit_req_zone can be too low. Nginx won't be able to distinguish between Tor users, since each request just comes from 127.0.0.1. I was going to ask why you're making both docker and nginx use 10080, but it's meant to be mutually exclusive. If one uses nginx as a reverse proxy, one wants the latter, and if not one should edit the docker compose. A small note that both of these are not meant to be done at the same time, might be good. Strict-Transport-Security makes no sense. As maltfield said. |
I use So it wouldn't be able to distinguish between users that share the same exit node IP in their tor circuit, but it should be able to distinguish between most users (currently there's about 5 million users sharing over 2,000 exit nodes) |
This was definitely a typo, sorry. In my own configuration I have
I haven't observed any wonkiness with the
If you try to forward the raw HTTPS traffic on Tor smoke pours out. I thought I mentioned this in the docs but if not I can add a blurb.
I agree. |
Rereading what you wrote @hackerncoder... I think I understand what you mean about the There is no "exit node" when you access the onion site directly over tor. The traffic arrives at nginx's door through tor, thus Any suggestions for how to handle it? Is there an alternative method? I don't think it'd be a good idea to stop rate limiting altogether or it'll leave you open to getting DoS'd. |
Can you dump a complete request to your web server that originated via a client using Tor Browser connecting to your Onion Service? I'd specifically be interested in headers like
By default there's two exit nodes. Both the client and the server form their own 3-hop Onion Circuit. Please share the complete request here to help others. |
I'm pretty sure there is none. Tor just forwards TCP packets. Edit: right, you mean those in the nginx config, they would be filled with 127.0.0.1 (when tor -> nginx on "root", without any docker or other things that might change the address)
No.
Oh... nginx is running inside docker? edit:
I don't understand what that is supposed to mean.
Yea, that's why I said it might be too low. Depending on the amount of users the server gets. |
Yes nginx is running inside of docker.
Lemmy's stock nginx configuration wants to redirect 80 to 443. If you create a service like i.e. the same config minus HTTPS.
My server barely gets any meaningful traffic. I guess that explains why I haven't noticed anything out of the ordinary. 😁 Do you have any recommendations for what to set the limits to? I can RTFM but its difficult to know what's going to work for a high traffic onion site. I could be wrong... I feel like a lot of people are hosting Lemmy on potatoes so I don't want to set the defaults too high, or too loose. |
Right, right. Yup. I was thinking that nginx ran outside of docker, that's what my original comment was talking about.
Nope. |
tor -> onionTraffic never leaves tor, so it arrives on the loopback interface. Traffic originates from "within" the server. Client side
Server side
tor -> internetTor traffic passes through an exit node like normal internet traffic. The exit node IP is logged by nginx. Client side
Server side
|
I've been monitoring logs from my Onion Services and confirmed that, sure enough, it's rate-limiting 127.0.0.1. Maybe that explains why every few days my .onion monitoring alerts tell me my site is down, but I can't ever reproduce it. Huh.
I haven't confirmed with a dump myself, but honestly I'm surprised that Tor wouldn't set It looks like I haven't found any guides that describe how to use it with, say, nginx's |
@maltfield See "Accepting the PROXY protocol" on the nginx docs. Edit:
First and foremost: Tor is a TCP proxy. And even if it were to, that would be impossible for HTTPS. |
From tor(1):
The ^nginx doc link^ for future reference: |
Cool, I was able to set this up. It required 4 changes: 1. torrcFirst I had to update my torrc file by adding this to the end of every
2. listen linesI had to append every
Now say this
3. logging changes (optional?)To log the "IP Address" of the Tor client (instead of 127.0.0.1), I had to setup a new "tor" logging format in
And then the same
to this
4. proxy changesFinally, in the
ResultsAs a result, my backend now sees these For example:
I'm also getting these "IPs" logged to my nginx access logs like so:
I'll have to wait and see how this affects |
This PR intends to implement issue #187 . The only thing I'm iffy on right now is how to hook this up to the main documentation. Configuring Tor and running an onion site probably isn't everybody's cup of tea.
A second pair of eyes on this wouldn't hurt either. For some reason I wasn't able to proxy the
.onion
address tohttp://lemmy
. I suspect it was related to SSL, because it isn't supported on the Tor network (last I remember anyway, I could be wrong).tor_hidden_service.md
?Feel free to commit directly to my branch if you want to.