Hi everyone.

I was trying to research about how to implement SSL on the traffic between my clients and the containers that I host on my server.

Basically, my plan was to use upstream SSL in HAProxy to attempt to achieve this, but in order for that to work, each individual container on my server needs to be able to decrypt SSL. I do not think that is possible and that every container has the necessary libraries for it. This puts a halt on my idea for upstream encryption of traffic from my reverse-proxy to my containers.

With that said, ChatGPT suggested I use Kubernetes with a service mesh like Istio. The idea was intriguing so I started to read about it; but before I dive head-first into using k3s (TBH it’s overkill for my setup), is there any way to implement server-side encryption with podman containers and a reverse-proxy?

After writing all of this, I think I’m missing the point about a reverse-proxy being an SSL termination endpoint, but if my question makes sense to you, please let me know your thoughts!

Thanks!

  • MigratingtoLemmy@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    I would probably look into plugging the RP into the appropriate podman network namespaces, or running it on a dedicated host (VM/physical - this time using SSL/TLS between RP and applications, since traffic leaves the host) and implementing port forwarding/firewalling with netfilter.

    Could you detail how you would do this? Especially since the containers in my case do not support HTTPS (they do not have the libraries compiled, if I’m not wrong).

    Thank you for the clarification. I do not think I’ll be running malicious containers inside my pods, but I would like to contain unencrypted traffic as much as possible. Running an RP for every pod seems doable and since I reach containers through their loopback address inside the pod, this is reasonably safe for my use-case too.

    Could you confirm if one can reach one’s containers on the loopback address in a separate network namespace on podman? I was wondering about the differences between a pod and a network namespace on podman, and so far the only mention of something like this is that containers in pods share a “security context”. I don’t know enough to understand what this is since I haven’t read about pods in Kubernetes.

    Thanks, I was planning to use Ansible too.

    • vegetaaaaaaa@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Could you detail how you would do this?

      I would re-read all docs about podman networking, different network modes, experiment with systemd PrivateNetwork option, re-read some basic about network namespaces, etc ;) I have no precise guide as I’ve never attempted it, so I would do some research, trial and error, take notes, etc, which is the stage you’re at.

      Edit: https://www.cloudnull.io/2019/04/running-services-in-network-name-spaces-with-systemd/,https://gist.github.com/rohan-molloy/35d5ccf03e4e6cbd03c3c45528775ab3, …

      Could you confirm if one can reach one’s containers on the loopback address in a separate network namespace on podman?

      I think each pod uses its own network namespace [1]. You should check the docs and experiment (ip netns, ip addr, ip link, ip route...).

      I think it’s doable, but pretty much uncharted territory - at least the docs for basic building blocks exist, but I’ve never come across a real world example of how to do this. So if you go this way, you will be on your own debugging, documenting and maintaining the system and fixing it when it breaks. It will be an interesting learning experiment though, hope you can document and share the outcome. Good luck!

      • MigratingtoLemmy@lemmy.worldOP
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Thank you, I do realise that each pod uses its own namespace. I was talking about if containers part of a different network namespace (outside of their pods) could also reach out to each other via the loopback address.

          • MigratingtoLemmy@lemmy.worldOP
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            Even if containers from different pods are put in an arbitrary namespace?

            Ex:

            • pod 1 - network: pod1
            • pod 2 - network: pod2
            • Container1 and Container2 are spun up within these pods respectively, whilst also being attached to network: pod3

            Will they be able to connect via loopback?