How to send emails via a TCP socket listening on localhost on the host? (rootless) #11106
-
Scenario: An SMTP server is listening on localhost port 25 (TCP) on the host. I would like to send emails from Do you have any recommendations of how to do this? (Preferably giving as little permissions to the container as possible). Alternative A:
|
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Does the mail server listen only on localhost(127.0.0.1) or also on your eth0 interface. The container can connect to the eth0 interface ip. Only access to 127.0.0.1 via 10.0.2.2 is blocked by default. |
Beta Was this translation helpful? Give feedback.
-
It only listens on localhost.
Unfortunately I don't have root permissions on the host. Changing this configuration will not be so easy because the host computer is maintained by another group. Thanks, for the idea, though. I'll remember the suggestion as an alternative solution. |
Beta Was this translation helpful? Give feedback.
-
I would not recommend using --net=host unless you really need it. |
Beta Was this translation helpful? Give feedback.
-
Also, if you want to expose your service to the external network (i.e., not via the loopback device The recommended MTU value depends on your egress network device. |
Beta Was this translation helpful? Give feedback.
I would not recommend using --net=host unless you really need it.
I think using
allow_host_loopback=true
is the easiest solution. Security wise, it depends on whether you have something running on 127.0.0.1 that the container should not be allowed to connect to.Using a UDS might be the most secure since you could limit this to one port but I am not sure how complicated this setup is, SELinux could also cause problems in this case.