Hello,

Some time ago, I started self-hosting applications, but only on my local network. So far, it’s working fine, but I can’t access them as soon as I go outside (which is completely normal).

For the past few days I’ve been looking for a relatively secure way of accessing my applications from outside.

I don’t need anyone but myself to have access to my applications, so from what I’ve understood, it’s not necessarily useful to set up a reverse-proxy in that case and it would be simpler to set up a VPN.

From what I’ve seen, Wireguard seems to be a good option. At first glance, I’d have to install it on the machine containing my applications, port-forward the Wireguard listening port and configure my other devices to access this machine through Wireguard

However, I don’t have enough hindsight to know whether this is a sufficient layer of security to at least prevent bots from accessing my data or compromising my machine.

I’ve also seen Wireguard-based solutions like Tailscale or Netbird that seem to make configuration easier, but I have a hard time knowing if it would really be useful in my case (and I don’t really get what else they are doing despite simplifying the setup).

Do you have any opinions on this? Are there any obvious security holes in what I’ve said? Is setting up a VPN really the solution in my case?

Thanks in advance for your answers!

  • lechongous@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    There’s no magic bullet here. If you want good defense against bots you should use fail2ban and/or crowdsec. Geoblocking is also worth looking into. You will always have to open a port if you are selfhosting a VPN and will need to take aforementioned steps (or alternatives) to secure it. I believe Tailscale is a very good alternative for people who don’t have time to do this as it does not (to the best of my knowledge) require you to expose a port.

    I use Netbird (open source networking software from a German company) as it integrates well with Authentik and allows me to use the same SSO for VPN and most of my other services. Setting it up with Authentik and Nginx is a bit complicated but very well documented in my opinion. I do not have a positive experience of the official Android client but Jetbird is a nice alternative. Setting up DNS servers and network routes through peers is quite easy. Enrollment is also a breeze due to the Authentik integration.

    • oyzmo@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Netbird is very nice and easy to use. Only downside is that the iOS app drains battery like crazy :(

  • Kagu@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    Not running anything myself but am part of a self hosting discord that swears by Netbird because its basically Tailscale but with a bunch more ease of use features apparently

  • Atherel@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    Wireguard with WG Tunnel on my phone so it automatically connects when I leave my WiFi. Some Apps excluded to use it like Android Auto because it doesn’t work with an active vpn.

    • mumblerfish@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      I would recommend this too. This was the easiest to setup. I only had an issue with docker compose which made the pihole not being accessible while on wireguard. Once I put the pihole and wg-easy on the same docker network it started working.

  • phillipp@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    I’m in the same boat and currently run WireGuard to access my services. However the more I extend my stack of services, the more I have use-cases to expose certain services to friends and family. For that I’m currently looking into using Pangolin.

  • JohnSmithon@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    1 pangolin 2 whatever is already on your router 3 wireguard

    Pangolin also does RP with traefik so it’s a win win

  • hperrin@lemmy.ca
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    I use OpenVPN. It’s pretty easy. You set it up with docker, download the client.ovpn file, then turn off port 80 (only needed for downloading that file). Now you can take that file and use it all of your devices to connect.

  • ikidd@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    Tailscale is easier than Wireguard but if you’re running OPNsense or OpenWRT it’s not hard to do a wireguard infra of your own and avoid having to use an outside service. I ended up having to revert to wireguard anyway because Tailscale’s android app wasn’t reliable on my new phone, it would drop out every few hours which messed up my monitor/alert system.

    But Tailscale is still the easier of the two solutions.

  • communism@lemmy.ml
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    In that case, wireguard. I only occasionally need to access a service that’s not exposed to the internet, so I use ssh -L, but that would be quite inconvenient for your own use case.

    I know tailscale exists but I’ve never used it, only tried wireguard on its own. Maybe there’s some huge benefit to using it but wireguard worked fine for me.

  • Tinkerer@lemmy.ca
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    I used wireguard self hosted for a bit but my work network is pretty locked down and I couldn’t find a UDP port that wasn’t blocked. How are you guys setting up wireguard in your home network? Or is it better to host it on a cloud VM?

    I’m using tailscale right now because it punches through every firewall but I don’t like using external providers and I’m worried it will eventually enshittify. I have a cloudflare domain but I can’t really use any UDP port for my VPN as it’s blocked.

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 month ago

    If your traffic is pretty low, rent a VPS for $5/month or whatever and set up a Wireguard server on it, have your devices maintain a connection to it (search keepalive for Wireguard), and set up HAProxy to do SNI-based routing for your various subdomains to the appropriate device.

    Benefits:

    • you control everything, so switching to a new provider is as simple as copying configs instead of reconfiguring everything
    • most VPN companies only route traffic going out, not in; you can probably find one that does, but it probably costs more than the DIY option
    • easy to share with others, just give a URL

    Downsides:

    • more complicated to configure
    • bandwidth limitations

    If you only need access on devices you control, something like Tailscale could work.

    Benefits:

    • very simple setup - Tailscale supports a ton of things
    • potentially free, depending on your needs

    Downsides:

    • no public access, so you’d need to configure every device that wants to access it
    • you don’t control it, so if Tailscale goes evil, you’d need to change everything

    I did the first and it works well.

    • deathbird@mander.xyz
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      I would not recommend relying on Tailscale. They have been soliciting a lot of venture capital lately and are probably going to go for an IPO sooner or later. I would not put a lot of trust in that company. The investors are going to want their money.

      • sugar_in_your_tea@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        Yeah, that’s the “you don’t control it” angle here. There are alternatives, but you’ll have to do a fair amount of work to switch vs something you do control (i.e. to switch to a different VPS, just copy configs and change the host config on each client, everything else is the same).

  • friend_of_satan@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    1 month ago

    Run WireGuard on some home machine.

    Run WireGuard on your road warrior system.

    There is no step 3.

    I’m doing this right now from halfway around the world from my house and it’s been great. Been using iPhone, iPad, and macOS clients connected to linuxserver/WireGuard docker container.

    • 0_o7@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Doesn’t that need like a static IP address, port forwarding and dealing all kind of network annoyances?

      Recommending wireguard to people feels like recommending Arch to first time Linux users.

      • cmnybo@discuss.tchncs.de
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        You don’t need a static IP address, but you do need a public IP address. You can use dynamic DNS to avoid having to keep track of your IP address. FreeDNS will work fine for a basic setup.

        Wireguard is one of the easiest VPN servers to use. If you’re not using your ISP’s router, it may even have Wireguard built in.

    • jobbies@lemmy.zip
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      1 month ago

      Apologies for the dumb noob question, but if your iOS device is VPNed to your home server, how does it access the open internet? Does it do this via the VPN?

      • eszidiszi@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        Depends on the client configuration. If you route all the traffic through vpn (so, simplyfied, 0.0.0.0/0) then all their client device network traffic would go through their vpn server at home and is seen as coming from there; otherwise, if you only route specific addressess (like your home network private addressess only) then only those go to their home network and everything else works like it would without a vpn.

      • friend_of_satan@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        1 month ago

        WireGuard routes certain traffic from the client (your iPhone) through the server (the computer at your house). If you route all traffic, then when your iPhone accesses the internet, it’s as if you were at home. Since that WireGuard server is sitting on your home network, it is able to route your phones traffic to anything else on that subnet, or out to the internet.

        Wireguard clients have a setting called AllowedIPs that tells the client what IP subnets to route through the server. By default this is 0.0.0.0/0, ::/0, which means “all ipv4 and all ipv6 traffic”. But If all you want is to access your home network services, then you change that to 192.168.0.0/24 or whatever your home subnet is, and only traffic heading to that network will be routed through the WiteGuard server at your house, but all other traffic goes out of your phone’s normal network paths to the internet.

        • jobbies@lemmy.zip
          link
          fedilink
          English
          arrow-up
          0
          ·
          1 month ago

          Ahh. But what if you already used a VPN on the client for normal browsing etc - can you have two VPNs configured?

          • SpikesOtherDog@ani.social
            link
            fedilink
            English
            arrow-up
            0
            ·
            1 month ago

            No, think of a VPN as a network cable. You can only send out of one or the other.

            Now, if you are connected to a device that has another VPN to somewhere you want to go, then technically yes you would be using 2 VPN connections.

    • jaybone@lemmy.zip
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Is wire guard a service you pay for? Otherwise how does wire guard in your home machine not need your router to forward ports to it? And then the remote client need to be pointed at your home’s external IP?

      • friend_of_satan@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        1 month ago

        .WireGuard is free. Obviously my instructions didn’t go into detail about specifically how to set everything up. Port forwarding is required. Knowing your servers external IP address is required. You also need electricity, an ISP subscription, a home server (preferably running Linux), so on and so forth. This is /c/selfhosted After all.

        • jaybone@lemmy.zip
          link
          fedilink
          English
          arrow-up
          0
          ·
          edit-2
          1 month ago

          Yeah that’s fine. The steps were so simple I figured they could work without router config changes if they made some kind of connection handshake in a third party service’s server.

          But given all that, I wonder if it makes sense to look into if your router has its own vpn server (or flash the firmware with one that does.)

          • friend_of_satan@lemmy.world
            link
            fedilink
            English
            arrow-up
            0
            ·
            edit-2
            1 month ago

            Some routers even run WireGuard natively :) like for instance Ubiquiti. Personally I’d rather run it on my own server though because ubiquiti doesn’t have easy IAC features.

    • waterproof@sh.itjust.worksOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      Okay, so that’s pretty much the setup I had in mind. Good to know there is not much need for an extra step for security, thanks for the answer !

      Well, I guess that would still be vulnerable to DDOS attacks, but that would just prevent me from accessing my cinnamon apple-pie recipe from my self hosted recipe manager for some time. A bit mean, but not catastrophic.

      I wondered if there would be some other attacks that could compromise my machine with only a wireguard setup, but that’s a good sign if there is nothing obvious.

    • dantheclamman@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 month ago

      I use Wireguard via PiVPN and it’s pretty much foolproof. I don’t bother with Dynamic DNS but have in the past