Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Selfhosted
  3. What steps do you take to secure your server and your selfhosted services?

What steps do you take to secure your server and your selfhosted services?

Scheduled Pinned Locked Moved Selfhosted
selfhosted
58 Posts 32 Posters 470 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O [email protected]

    How has that been going?

    ikidd@lemmy.worldI This user is from outside of this forum
    ikidd@lemmy.worldI This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #36

    "All your containers are belong to us."

    1 Reply Last reply
    0
    • C [email protected]

      Some I haven't yet found in this thread:

      • rootless podman
      • container port mapping to localhost (e.g. 127.0.0.1:8080:8080)
      • systemd services with many of its sandboxing features (PrivateTmp, ...)
      ikidd@lemmy.worldI This user is from outside of this forum
      ikidd@lemmy.worldI This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #37

      I assume #2 is just to keep containers/stacks able to talk to each other without piercing the firewall for ports that aren't to be exposed to the outside? It wouldn't prevent anything if one of the containers on that host were compromised, afaik.

      mangopenguin@lemmy.blahaj.zoneM C 2 Replies Last reply
      0
      • akatsukilevi@lemmy.worldA [email protected]

        Disable password authentication on SSH

        Enable firewall and block all ports you're not using(most firewalls do this by default)

        Switch to a LTS kernel(not security related, but it keeps things going smooth... Technically it is safer since it gets updated less often so it is a bit more battle tested? Never investigated whenever a LTS kernel is safer than a standard one)

        Use Caddy to proxy to services instead of directly exposing them out

        HTTPS for web stuff(Caddy does it automatically)

        ? Offline
        ? Offline
        Guest
        wrote on last edited by
        #38

        Caddy or any other (reputable) reverse proxy. I think Nginx Proxy Manager would be best for beginner thanks to GUI.

        1 Reply Last reply
        0
        • shimitar@downonthestreet.euS [email protected]

          This, but I prefer nginx.

          And no real need for tailscale or cloudflare. If you do not like to depend on a third party service, either port forward and ddns or an external vps+wire guard if you have gcnat

          ? Offline
          ? Offline
          Guest
          wrote on last edited by
          #39

          This is a valid solution but honestly how is using VPS not depending on third party?

          shimitar@downonthestreet.euS 1 Reply Last reply
          0
          • O [email protected]

            Inspired by this comment to try to learn what I'm missing.

            • Cloudflare proxy
            • Reverse Proxy
            • Fail2ban
            • Docker containers on their own networks
            mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
            mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #40

            They aren't on the internet mainly.

            1 Reply Last reply
            0
            • ikidd@lemmy.worldI [email protected]

              I assume #2 is just to keep containers/stacks able to talk to each other without piercing the firewall for ports that aren't to be exposed to the outside? It wouldn't prevent anything if one of the containers on that host were compromised, afaik.

              mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
              mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
              [email protected]
              wrote on last edited by
              #41

              Containers can talk to each other without any ports exposed at all, they just need to be added to the same docker network.

              ikidd@lemmy.worldI 1 Reply Last reply
              0
              • O [email protected]

                Inspired by this comment to try to learn what I'm missing.

                • Cloudflare proxy
                • Reverse Proxy
                • Fail2ban
                • Docker containers on their own networks
                oderus@lemmy.worldO This user is from outside of this forum
                oderus@lemmy.worldO This user is from outside of this forum
                [email protected]
                wrote on last edited by
                #42

                NPM, Nginx

                If I need remote access, I just log into NPM and I have certain URL's created for Plex, or Sonarr, Radarr etc. No issues so far.

                1 Reply Last reply
                0
                • ikidd@lemmy.worldI [email protected]

                  I assume #2 is just to keep containers/stacks able to talk to each other without piercing the firewall for ports that aren't to be exposed to the outside? It wouldn't prevent anything if one of the containers on that host were compromised, afaik.

                  C This user is from outside of this forum
                  C This user is from outside of this forum
                  [email protected]
                  wrote on last edited by
                  #43

                  It's mostly to allow the reverse proxy on localhost to connect to the container/service, while blocking all other hosts/IPs.

                  This is especially important when using docker as it messes with iptables and can circumvent firewall like e.g. ufw.

                  You're right that it doesn't increase security on case of a compromised container. It's just about outside connections.

                  ikidd@lemmy.worldI 1 Reply Last reply
                  0
                  • ? Guest

                    This is a valid solution but honestly how is using VPS not depending on third party?

                    shimitar@downonthestreet.euS This user is from outside of this forum
                    shimitar@downonthestreet.euS This user is from outside of this forum
                    [email protected]
                    wrote on last edited by
                    #44

                    It is, but you are free to switch at any time provider, there is no technological lock in like with cloudflare or tailscale (i know there is a free self hostable version, not talking about that).

                    So just rent a new one and switch your wireguard there.

                    1 Reply Last reply
                    0
                    • mangopenguin@lemmy.blahaj.zoneM [email protected]

                      Containers can talk to each other without any ports exposed at all, they just need to be added to the same docker network.

                      ikidd@lemmy.worldI This user is from outside of this forum
                      ikidd@lemmy.worldI This user is from outside of this forum
                      [email protected]
                      wrote on last edited by
                      #45

                      I was getting more at stacks on a host talking, ie: you have a postgres stack with PG and Pgadmin, but want to use it with other stacks or k8s swarm, without exposing the pg port outside the machine.

                      mangopenguin@lemmy.blahaj.zoneM 1 Reply Last reply
                      0
                      • C [email protected]

                        It's mostly to allow the reverse proxy on localhost to connect to the container/service, while blocking all other hosts/IPs.

                        This is especially important when using docker as it messes with iptables and can circumvent firewall like e.g. ufw.

                        You're right that it doesn't increase security on case of a compromised container. It's just about outside connections.

                        ikidd@lemmy.worldI This user is from outside of this forum
                        ikidd@lemmy.worldI This user is from outside of this forum
                        [email protected]
                        wrote on last edited by
                        #46

                        OK, yah, that's what I was getting at.

                        1 Reply Last reply
                        0
                        • ikidd@lemmy.worldI [email protected]

                          I was getting more at stacks on a host talking, ie: you have a postgres stack with PG and Pgadmin, but want to use it with other stacks or k8s swarm, without exposing the pg port outside the machine.

                          mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
                          mangopenguin@lemmy.blahaj.zoneM This user is from outside of this forum
                          [email protected]
                          wrote on last edited by
                          #47

                          You can do that by joining the containers to the same docker network, you don't need to expose ports even to localhost.

                          ikidd@lemmy.worldI 1 Reply Last reply
                          0
                          • mangopenguin@lemmy.blahaj.zoneM [email protected]

                            You can do that by joining the containers to the same docker network, you don't need to expose ports even to localhost.

                            ikidd@lemmy.worldI This user is from outside of this forum
                            ikidd@lemmy.worldI This user is from outside of this forum
                            [email protected]
                            wrote on last edited by
                            #48

                            I mustn't be communicating well, but that's fine.

                            1 Reply Last reply
                            0
                            • O [email protected]

                              Inspired by this comment to try to learn what I'm missing.

                              • Cloudflare proxy
                              • Reverse Proxy
                              • Fail2ban
                              • Docker containers on their own networks
                              M This user is from outside of this forum
                              M This user is from outside of this forum
                              [email protected]
                              wrote on last edited by
                              #49

                              As many others have said, not allowing inbound WAN connections into my LAN is an important step. I also run k3s on my server with Calico as the CNI and make heavy use of network policies to keep anything I’m running from misbehaving. That, along with easy ingress makes k3s worth it for me over Docker Compose. I use OpenWRT on my router and force certain devices to run through a VPN and block other devices from the internet entirely.

                              1 Reply Last reply
                              0
                              • I [email protected]

                                There are ip lists that let you iptables drop all traffic from China and Russia.

                                Strongly recommend.

                                L This user is from outside of this forum
                                L This user is from outside of this forum
                                [email protected]
                                wrote on last edited by
                                #50

                                My UDM has this capability. I've blocked quite a few countries that it logged as trying to get into my network. Great little internet cylinder.

                                I 1 Reply Last reply
                                0
                                • O [email protected]

                                  Inspired by this comment to try to learn what I'm missing.

                                  • Cloudflare proxy
                                  • Reverse Proxy
                                  • Fail2ban
                                  • Docker containers on their own networks
                                  X This user is from outside of this forum
                                  X This user is from outside of this forum
                                  [email protected]
                                  wrote on last edited by
                                  #51

                                  To add some points, that I do:

                                  • Proper logging: So I could realize something unusual is going on
                                  • rootless podman container: harder to escalate privileges and gain root
                                  • Apparmor: same, plus it could trigger suspicious log entries
                                  1 Reply Last reply
                                  0
                                  • C [email protected]

                                    Some I haven't yet found in this thread:

                                    • rootless podman
                                    • container port mapping to localhost (e.g. 127.0.0.1:8080:8080)
                                    • systemd services with many of its sandboxing features (PrivateTmp, ...)
                                    O This user is from outside of this forum
                                    O This user is from outside of this forum
                                    [email protected]
                                    wrote on last edited by
                                    #52

                                    Does adding 127.0.0.1 make it so only that server can access it or what? I’ve seen that but not understand

                                    C 1 Reply Last reply
                                    0
                                    • L [email protected]

                                      My UDM has this capability. I've blocked quite a few countries that it logged as trying to get into my network. Great little internet cylinder.

                                      I This user is from outside of this forum
                                      I This user is from outside of this forum
                                      [email protected]
                                      wrote on last edited by
                                      #53

                                      Have the rack mounted one, I usually roll my own router but I'm glad to have someone else making sure I don't do anything stupid for security.

                                      It's not perfect, but it's peace of mind.

                                      1 Reply Last reply
                                      0
                                      • H [email protected]

                                        One thing I do is instead of having an open SSH port, I have an OpenVPN server that I’ll connect to, then SSH to the host from within the network. Then, if someone hacks into the network, they still won’t have SSH access.

                                        O This user is from outside of this forum
                                        O This user is from outside of this forum
                                        [email protected]
                                        wrote on last edited by
                                        #54

                                        Thanks 🙂

                                        1 Reply Last reply
                                        0
                                        • C [email protected]

                                          I do the same, but with Wireguard instead of OpenVPN. The performance is much better in my experience and it sucks less battery life.

                                          O This user is from outside of this forum
                                          O This user is from outside of this forum
                                          [email protected]
                                          wrote on last edited by
                                          #55

                                          I’ve been meaning to learn how to make my own

                                          C 1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups