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. Programmer Humor
  3. Context: Docker bypasses all UFW firewall rules

Context: Docker bypasses all UFW firewall rules

Scheduled Pinned Locked Moved Programmer Humor
programmerhumor
104 Posts 58 Posters 0 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.
  • Q [email protected]

    Also when using a rootfull Podman socket?

    D This user is from outside of this forum
    D This user is from outside of this forum
    [email protected]
    wrote last edited by
    #88

    When running as root, I did not need to add the firewall rule.

    Q 1 Reply Last reply
    2
    • S [email protected]

      My impression from a recent crash course on Docker is that it got popular because it allows script kiddies to spin up services very fast without knowing how they work.

      OWASP was like "you can follow these thirty steps to make Docker secure, or just run Podman instead." https://cheatsheetseries.owasp.org/cheatsheets/Docker_Security_Cheat_Sheet.html

      appoxo@lemmy.dbzer0.comA This user is from outside of this forum
      appoxo@lemmy.dbzer0.comA This user is from outside of this forum
      [email protected]
      wrote last edited by
      #89

      Another take: Why should I care about dependency hell if I can just spin up the same service on the same machine without needing an additional VM and with minimal configuration changes.

      1 Reply Last reply
      0
      • Q [email protected]

        Docker docs:

        Docker routes container traffic in the nat table, which means that packets are diverted before it reaches the INPUT and OUTPUT chains that ufw uses. Packets are routed before the firewall rules can be applied, effectively ignoring your firewall configuration.

        H This user is from outside of this forum
        H This user is from outside of this forum
        [email protected]
        wrote last edited by
        #90

        Nat is not security.

        Keep that in mind.

        It's just a crutch ipv4 has to use because it's not as powerful as the almighty ipv6

        Q 1 Reply Last reply
        10
        • K [email protected]

          Try podman and quadlets

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

          What advantage does it have over nspawn?

          1 Reply Last reply
          0
          • H [email protected]

            Nat is not security.

            Keep that in mind.

            It's just a crutch ipv4 has to use because it's not as powerful as the almighty ipv6

            Q This user is from outside of this forum
            Q This user is from outside of this forum
            [email protected]
            wrote last edited by
            #92

            Counterpoint

            1 Reply Last reply
            1
            • D [email protected]

              When running as root, I did not need to add the firewall rule.

              Q This user is from outside of this forum
              Q This user is from outside of this forum
              [email protected]
              wrote last edited by
              #93

              Thanks for checking

              1 Reply Last reply
              1
              • Q [email protected]

                The VPS I'm using unfortunately doesn't offer an external firewall

                M This user is from outside of this forum
                M This user is from outside of this forum
                [email protected]
                wrote last edited by
                #94

                Well, if you have the option you could set up a virtual network through the VPS and have a box with pfsense or something to route all traffic through. Take this with a grain of salt - I've seen this done but never done it fully myself.

                Q 1 Reply Last reply
                1
                • M [email protected]

                  Well, if you have the option you could set up a virtual network through the VPS and have a box with pfsense or something to route all traffic through. Take this with a grain of salt - I've seen this done but never done it fully myself.

                  Q This user is from outside of this forum
                  Q This user is from outside of this forum
                  [email protected]
                  wrote last edited by
                  #95

                  I've just disabled all incoming connections (including SSH etc.) and access everything through WireGuard

                  1 Reply Last reply
                  1
                  • diplomjodler3@lemmy.worldD [email protected]

                    Or maybe it should be easy to configure correctly?

                    R This user is from outside of this forum
                    R This user is from outside of this forum
                    [email protected]
                    wrote last edited by
                    #96

                    instructions unclear, now its hard to use and to configure

                    1 Reply Last reply
                    1
                    • M [email protected]

                      I mean if you're hosting anything publicly, you really should have a dedicated firewall

                      ohshit604@sh.itjust.worksO This user is from outside of this forum
                      ohshit604@sh.itjust.worksO This user is from outside of this forum
                      [email protected]
                      wrote last edited by
                      #97

                      have a dedicated firewall

                      I mean, don’t router firewalls count in this regard? Isn’t that kinda part of their job?

                      1 Reply Last reply
                      0
                      • S [email protected]

                        I think linux does fstrim oob.

                        edit: I meant to say linux distros are set up to do that automatically.

                        ohshit604@sh.itjust.worksO This user is from outside of this forum
                        ohshit604@sh.itjust.worksO This user is from outside of this forum
                        [email protected]
                        wrote last edited by [email protected]
                        #98

                        It’s been about a day since this issue and now I’ve been keeping a close eye on my local-lvm, it fills fast, like, ridiculously fast and I’ve been having to run sudo fstrim / inside the VM just to keep it maintained. I’m finding it weird I’m now just noticing this as this server has been running for months!

                        For now I edited my /etc/bash.bashrc so whenever I ssh in it’ll automatically run sudo fstrim /, there is something I’m likely missing but this works as a temporary solution.

                        1 Reply Last reply
                        0
                        • grrgyle@slrpnk.netG [email protected]

                          I exposed them because I used the container for local development too. I just kept reseeding every time it got hacked before I figured I should actually look into security.

                          firelizzard@programming.devF This user is from outside of this forum
                          firelizzard@programming.devF This user is from outside of this forum
                          [email protected]
                          wrote last edited by
                          #99

                          Where are you working that your local machine is regularly exposed to malicious traffic?

                          grrgyle@slrpnk.netG 1 Reply Last reply
                          0
                          • firelizzard@programming.devF [email protected]

                            Where are you working that your local machine is regularly exposed to malicious traffic?

                            grrgyle@slrpnk.netG This user is from outside of this forum
                            grrgyle@slrpnk.netG This user is from outside of this forum
                            [email protected]
                            wrote last edited by
                            #100

                            My use case was run a mongodb container on my local, while I run my FE+BE with fast live-reloading outside of a container. Then package it all up in services for docker compose on the remote.

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

                              For local access you can use 127.0.0.1:80:80 and it won't put a hole in your firewall.

                              Or if your database is access by another docker container, just put them on the same docker network and access via container name, and you don't need any port mapping at all.

                              grrgyle@slrpnk.netG This user is from outside of this forum
                              grrgyle@slrpnk.netG This user is from outside of this forum
                              [email protected]
                              wrote last edited by
                              #101

                              Yeah, I know that now lol, but good idea to spell it out. So what Docker does, which is so confusing when you first discover the behaviour, is it will bind your ports automatically to 0.0.0.0 if all you specify is 27017:27017 as you port (without an IP address prefixing). AKA what the meme is about.

                              1 Reply Last reply
                              0
                              • grrgyle@slrpnk.netG [email protected]

                                My use case was run a mongodb container on my local, while I run my FE+BE with fast live-reloading outside of a container. Then package it all up in services for docker compose on the remote.

                                firelizzard@programming.devF This user is from outside of this forum
                                firelizzard@programming.devF This user is from outside of this forum
                                [email protected]
                                wrote last edited by
                                #102

                                Ok… but that doesn’t answer my question. Where are you physically when you’re working on this that people are attacking exposed ports? I’m either at home or in the office, and in either case there’s an external firewall between me and any assholes who want to exploit exposed ports. Are your roommates or coworkers those kinds of assholes? Or are you sitting in a coffee shop or something?

                                grrgyle@slrpnk.netG 1 Reply Last reply
                                1
                                • firelizzard@programming.devF [email protected]

                                  Ok… but that doesn’t answer my question. Where are you physically when you’re working on this that people are attacking exposed ports? I’m either at home or in the office, and in either case there’s an external firewall between me and any assholes who want to exploit exposed ports. Are your roommates or coworkers those kinds of assholes? Or are you sitting in a coffee shop or something?

                                  grrgyle@slrpnk.netG This user is from outside of this forum
                                  grrgyle@slrpnk.netG This user is from outside of this forum
                                  [email protected]
                                  wrote last edited by [email protected]
                                  #103

                                  This was on a VPS (remote) where I didn't realise Docker was even capable of punching through UFW. I assumed (incorrectly) that if a port wasn't reversed proxied in my nginx config, then it would remain on localhost only.

                                  Just run docker run -p 27017:27017 mongo:latest on a VPS and check the default collections after a few hours and you'll likely find they're replaced with a ransom message.

                                  firelizzard@programming.devF 1 Reply Last reply
                                  0
                                  • grrgyle@slrpnk.netG [email protected]

                                    This was on a VPS (remote) where I didn't realise Docker was even capable of punching through UFW. I assumed (incorrectly) that if a port wasn't reversed proxied in my nginx config, then it would remain on localhost only.

                                    Just run docker run -p 27017:27017 mongo:latest on a VPS and check the default collections after a few hours and you'll likely find they're replaced with a ransom message.

                                    firelizzard@programming.devF This user is from outside of this forum
                                    firelizzard@programming.devF This user is from outside of this forum
                                    [email protected]
                                    wrote last edited by
                                    #104

                                    Ah, when you said local I assumed you meant your physical device

                                    1 Reply Last reply
                                    1
                                    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