@@ -82,15 +82,16 @@ frontend ft_http
82
82
83
83
# Frontend for SSH and other TCP traffic
84
84
frontend ft_ssh
85
- bind :::2222 v4v6
86
- #ssl crt /etc/haproxy/certs/ssl.pem
85
+ bind :::2222 v4v6 ssl crt /etc/haproxy/certs/
87
86
mode tcp
88
87
89
- # For SSH connections, we need a different approach
90
- # For this example, assume connections to port 22 go to fixed backends based on client source
91
- #tcp-request content set-var(sess.dst) ssl_fc_sni
88
+ # example ssh command
89
+ # /usr/bin/ssh -o ProxyCommand="openssl s_client -quiet -connect echo.agot.be:2222 -servername echo.agot.be" -l ubuntu dummyName
90
+ # see https://www.haproxy.com/blog/route-ssh-connections-with-haproxy#route-ssh-connections-with-haproxy
91
+
92
+ log -format "SSH %ci:%cp %ft %b/%s %Tw/%Tc/%Tt %B %ts %ac/%fc/%bc/%sc/%rc %sq/%bq dst:%[var(txn.sni)] "
93
+ tcp-request content set-var(txn.sni) ssl_fc_sni
92
94
use_backend bk_ssh
93
- #default_backend bk_default_ssl
94
95
95
96
# Dynamic backends that will be populated with servers at runtime
96
97
backend bk_ssl
@@ -100,8 +101,8 @@ backend bk_ssl
100
101
# For HTTPS - Use SNI
101
102
acl server_found var(txn.sni),lower,map(/etc/haproxy/https_domains.map) -m found
102
103
use-server %[var(txn.sni),lower,map(/etc/haproxy/https_domains.map)] if server_found
103
- use-server fallback_local unless server_found
104
- server fallback_local 127.0.0.1:4443 send-proxy
104
+ use-server fallback_local unless server_found
105
+ server fallback_local 127.0.0.1:4443 send-proxy
105
106
106
107
backend bk_ssh
107
108
mode tcp
0 commit comments