view the rest of the comments
Selfhosted
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam posting.
-
Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.
-
Don't duplicate the full text of your blog or github here. Just post the link for folks to click.
-
Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
Sockets are filesystem objects, similar to a file. So for 2 containers to access the same socket, the container exposing the socket must export it to the host filesystem via a
bind
mount/volume, and the container that needs read/write on this socket must be able to access it, also via a bind mount. The user ID or groups of the user accessing the socket must be allowed to access the socket via traditional unix permissions.Again, I personally do not bother with this, I run the reverse proxy directly on the host, and configure it to forward traffic over HTTP on the loopback interface to the containers. [1] [2] [3] and many others lead me to think the risk is acceptable in my particular case. If I was forced to do otherwise, 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.
I have a few services exposing a unix socket (mainly php-fpm) instead of a HTTP/localhost socket, in this case I just point the RP at these sockets (e.g.
ProxyPass unix:/run/php/php8.2-fpm.sock
). If the php-fpm process was running in a container, I'd just export/run/php/php8.2-fpm.sock
from the container to/some/place/myapp/php.sock
on the host, and target this from the RP instead.You need to think about what actual attacks could actually happen, what kind of damage they would be able to do, and mitigate from there.
That's a separate question. I use ansible for all deployment/automation needs - when it comes to podman I use the podman_container and podman_generate_systemd modules to automate deployment of containers as systemd services. Ansible also configures my reverse proxy to forward traffic to the container (simply copy files in
/etc/apache2/sites-available/...; a2enconf; systemctl reload apache2
). I have not used pods yet, but there is a podman_pod module. A simple bash script should also do the trick in a first time.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.
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, ...
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!
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.
No, they can't, that's the point of namespaces.
Even if containers from different pods are put in an arbitrary namespace?
Ex:
Will they be able to connect via loopback?