I set up an exim server in a Debian 10 container with LXD and then created a proxy device to map the SMTP port from the host to the container:
lxc config device add mycontainer myport25 proxy listen=tcp:x.x.x.x:25 connect=tcp:127.0.0.1:25
where x.x.x.x is the host's public IP.
The port forwarding is working fine but, as I expected, the exim logs are showing the local IP instead of the remote servers ones. For example:
2020-10-07 13:45:40 1kQ7t6-0008P1-3M <= firstname.lastname@example.org H=localhost (server.remote.domain.com) [127.0.0.1] P=esmtps X=TLS1.0:RSA_AES_256_CBC_SHA1:256 CV=no S=14259 email@example.com
2020-10-07 13:45:40 1kQ7t6-0008P1-3M => |/usr/local/bin/script.php firstname.lastname@example.org R=myrouter T=myrouter_pipe 2020-10-07 13:45:40 1kQ7t6-0008P1-3M Completed
Is it possible to get exim to show in the logs the forwarded IP instead of 127.0.0.1?
I read https://www.exim.org/exim-html-current/doc/html/spec_html/ch-proxies.html but if I use the hosts_proxy option, my server rejects incoming emails with this error: "503 Command refused, required Proxy negotiation failed".
I know I can forward the port using plain iptables in the host and the private IP of the container but I wonder if I can do it using the proxy feature of LXD.