I understand that people enter the world of self hosting for various reasons. I am trying to dip my toes in this ocean to try and get away from privacy-offending centralised services such as Google, Cloudflare, AWS, etc.

As I spend more time here, I realise that it is practically impossible; especially for a newcomer, to setup any any usable self hosted web service without relying on these corporate behemoths.

I wanted to have my own little static website and alongside that run Immich, but I find that without Cloudflare, Google, and AWS, I run the risk of getting DDOSed or hacked. Also, since the physical server will be hosted at my home (to avoid AWS), there is a serious risk of infecting all devices at home as well (currently reading about VLANS to avoid this).

Am I correct in thinking that avoiding these corporations is impossible (and make peace with this situation), or are there ways to circumvent these giants and still have a good experience self hosting and using web services, even as a newcomer (all without draining my pockets too much)?

Edit: I was working on a lot of misconceptions and still have a lot of learn. Thank you all for your answers.

  • JigglySackles@lemmy.world
    link
    fedilink
    English
    arrow-up
    11
    ·
    2 days ago

    DDOS against a little self hosted instance isn’t really a concern I’d have. I’d be more concerned with the scraping of private information, ransomware, password compromises, things of that nature. If you keep your edge devices on the latest security patches and you are cognizant on what you are exposing and how, you’ll be fine.

  • Auli@lemmy.ca
    link
    fedilink
    English
    arrow-up
    14
    arrow-down
    1
    ·
    2 days ago

    The DDOSED hype on this site is so over played. Oh my god my little self hosted services are going to get attacked. Is it technically possible yes but it hasn’t been my experience.

    • markstos@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 days ago

      DDoSing cost the attacker some time and resources so there has to something in it for them.

      Random servers on the internet are subject to lots of drive-by vuln scans and brute force login attempts, but not DDoS, which are most costly to execute.

    • tills13@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 days ago

      99% of people think they are more important than they are.

      If you THINK you might be the victim of an attack like this, you’re not going to be a victim of an attack like this. If you KNOW you’ll be the victim of an attack like this on the other hand…

      • gamermanh@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        1
        arrow-down
        1
        ·
        2 days ago

        Many of us also lived through the era where any 13 year old could steal Mommy’s credit card and rent a botnet for that ezpz

        My MC server a decade ago was tiny and it still happened every few months when we banned some butthurt kid

  • traches@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    26
    ·
    3 days ago

    Use any old computer you have lying around as a server. Use Tailscale to connect to it, and don’t open any ports in your home firewall. Congrats, you’re self-hosting and your risk is minimal.

    • OpossumOnKeyboard@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 days ago

      Exactly what I do and works like a dream. Had a VPS and nginx to proxy domain to it but got rid of it because I really had no use for it, the Tailscale method worked so well.

      • rottedmood@lemmy.linuxuserspace.show
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 hours ago

        I’ve been thinking of trying this (or using Caddy instead of nginx) so I could get Nextcloud running on an internal server but still have an external entry point (spousal approval) but after setting up the subdomain and then starting caddy and watching how many times that subdomain started to get scanned from various Ips all over the world, I figured eh that’s not a good plan. And I’m a nobody and don’t promote my domain anywhere.

  • poVoq@slrpnk.net
    link
    fedilink
    English
    arrow-up
    87
    arrow-down
    3
    ·
    3 days ago

    This is nonsense. A small static website is not going to be hacked or DDOSd. You can run it off a cheap ARM single board computer on your desk, no problem at all.

    • BearOfaTime@lemm.ee
      link
      fedilink
      English
      arrow-up
      6
      arrow-down
      18
      ·
      3 days ago

      What?

      I’ve popped up a web server and within a day had so many hits on the router (thousands per minute) that performance tanked.

      Yea, no, any exposed service will get hammered. Frankly I’m surprised that machine I setup didn’t get hacked.

      • Omgboom@lemmy.zip
        link
        fedilink
        English
        arrow-up
        2
        ·
        2 days ago

        You left stuff exposed is the only explanation. I’ve had services running for years without a problem

      • poVoq@slrpnk.net
        link
        fedilink
        English
        arrow-up
        30
        ·
        3 days ago

        Don’t leave SSH on port 22 open as there are a lot of crawlers for that, otherwise I really can’t say I share your experience, and I have been self-hosting for years.

        • JJLinux@lemmy.ml
          link
          fedilink
          English
          arrow-up
          4
          arrow-down
          2
          ·
          3 days ago

          Am I missing something? Why would anyone leave SSH open outside the internal network?

          All of my services have SSH disabled unless I need to do something, and then I only do it locally, and disable as soon as I’m done.

          Note that I don’t have a VPS anywhere.

            • JJLinux@lemmy.ml
              link
              fedilink
              English
              arrow-up
              1
              ·
              edit-2
              2 days ago

              My firewall, server, NAS and all my services have web GUIs. If I need SSH access all I have to do is enable it via web GUI, do what I need to, disable again.

              If push comes to shove, I do have a portable monitor and a keyboard in storage if needed, but have not had the need to use them yet.

          • poVoq@slrpnk.net
            link
            fedilink
            English
            arrow-up
            4
            arrow-down
            1
            ·
            3 days ago

            Some people want to be able to reach their server via SSH when they are not at home, but yes I agree in general that is not necessary when running a real home server.

            • JJLinux@lemmy.ml
              link
              fedilink
              English
              arrow-up
              1
              ·
              3 days ago

              Yeah, I guess I’ve never needed to do that. That may change as I’m thinking of moving all my services from UnRaid to ProxMox to leave UnRaid for storage only.

              I guess that’ll bring me back here soon enough.

            • JustEnoughDucks@feddit.nl
              link
              fedilink
              English
              arrow-up
              1
              arrow-down
              2
              ·
              2 days ago

              Then use Wireguard to get into your local network. Simple as. All security risks that don’t need to be accessed by the public (document servers, ssh, internal tools, etc…) can be accessed via VPN while the port forwarded servers are behind a reverse proxy, TLS, and an authentication layer like Authelia/authentik for things that only a small group needs to access.

              Sorry, but there is 1 case in 10000 where a home user would have to have publicly exposed SSH and 9999 cases of 10000 where it is not needed at all and would only be done out of laziness or lack of knowledge of options.

      • Count042@lemmy.ml
        link
        fedilink
        English
        arrow-up
        7
        ·
        3 days ago

        I’ve been self-hosting a bunch of stuff for over a decade now, and have not had that issue.

        Except for a matrix server with open registration for a community that others not in the community started to use.

        • Auli@lemmy.ca
          link
          fedilink
          English
          arrow-up
          1
          ·
          2 days ago

          Yes my biggest mistake was leaving a vps dns server wide open. It took months for it to get abused though.

      • MangoPenguin@lemmy.blahaj.zone
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        3 days ago

        I can’t say I’ve seen anything like that on the webservers I’ve exposed to the internet. But it could vary based on the IP you have if it’s a target for something already I suppose.

        Frankly I’m surprised that machine I setup didn’t get hacked.

        How could it if all you had was a basic webserver running?

  • Darkassassin07@lemmy.ca
    link
    fedilink
    English
    arrow-up
    25
    ·
    3 days ago

    Drink less paranoia smoothie…

    I’ve been self-hosting for almost a decade now; never bothered with any of the giants. Just a domain pointed at me, and an open port or two. Never had an issue.

    Don’t expose anything you don’t share with others; monitor the things you do expose with tools like fail2ban. VPN into the LAN for access to everything else.

  • hsdkfr734r@feddit.nl
    link
    fedilink
    English
    arrow-up
    50
    arrow-down
    1
    ·
    edit-2
    3 days ago

    One aspect is how interesting you are as a target. What would a possible attacker gain by getting access to your services or hosts?

    The danger to get hacked is there but you are not Microsoft, amazon or PayPal. Expect login attempts and port scans from actors who map out the internets. But I doubt someone would spend much effort to break into your hosts if you do not make it easy (like scripted automatic exploits and known passwords login attempts easy) .

    DDOS protection isn’t something a tiny self hosted instance would need (at least in my experience).

    Firewall your hosts, maybe use a reverse proxy and only expose the necessary services. Use secure passwords (different for each service), add fail2ban or the like if you’re paranoid. Maybe look into MFA. Use a DMZ (yes, VLANs could be involved here). Keep your software updated so that exploits don’t work. Have backups if something breaks or gets broken.

    In my experience the biggest danger to my services is my laziness. It takes steady low level effort to keep the instances updated and running. (Yes there are automated update mechanisms - unattended upgrades i.e. -, but also downwards compatibility breaking changes in the software which will require manual interactions by me.)

    • thirdBreakfast@lemmy.world
      link
      fedilink
      English
      arrow-up
      37
      ·
      3 days ago

      +1 for the main risk to my service reliability being me getting distracted by some other shiny thing and getting behind on maintenance.

    • mad_asshatter@lemmy.world
      link
      fedilink
      English
      arrow-up
      12
      ·
      3 days ago

      …maybe use a reverse proxy…

      +1 post.

      I would suggest definitely reverse proxy. Caddy should be trivial in this use case.

      cheers,

          • atzanteol@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            2
            arrow-down
            1
            ·
            edit-2
            2 days ago

            I’m positive that F5’s marketing department knows more than me about security and has not ulterior motive in making you think you’re more secure.

            Snark aside, they may do some sort of WAF in addition to being a proxy. Just “adding a proxy” does very little.

          • Guadin@k.fe.derate.me
            link
            fedilink
            arrow-up
            10
            ·
            3 days ago

            I don’t get why they say that? Sure, maybe the attackers don’t know that I’m on Ubuntu 21.2 but if they come across https://paperless.myproxy.com and the Paperless-NGX website opens, I’m pretty sure they know they just visited a Paperless install and can try the exploits they know. Yes, the last part was a bit snarky, but I am truly curious how it can help? Since I’ve looked at proxies multiple times to use it for my selfhosted stuff but I never saw really practical examples of what to do and how to set it up to add an safety/security layer so I always fall back to my VPN and leave it at that.

        • Monkey With A Shell@lemmy.socdojo.com
          link
          fedilink
          English
          arrow-up
          7
          ·
          edit-2
          3 days ago

          I have a dozen services running on a myriad of ports. My reverse proxy setup allows me to map hostnames to those services and expose only 80/443 to the web, plus the fact that an entity needs to know a hostname now instead of just an exposed port. IPS signatures can help identify abstract hostname scans and the proxy can be configured to permit only designated sources. Reverse proxies also commonly get used to allow for SSL offloading to permit clear text observation of traffic between the proxy and the backing host. Plenty of other use cases for them out there too, don’t think of it as some one trick off/on access gateway tool

          • atzanteol@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            4
            arrow-down
            3
            ·
            3 days ago

            My reverse proxy setup allows me to map hostnames to those services and expose only 80/443 to the web,

            The mapping is helpful but not a security benefit. The latter can be done with a firewall.

            Paraphrasing - there is a bunch of stuff you can also do with a reverse proxy

            Yes. But that’s no longer just a reverse proxy. The reverse proxy isn’t itself a security tool.

            I see a lot of vacuous security advice in this forum. “Install a firewall”, “install a reverse proxy”, etc. This is mostly useless advice. Yes, do those things but they do not add any protection to the service you are exposing.

            A firewall only protects you from exposing services you didn’t want to expose (e.g. NFS or some other service running on the same system), and the rproxy just allows for host based routing. In both cases your service is still exposed to the internet. Directly or indirectly makes no significant difference.

            What we should be advising people to do is “use a valid ssl certificate, ensure you don’t use any application default passwords, use very good passwords where you do use them, and keep your services and servers up-to-date”.

            A firewall allowing port 443 in and an rproxy happily forwarding traffic to a vulnerable server is of no help.

            • Auli@lemmy.ca
              link
              fedilink
              English
              arrow-up
              1
              ·
              edit-2
              2 days ago

              You can’t port map the same port to different services on a firewall. Reverse proxy lets you open one port and have multiple services on it. Firewall can protect exposed services one I geoip block every country but my own two use crowded to block what they consider malicious ips.

            • Monkey With A Shell@lemmy.socdojo.com
              link
              fedilink
              English
              arrow-up
              2
              ·
              3 days ago

              They’re a part of the mix. Firewalls, Proxies, WAF (often built into a proxy), IPS, AV, and whatever intelligence systems one may like work together to do their tasks. Visibility of traffic is important as well as the management burden being low enough. I used to have to manually log into several boxes on a regular basis to update software, certs, and configs, now a majority of that is automated and I just get an email to schedule a restart if needed.

              A reverse proxy can be a lot more than just host based routing though. Take something like a Bluecoat or F5 and look at the options on it. Now you might say it’s not a proxy then because it does X/Y/Z but at the heart of things creating that bridged intercept for the traffic is still the core functionality.

        • d_ohlin@lemmy.world
          link
          fedilink
          English
          arrow-up
          4
          ·
          edit-2
          3 days ago

          May not add security in and of itself, but it certainly adds the ability to have a little extra security. Put your reverse proxy in a DMZ, so that only it is directly facing the intergoogles. Use firewall to only expose certain ports and destinations exposed to your origins. Install a single wildcard cert and easily cover any subdomains you set up. There’s even nginx configuration files out there that will block URL’s based on regex pattern matches for suspicious strings. All of this (probably a lot more I’m missing) adds some level of layered security.

          • atzanteol@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            4
            arrow-down
            1
            ·
            edit-2
            3 days ago

            Put your reverse proxy in a DMZ, so that only it is directly facing the intergoogles

            So what? I can still access your application through the rproxy. You’re not protecting the application by doing that.

            Install a single wildcard cert and easily cover any subdomains you set up

            This is a way to do it but not a necessary way to do it. The rproxy has not improved security here. It’s just convenient to have a single SSL endpoint.

            There’s even nginx configuration files out there that will block URL’s based on regex pattern matches for suspicious strings. All of this (probably a lot more I’m missing) adds some level of layered security.

            If you do that, sure. But that’s not the advice given in this forum is it? It’s “install an rproxy!” as though that alone has done anything useful.

            For the most part people in this form seem to think that “direct access to my server” is unsafe but if you simply put a second hop in the chain that now you can sleep easily at night. And bonus points if that rproxy is a VPS or in a separate subnet!

            The web browser doesn’t care if the application is behind one, two or three rproxies. If I can still get to your application and guess your password or exploit a known vulnerability in your application then it’s game over.

            • zingo@lemmy.ca
              link
              fedilink
              English
              arrow-up
              2
              ·
              2 days ago

              The web browser doesn’t care if the application is behind one, two or three rproxies. If I can still get to your application and guess your password or exploit a known vulnerability in your application then it’s game over.

              Right!?

              Your castle can have many walls of protection but if you leave the doors/ports open, people/traffic just passes through.

            • Auli@lemmy.ca
              link
              fedilink
              English
              arrow-up
              1
              ·
              2 days ago

              So I’ve always wondered this. How does a cloudflare tunnel offer protection from the same thing.

              • atzanteol@sh.itjust.works
                link
                fedilink
                English
                arrow-up
                1
                ·
                2 days ago

                They may offer some sort of WAF (web application firewall) that inspects traffic for potentially malicious intent. Things like SQL injection. That’s more than just a proxy though.

                Otherwise, they really don’t.

        • Oisteink@feddit.nl
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          3 days ago

          A reverse proxy is used to expose services that don’t run on exposed hosts. It does not add security but it keeps you from adding attack vectors.

          They usually provide load balancing too, also not a security feature.

          Edit: in other words what he’s saying is true and equal to “raid isn’t baclup”

    • Oisteink@feddit.nl
      link
      fedilink
      English
      arrow-up
      4
      ·
      3 days ago

      All reverse proxies i have used do rudimentary DDoS protection: rate limiting. Enough to keep your local script kiddy at bay - but not advanced stuff.

      You can protect your ssh instance with rate limiting too but you’ll likely do this in the firewall and not the proxy.

  • MangoPenguin@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    13
    ·
    edit-2
    3 days ago

    Getting DDOSed or hacked is very very rare for anyone self hosting. DDOS doesn’t really happen to random people hosting a few small services, and hacking is also rare because it requires that you expose something with a significant enough vulnerability that someone has a way into the application and potentially the server behind it.

    But it’s good to take some basic steps like an isolated VLAN as you’ve mentioned already, but also don’t expose services unless you need to. Immich for example if it’s just you using it will work just fine without being exposed to the internet.

  • MagicShel@programming.dev
    link
    fedilink
    English
    arrow-up
    26
    ·
    edit-2
    3 days ago

    DDoS and hacking are like taxes: you should be so lucky as to have to worry about them, because that means you’re wildly successful. Worry about getting there first because that’s the hard part.

    • qaz@lemmy.world
      link
      fedilink
      English
      arrow-up
      6
      ·
      edit-2
      3 days ago

      You don’t have to be successful to get hit by bots scanning for known vulnerabilities in common software (e.g. Wordpress), but OP won’t have to worry about that if they keep everything up to date. However, this is also necessary when renting a VPN from said centralised services.

      • MagicShel@programming.dev
        link
        fedilink
        English
        arrow-up
        3
        ·
        3 days ago

        Well he specified static website, which rules out WP, but yes. If your host accepts posts (in the generic sense, not necessarily specifically the http verb POST) that raises tons of other questions, that frankly were already well addressed when I made my post.

  • Evotech@lemmy.world
    link
    fedilink
    English
    arrow-up
    16
    ·
    3 days ago

    A VPS with fail2ban is all you need really. Oh and don’t make ssh accounts where the username is the password. That’s what I did once, but the hackers were nice, they closed the hole and then just used it to run a irc client because the network and host was so stable.

    Found out by accident, too bad they left their irc username and pw in cleartext. Was a fun week or so messing around with their channels

  • deafboy@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    2 days ago

    Of course security comes with layers, and if you’re not comfortable hosting services publically, use a VPN.

    However, 3 simple rules go a long way:

    1. Treat any machine or service on a local network as if they were publically accesible. That will prevent you from accidentally leaving the auth off, or leaving the weak/default passwords in place.

    2. Install services in a way that they are easy to patch. For example, prefer phpmyadmin from debian repo instead of just copy pasting the latest official release in the www folder. If you absolutely need the latest release, try a container maintained by a reasonable adult. (No offense to the handful of kids I’ve known providing a solid code, knowledge and bugreports for the general public!)

    3. Use unattended-upgrades, or an alternative auto update mechanism on rhel based distros, if you don’t want to become a fulltime sysadmin. The increased security is absolutely worth the very occasional breakage.

    4. You and your hardware are your worst enemies. There are tons of giudes on what a proper backup should look like, but don’t let that discourage you. Some backup is always better than NO backup. Even if it’s just a copy of critical files on an external usb drive. You can always go crazy later, and use snapshotting abilities of your filesystem (btrfs, zfs), build a separate backupserver, move it to a different physical location… sky really is the limit here.

  • Presi300@lemmy.world
    link
    fedilink
    English
    arrow-up
    18
    ·
    edit-2
    3 days ago

    I feel like you have the wrong idea of what hacking acting a actually is… But yes, as long as you don’t do anything too stupid line forwarding all of your ports or going without any sort of firewall, the chances of you getting hacked are very low…

    As for DDOSing, you can get DDOSed with or without self hosting all the same, but I wouldn’t worry about it.

    • Auli@lemmy.ca
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 days ago

      Exactly piss off a script kiddie and get ddosed weather your self hosting or not.

  • HumanPerson@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    11
    ·
    3 days ago

    You can. I am lucky enough to not have been hacked after about a year of this, and I use a server in the living room. There are plenty of guides online for securing a server. Use common sense, and also look up threat modeling. You can also start hosting things locally and only host to the interwebs once you learn a little more. Basically, the idea that you need cloudflare and aws to not get hacked is because of misleading marketing.

    • Auli@lemmy.ca
      link
      fedilink
      English
      arrow-up
      3
      ·
      2 days ago

      Man if your lucky enough after a year I must be super duper lucky with well over a decade.

  • qaz@lemmy.world
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    3 days ago

    You can simply set up a VPN for your home network (e.g. Tailscale, Netbird, Headscale, etc.) and you won’t have to worry about attacks. Public services require a little more work, you will need to rely on a service from a company, either a tunnel (e.g. Tailscale funnel) or a VPS.

    • Catsrules@lemmy.ml
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      2 days ago

      Public services require a little more work, you will need to rely on a service from a company, either a tunnel (e.g. Tailscale funnel) or a VPS.

      I have been hosting random public services for years publicly and it hasn’t been an issue.

      Edit, I might have miss understood the definition of public. I have hosted stuff publicly, however everything was protected by a login screen. So it wasn’t something a random person could make use of.

      • qaz@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 days ago

        No, I’m currently using Tailscale but have been considering switching to Netbird to not be reliant on Tailscale.

  • Justin@lemmy.jlh.name
    link
    fedilink
    English
    arrow-up
    13
    ·
    3 days ago

    Self hosting can save a lot of money compared to Google or aws. Also, self hosting doesn’t make you vulnerable to DDOS, you can be DDOSed even without a home server.

    You don’t need VLANs to keep your network secure, but you should make sure than any self hosted service isn’t unnecessarily opens up tot he internet, and make sure that all your services are up to date.

    What services are you planning to run? I could help suggest a threat model and security policy.

  • Apollo2323@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    11
    ·
    3 days ago

    Hey no to be harsh or anything but did you actually made your research? Plenty of people self host websites on their house without AWS , Google or Cloudfare and it works fine.