(I asked this on r*ddit a long while ago, but I don’t think I explained myself properly)
Basically, I would like to host a few services on my own metal (and not anywhere else in the world!) to play around with and learn, like my personal site, lemmy instance, vpn, fdroid, image host, etc etc.
I would also like to hide my public IP address because I don’t want people who connect to me to know my location (even if it’s rather coarse).
I know that this isn’t possible without at least another server in a different physical location, but I really have no idea how to approach this. What software do I run? What is this action called? What do any of these AWS/Azure service names mean? How much would I realistically need to pay? Etc etc.
Anyone have any pointers?
As others have pointed out,
- a VPN (so that your outbound traffic comes from your VPN endpoint, not your bare IP address)
- a reverse proxy server
I use a router from GL-iNet to run the always-on VPN, and
rathole
for a reverse proxy. Both the VPN and the reverse proxy terminate at $4/mo VPSes.Check into Cloudflare Tunnels.
Was going to suggest CloudFlare as well. At the very least just setup your DNS with there nameservers and benefit from CloudFlare proxies on the IP addresses.
But tunnels is pretty sweet.
Cloudflare tunnels are great but OP may not want to have to authenticate each user to their services.
Agreed, but they could always setup a bypass rule.
Cloudflare free tier + a reverse proxy will set you straight. You can add subdomains for your services as A records in Cloudflare off of your root domain, i.e. lemmy.yourdomain.tld, personalsite.yourdomain.tld, images.yourdomain.tld.
When doing this, enable the Cloudflare DNS proxy which will route DNS requests to your origin service through Cloudflares’s CDN. This essentially “hides” your public IP as anyone doing a
nslookup lemmy.yourdomain.tld
will get Cloudflares’s IPs back as a response.Once you’ve done this, you can break everything back out to it’s respective backend via a reverse proxy. For example, lemmy.yourdomain.tld gets passed to 192.168.0.10, personalsite.yourdomain.tld gets passed to 192.168.0.20, etc.
That’s sounds so much simpler than what I am doing right now. Right now I have a digital ocean droplet server running openvpn and I have any servers I want open to the internet connecting to that openvpn server as a client. I then NAT all incoming traffic to the servers I have with iptables as if the droplet is a router. Is it much easier to setup a cloudflare tunnel? Or am I basically accomplishing the same thing? Will I be able to run all the other services I have because I’m not just web hosting? I also do not have a static IP.
Cloudflare tunnels or a reverse proxy with Cloudflare DNS would be much easier to manage IMO. What you’re doing will work but it seems like you have a lot of moving parts in your setup which can lead to errors creeping in.
With both proposed setups you should be able to pass non web-based traffic to their respective backends. In nginx that would look something like the following:
server { listen 443 ssl http2; server_name service.yoursite.tld; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $host:$proxy_port; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://<IP of your service>:<port>; } }
With Cloudflare tunnels you can setup a VM as your tunnel termination point and configure ingress rules to pass traffic where it needs to go, similar to this:
tunnel: <Tunnel UUID> credentials-file: /root/.cloudflared/<Tunnel credentials>.json ingress: - hostname: service1.yourdomain.tld service: http://192.168.0.10:80 - hostname: service2.yourdomain.tld service: ssh://192.168.0.20:22 - service: http_status:404 # This is a catch-all rule to handle unmatched ingress traffic
One thing you can do for your public IP is use something like inadyn to update cloudflare with your public IP when it changes. Inadyn is super lightweight and will make sure, +/- 5 minutes, that your public IP is up-to-date with Cloudflare.
ingress traffic to lemmy is obvious (CF -> reverse proxy, for example) but what about egress traffic i.e. federation requests? I kind of poked around lemmy backend / issue tracker but didn’t find any way to setup a HTTP proxy for backend requests, so your real IP would be visible to any instance you contact, I think.
Look into getting a VPS to proxy things through using either wireguard+DNAT, rathole or SSH tunneling.
Cloudflare DNS Proxy sounds like exactly what you’re looking for, where cloudflare acts as the DNS middleman and responds with their own IPs, while forwarding all traffic for the site(s) to your public IP space
deleted by creator