Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • 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
105 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.
  • ohshit604@sh.itjust.worksO [email protected]

    This post inspired me to try podman, after it pulled all the images it needed my Proxmox VM died, VM won’t boot cause disk is now full. It’s currently 10pm, tonight’s going to suck.

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

    eh, booting into single user mod should work fine, uninstall podman and init 5

    ohshit604@sh.itjust.worksO 1 Reply Last reply
    2
    • S [email protected]

      eh, booting into single user mod should work fine, uninstall podman and init 5

      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]
      #73

      Okay so I’ve done some digging and got my VM to boot up! This is not Podman’s fault, I got lazy setting up Proxmox and never really learned LVM volume storage, while internally on the VM it shows 90Gb used of 325Gb Proxmox is claiming 377Gb is used on the LVM-Thin partition.

      I’m backing up my files as we speak, thinking of purging it all and starting over.

      Edit: before I do the sacrificial purge This seems promising.

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

        veganpizza69@lemmy.vgV This user is from outside of this forum
        veganpizza69@lemmy.vgV This user is from outside of this forum
        [email protected]
        wrote last edited by
        #74

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

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

          We use Firewalld integration with Docker instead due to issues with UFW. Didn't face any major issues with it.

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

            That caused issues with Docker containers being unable to communicate with eachother for me.

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

            Did you allow the containers to talk to eachother with ufw after setting it up?

            Q 1 Reply Last reply
            0
            • ohshit604@sh.itjust.worksO [email protected]

              Okay so I’ve done some digging and got my VM to boot up! This is not Podman’s fault, I got lazy setting up Proxmox and never really learned LVM volume storage, while internally on the VM it shows 90Gb used of 325Gb Proxmox is claiming 377Gb is used on the LVM-Thin partition.

              I’m backing up my files as we speak, thinking of purging it all and starting over.

              Edit: before I do the sacrificial purge This seems promising.

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

              thinking of purging it all and starting over.

              Don't do that. You'll learn nothing.

              ohshit604@sh.itjust.worksO 1 Reply Last reply
              3
              • 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.

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

                rootless podman and sockets ❤️

                1 Reply Last reply
                5
                • S [email protected]

                  thinking of purging it all and starting over.

                  Don't do that. You'll learn nothing.

                  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
                  #79

                  So I happened to follow the advice from that Proxmox post, enabled the “Discard” option for the disk and ran sudo fstrim / within the VM, now the Proxmox LVM-Thin partition is sitting at a comfortable 135Gb out of 377Gb.

                  Think I’m going to use this fstrim command on my main desktop to free up space.

                  S 1 Reply Last reply
                  3
                  • D [email protected]

                    I DIDNT KNOW THAT! WOW, this puts “not to use network_mode: host” another level.

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

                    Actually I believe host networking would be the one case where this isn't an issue. Docker isn't adding iptables rules to do NAT masquerading because there is no IP forwarding being done.

                    When you tell docker to expose a port you can tell it to bind to loopback and this isn't an issue.

                    1 Reply Last reply
                    1
                    • T [email protected]

                      Did you allow the containers to talk to eachother with ufw after setting it up?

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

                      Yes, you can fix it by doing this

                      echo "Adding rules for Docker subnets to allow communication between containers..."
                      for subnet in $(docker network inspect bridge -f '{{range .IPAM.Config}}{{.Subnet}} {{end}}'); 
                          sudo ufw allow from $subnet
                          echo "Added rule for $subnet"
                      done
                      
                      1 Reply Last reply
                      1
                      • I [email protected]

                        We use Firewalld integration with Docker instead due to issues with UFW. Didn't face any major issues with it.

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

                        I also ended up using firewalld and it mostly worked, although I first had to change some zone configs.

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

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

                          For all the raving about podman, it's dumb too. I've seen multiple container networks stupidly route traffic across each other when they shouldn't. Yay services kept running, but it defeats the purpose. Networking should be so hard that it doesn't work unless it is configured correctly.

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

                            For all the raving about podman, it's dumb too. I've seen multiple container networks stupidly route traffic across each other when they shouldn't. Yay services kept running, but it defeats the purpose. Networking should be so hard that it doesn't work unless it is configured correctly.

                            diplomjodler3@lemmy.worldD This user is from outside of this forum
                            diplomjodler3@lemmy.worldD This user is from outside of this forum
                            [email protected]
                            wrote last edited by
                            #84

                            Or maybe it should be easy to configure correctly?

                            R S 2 Replies Last reply
                            12
                            • Q [email protected]

                              Do you mean a hardware 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
                              #85

                              Basically yeah, though I didn't specify hardware because of how often virtualization is done now

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

                                Basically yeah, though I didn't specify hardware because of how often virtualization is done now

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

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

                                M 1 Reply Last reply
                                0
                                • ohshit604@sh.itjust.worksO [email protected]

                                  So I happened to follow the advice from that Proxmox post, enabled the “Discard” option for the disk and ran sudo fstrim / within the VM, now the Proxmox LVM-Thin partition is sitting at a comfortable 135Gb out of 377Gb.

                                  Think I’m going to use this fstrim command on my main desktop to free up space.

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

                                  I think linux does fstrim oob.

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

                                  ohshit604@sh.itjust.worksO 1 Reply Last reply
                                  0
                                  • 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
                                          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