Hey guys,

after reading up on selfhosting for weeks now I finally decided to take the plunge today and tried setting up my own nextcloud & jellyfin instances. For this purpose I am using a mini PC. (similiar to an Intel NUC)

Now I would like to make both services available to the internet so I could show images to friends while I’m at their place / watch movies with them.

The problem is I am currently not very educated on which security measures I would have to take to ensure that my server / mini PC doesn’t immediately become an easy target for a hacker, especially considering that I would host private photos on the nextcloud.

After googling around I feel like I find a lot of conflicting information as well as write-ups that I don’t fully grasp with my limited knowledge so if you guys have any general advice or even places to learn about all these concepts I would be absolutely delighted!

Thank you guys sooo much in advance for any and all help, the c/selfhosted community has been nothing but a great resource for me so far!!!

    • Plod@programming.dev
      link
      fedilink
      English
      arrow-up
      8
      ·
      1 year ago

      Another vote for Tailscale. Relatively easy to set up and can has some pretty cool features I’m still learning about. I also share my Jellyfin server with family and friends and it meets expectations.

    • ripe_banana@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      ·
      1 year ago

      In the spirit of selfhosting, you can also host headscale. Its an open source implementation of the proprietary tailscale control plane.

      It allows you to get over the 5 device limit, as well as keep your traffic on your devices. And, imo, it is pretty stable.

      The only issue is that the control plane (by nature) has to be publically accessible. But imo it’s way less of a security target than a massive app like nextcloud.

  • rambos@lemmy.world
    link
    fedilink
    English
    arrow-up
    10
    ·
    1 year ago

    I went for wireguard VPN instead of exposing services. Its much more safe afaik, but you have to configure each device you want to give access (aka scanning QR code). You also dont need to buy a domain for that. Exposed services would be easier to use, especially if you want to use it on many devices

  • u_tamtam@programming.dev
    link
    fedilink
    English
    arrow-up
    9
    ·
    1 year ago

    As soon as you put something up online, you will de facto become a target with nowhere to hide except offline. Your IP will be known and constantly hammered by more or less serious threats.

    If you don’t know the basics of Linux system administration and typical security measures, I would propose 2 approaches: you can go “the NAS way” and purchase something turnkey like a Synology (or anything on which you can easily spin up containers to host your services). You can expect a large part of the administration to be taken care of with sound default settings.

    Another approach is to use a beginner friendly distro like https://yunohost.org/ , perhaps more involving, more risky, bit more rewarding.

    Also, don’t put anything up there like personal or valuable information (except if encrypted with local-only keys), expect to be hacked, expect to be wiped, and think early on about (off-site) backups.

  • Reborn2966@feddit.it
    link
    fedilink
    English
    arrow-up
    6
    ·
    edit-2
    1 year ago

    i have a lot of stuff exposed to the web. i got a domain from godaddy, attached my public ip and created a subdomain for each service. than i have traefik that manage the tls and route each subdomain to each of the docker containers.

    in total i have exposed 80, 443, and a random port i use for ssh. of course ssh is only by public key.

    now i’m trying to set up fail2ban on the exposed services since someone could bruteforce them.

    • solberg@lemmy.blahaj.zone
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      DuckDNS is great, but you only need it if you have a dynamic IP. It’s worth checking if you have a static public IP before adding another layer of complexity.

    • foonex@feddit.de
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      Could you please be more specific what exactly Crowdsec brings to the table? In which way does it “secure the network”?

  • Kekin@lemy.lol
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    The other day I learned about endlessh. I set that up, switched my actual sshd to listen on a different port, and the ssh login attempts from randoms essentially went down to 0. Pretty neat.

  • wedge_film@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    5
    arrow-down
    2
    ·
    1 year ago

    General advice would be to look boring and hide your IP as much as you are able (get a domain). As long as you’re not looking juicy you won’t attract skilled attention. It’s like locking a bike, most bad actors will just pass by looking around for one without a lock or a real fancy one worth their resources.

    You can utilize Cloudflare’s free offerings, starting with simple stuff. Their DNS Proxy is essentialy a single-click but will help substantially. You can build on top of that with simple WAF rules, such as droping connection attempts from IPs originating from countries notorious for “poking around”. You can also reverse that rule and whitlelist only your country.

    Keep your firewall tight, don’t expose other ports, put your services behind a reverse proxy and redirect everything to HTTPS. Start simple, constantly improve, learn more advanced methods/concepts.

    • Poutinetown@lemmy.ca
      link
      fedilink
      English
      arrow-up
      6
      ·
      1 year ago

      How is getting a domain protecting you IP? Wouldn’t your IP still be accessible even after you link it to a domain?

      • khornechips@yiffit.net
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Yes, but by proxying your traffic via cloudflare your domain will point to their IP instead of yours directly.

  • nbailey@lemmy.ca
    link
    fedilink
    English
    arrow-up
    3
    ·
    1 year ago

    Best advice I can give is to make sure the default virtualhost on nginx/apache just sends a 404 to all requests to your IP, and only serve the apps you want when they’re accessed by the correct hostname. The vast majority of spammy scanners are just hitting all public IPs, so as long as you don’t tell them what you’re hosting you’ll be alright.

    Then, I’d advise having some sort of basic web application firewall (WAF). Modsecurity is a common one, NAXSI is another. These take some time to set up, but are quite good at absorbing attempted attacks.

  • brvslvrnst@lemmy.ml
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    My approach was to set it all up internally, create a wireguard VPN accesspoint and only open that up. That way I don’t have as much to worry as much within the network (still use generated passwords for things) and able to access it anywhere.

    Granted, you asked about opening up to the www. I’d suggest buying a domain through cloudfront, setting up an nginx instance that proxies traffic (think nextcloud.mydomain.com), and have it only accept connections from cloudfront servers.

    That allows you SSL termination, pretty good bot coverage, and a nice domain name to share as needed.

  • datallboy@lemmy.techhaven.io
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    It comes down to using secure passwords, 2 factor authentication, and updating software as soon as you can.

    Check out Cloudflare’s zero tier tunnel to only expose the services you need without port forwarding. Added benefit of masking your home’s IP behind Cloudflare to prevent DDOS. Only downside is you need your own domain.

  • HTTP_404_NotFound@lemmyonline.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Just make sure you know how to properly secure your network, check logs, ensure you have logs. ensure you have backups in a secure location…

    And, be prepared for the constant barrage of vulnerability scans, and login attempts.