Hello everyone,
So I am trying to setup SNI routing in my OPNsense with haproxy and got everything almost setup but there is still a key issue in my Configuration:
Since I am NOT SSL Offloading and instead passing traffic straight to the Webserver, I cannot make use of any http header (Layer 4) my frontend is set to TCP. No it seems, that SNIs are not consistently received (or I am using the wrong way to access them)...'
Some times I DO get an SNI and sometimes it is just empty I am running a custom Lua Script but for the sake of this Thread only this snippet is important:
I noticed there were multiple functions to get the SNI but both seem to result in the same seemingly random output.
Has anyone an idea to why this is happening or if this is just a fundamental flaw in TCP Passthrough...?
Thanks in advance!
So I am trying to setup SNI routing in my OPNsense with haproxy and got everything almost setup but there is still a key issue in my Configuration:
Since I am NOT SSL Offloading and instead passing traffic straight to the Webserver, I cannot make use of any http header (Layer 4) my frontend is set to TCP. No it seems, that SNIs are not consistently received (or I am using the wrong way to access them)...'
Some times I DO get an SNI and sometimes it is just empty I am running a custom Lua Script but for the sake of this Thread only this snippet is important:
Code Select
-- resolve backend for a given host
function resolve_backend(txn)
local host = txn.sf:req_ssl_sni()
local host_tcp = txn.f:ssl_fc_sni()
core.Info("Got SNI of "..host)
core.Info("Got SNI of "..host_tcp)
end
core.register_action("resolve_backend", {"tcp-req"}, resolve_backend)
HAProxy ConfigCode Select
frontend https_frontend
bind 0.0.0.0:443 name 0.0.0.0:443
mode tcp
default_backend server1
# logging options
# ACTION: resolve_backend_lua
# NOTE: actions with no ACLs/conditions will always match
tcp-request content lua.resolve_backend
# ACTION: sni_hostname_lua
# NOTE: actions with no ACLs/conditions will always match
use_backend %[var(txn.backend)]
I noticed there were multiple functions to get the SNI but both seem to result in the same seemingly random output.
Has anyone an idea to why this is happening or if this is just a fundamental flaw in TCP Passthrough...?
Thanks in advance!