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.

  • dohpaz42@lemmy.world
    link
    fedilink
    English
    arrow-up
    34
    arrow-down
    3
    ·
    18 days ago

    It’s my understanding that docker uses a lot of fuckery and hackery to do what they do. And IME they don’t seem to care if it breaks things.

    • marcos@lemmy.world
      link
      fedilink
      arrow-up
      28
      ·
      18 days ago

      To be fair, the largest problem here is that it presents itself as the kind of isolation that would respect firewall rules, not that they don’t respect them.

      People wouldn’t make the same mistake in NixOS, despite it doing exactly the same.

    • Guilvareux@feddit.uk
      link
      fedilink
      arrow-up
      5
      arrow-down
      3
      ·
      18 days ago

      I don’t know how much hackery and fuckery there is with docker specifically. The majority of what docker does was already present in the Linux kernel namespaces, cgroups etc. Docker just made it easier to build and ship the isolated environments between systems.

    • null_dot@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      26
      ·
      17 days ago

      I dont really understand the problem with that?

      Everyone is a script kiddy outside of their specific domain.

      I may know loads about python but nothing about database management or proxies or Linux. If docker can abstract a lot of the complexities away and present a unified way you configure and manage them, where’s the bad?

    • LordKitsuna@lemmy.world
      link
      fedilink
      arrow-up
      14
      ·
      17 days ago

      That is definitely one of the crowds but there are also people like me that just are sick and tired of dealing with python, node, ruby depends. The install process for services has only continued to become increasingly more convoluted over the years. And then you show me an option where I can literally just slap down a compose.yml and hit “docker compose up - d” and be done? Fuck yeah I’m using that

    • Appoxo@lemmy.dbzer0.com
      link
      fedilink
      arrow-up
      1
      ·
      17 days ago

      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.

  • ohshit604@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    15
    ·
    17 days ago

    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.

      • ohshit604@sh.itjust.works
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        17 days ago

        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.

          • ohshit604@sh.itjust.works
            link
            fedilink
            English
            arrow-up
            4
            ·
            17 days ago

            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.

            • sip@programming.dev
              link
              fedilink
              arrow-up
              1
              ·
              edit-2
              17 days ago

              I think linux does fstrim oob.

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

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

                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.

  • steventhedev@lemmy.world
    link
    fedilink
    arrow-up
    16
    arrow-down
    1
    ·
    18 days ago

    You’re forgetting the part where they had an option to disable this fuckery, and then proceeded to move it twice - exposing containers to everyone by default.

    I had to clean up compromised services twice because of it.

      • MasterNerd@lemmy.zip
        link
        fedilink
        arrow-up
        2
        ·
        17 days ago

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

        • qaz@lemmy.worldOP
          link
          fedilink
          English
          arrow-up
          1
          ·
          17 days ago

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

          • MasterNerd@lemmy.zip
            link
            fedilink
            arrow-up
            2
            ·
            17 days ago

            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.

            • qaz@lemmy.worldOP
              link
              fedilink
              English
              arrow-up
              2
              ·
              17 days ago

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

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

      have a dedicated firewall

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

  • Harbinger01173430@lemmy.world
    link
    fedilink
    arrow-up
    10
    ·
    17 days ago

    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

  • skuzz@discuss.tchncs.de
    link
    fedilink
    arrow-up
    11
    arrow-down
    2
    ·
    17 days ago

    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.

  • jwt@programming.dev
    link
    fedilink
    arrow-up
    9
    ·
    18 days ago

    Somehow I think that’s on ufw not docker. A firewall shouldn’t depend on applications playing by their rules.

    • qaz@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      16
      ·
      18 days ago

      ufw just manages iptables rules, if docker overrides those it’s on them IMO

      • jwt@programming.dev
        link
        fedilink
        arrow-up
        7
        ·
        18 days ago

        Feels weird that an application is allowed to override iptables though. I get that when it’s installed with root everything’s off the table, but still…

      • null_dot@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        5
        ·
        17 days ago

        Not really.

        Both docker and ufw edit iptables rules.

        If you instruct docker to expose a port, it will do so.

        If you instruct ufw to block a port, it will only do so if you haven’t explicitly exposed that port in docker.

        Its a common gotcha but it’s not really a shortcoming of docker.

      • pressanykeynow@lemmy.world
        link
        fedilink
        arrow-up
        1
        ·
        17 days ago

        iptables is deprecated for like a decade now, the fact that both still use it might be the source of the problem here.

    • IsoKiero@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      6
      ·
      18 days ago

      Docker spesifically creates rules for itself which are by default open to everyone. UFW (and underlying eftables/iptables) just does as it’s told by the system root (via docker). I can’t really blame the system when it does what it’s told to do and it’s been administrators job to manage that in a reasonable way since forever.

      And (not related to linux or docker in any way) there’s still big commercial software which highly paid consultants install and the very first thing they do is to turn the firewall off…

    • qaz@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      4
      ·
      17 days ago

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

  • Ⓜ3️⃣3️⃣ 🌌@lemmy.zip
    link
    fedilink
    arrow-up
    5
    arrow-down
    1
    ·
    18 days ago

    Docker does not play fair, does not play nice. It’s a dozer that plow through everything for devops that yolo and rush to production.

  • purplemonkeymad@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    17 days ago

    Well yea ofc it works like that, the services are not on the same network, so the packets need to be sent onto another adapter. That means either nat or forwarding tables.

    Now if that was a good design of docker is another question.