Looking for guidance of how to configure haproxy 2.4 in a container, to proxy for a mail server (all protocols, imap/s, smtp/s, pop3/s, http/s) and having haproxy doing ssl termination, but also sending properly to the encrypted ports (pop3s, imap/s, especially) on the backend mail server.
Here is my configuration:
frontend smtp-in
bind *:25
mode tcp
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend smtp if { req_ssl_sni -i mailer.example.com }
frontend imap-in
bind *:143
mode tcp
tcp-request inspect-delay 5s
tcp-request content accept if { req_ssl_hello_type 1 }
use_backend imap if { req_ssl_sni -i mailer.example.com }
frontend smtps-in
bind *:587 ssl crt /usr/local/etc/haproxy/ssl
mode tcp
tcp-request inspect-delay 5s
use_backend smtps
frontend imaps-in
bind *:993 ssl crt /usr/local/etc/haproxy/ssl
mode tcp
tcp-request inspect-delay 5s
use_backend imaps
frontend pops-in
bind *:995 ssl crt /usr/local/etc/haproxy/ssl
mode tcp
tcp-request inspect-delay 5s
use_backend pops
log /dev/log local0 info
frontend pop-in
bind *:110
mode tcp
tcp-request inspect-delay 5s
use_backend pop
backend smtp
mode tcp
server mailserver 192.168.2.254:25
backend imap
mode tcp
server mailserver 192.168.2.254:143
backend smtps
mode tcp
server mailserver 192.168.2.254:587
backend imaps
mode tcp
server mailserver 192.168.2.254:993
backend https
mode tcp
server mailserver 192.168.2.254:443
backend pop
mode tcp
server mailserver 192.168.2.254:110
backend pops
mode tcp
server mailserver 192.168.2.254:995
I am testing with pop3/s and so far requests are being rejected for SSL(pop3), and odd timeouts (pop3s).
Am I doing this correctly? Can someone please enlighten me?