29

My ISP provide me with good IPv6 connection with support of opening ports how I like. But IPv4 is behind a CGNAT and makes me unable to host a service on the legacy Internet.

Unfortunetely some of my friends I want to host (Jellyfin and Nextcloud) for does not have modern Internet connection, so I have to put some proxy.

Now I need suggestions of a solution. VPN on some VPS they would need to connection to is one of them, but it should be as simple for them to use as possible.

you are viewing a single comment's thread
view the rest of the comments

Be careful with doing this. X-Real-IP and X-Forwarded-For are good for when the client is a trusted proxy, but can be easily faked if you don't whitelist who's allowed to use those headers. Somebody with IPv6 access could send "X-Real-IP: 127.0.0.1" or something and if the server believes it then you'll see 127.0.0.1 in logs and depending on what you're running the user may gain special permissions.

Also be careful with the opposite problem. If your server doesn't trust the proxy, it will show the VPS IP in logs, and if you're running something like fail2ban you'll end up blocking your VPS and then nobody will be able to connect over IPv4.

[-] TCB13@lemmy.world 2 points 1 month ago* (last edited 1 month ago)

Fair enough yeah. :)

The OP can solve that potential security issue with this option: https://nginx.org/en/docs/http/ngx_http_realip_module.html#set_real_ip_from on the local server nginx:

http {
(...)
        real_ip_header    X-Real-IP;
        set_real_ip_from  [2a03::aaaac::1]; # Replace with the VPS IPv6 address.
}

This will make sure only the VPS is allowed to override the real IP.

this post was submitted on 01 Jun 2024
29 points (93.9% liked)

Selfhosted

37743 readers
639 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 1 year ago
MODERATORS