Comment on Access home server from anywhere

TCB13@lemmy.world ⁨11⁩ ⁨months⁩ ago

Yes, you can use a Cloudflare tunnel but why since you’re into self-hosting why should you depend on some random company to tunnel your traffic when you most likely don’t need it? You also have all the potential tracking, spyware, risks and “being hostage” scenarios that may come with that choice.

The following assumes your use case is a simple home server for “standard arr apps, jellyfin, pi-hole” for personal usage that sits inside your network and your objetive is to be able to access those services. If you’re instead trying to host a game server / few services for friends (that doesn’t really need to be “inside” your home network) there’s a more complete comment with other security considerations and recommendations here.

Your basic requirements are:

Quick setup guide and checklist:

  1. Create your subdomain for the dynamic DNS service freedns.afraid.org and install the daemon on the server - will update your domain with your dynamic IP when it changes;
  2. List what ports you need to access remote;
  3. Setup Wireguard VPN on the server. There’s also this nice UI that can be used to do most of the setup and create client config files;
  4. For the VPN use custom ports with 5 digits - something like 23901 (up to 65535) to make your service harder to find;
  5. Configure your ISP router to assign a static local IP to the server and port forward the VPN port to the server IP;
  6. Only expose absolutely required services (the VPN port in this case) to the Internet. Any service the server provides, SSH, configuration interfaces and whatnot can accessed through the WireGuard VPN;
  7. In the server consider setting up nftables / iptables / another firewall 10 minute guide;
  8. Configure nftables to only allow traffic coming from public IP addresses (IPs outside your home network IP / VPN range) to the Wireguard port - this will protect your server if by some mistake the router starts forwarding more traffic from the internet to the server than it should;
  9. Configure nftables to restrict what countries are allowed to access your server. Most likely you only need to allow incoming connection from your country (wiki.nftables.org/wiki-nftables/…/GeoIP_matching).

Since you’re only allowing access to your services through the VPN and you’ve heavily restricted access to the VPN port you’ll be safe. Just a side note, don’t be afraid to expose the Wireguard port because if someone tried to connect and they don’t authenticate with the right key the server will silently drop the packets.

source
Sort:hotnewtop