我有一台带有几个 lxc 容器的主机。我正在尝试根据域名直接授予对容器的 ssh 访问权限。为此,我尝试设置 HAProxy。可以使用 http 模式下的 ACL 轻松实现这一点。当我尝试使用基于 acls 的 ssh 的 tcp 模式时,我无法直接通过 ssh 访问容器。以下是我在 haproxy.cfg 中使用的片段。
listen SSHD :2200
mode tcp
acl is_apple hdr_dom i apple
acl is_orange hdr_dom -i orange
use_backend apple if is_apple
use_backend orange if is_orange
backend apple
mode tcp
server apple 10.0.3.221:22
backend orange
mode tcp
server orange 10.0.3.222:22
Run Code Online (Sandbox Code Playgroud)
其中 apple.myhost.com 和 orange.myhost.com 是访问每个容器的域名。HTTP 代理与这些 acl 配合良好,但我遇到了 SSH 流量问题。
我收到以下错误。
ssh_exchange_identification:连接被远程主机关闭