我正在configurationHAProxy,以便终止SSL,因此只有一个地方可以configuration购买的SSL证书。 不过,我宁愿与后端服务器的连接也使用SSL进行encryption。
我发现的一个build议是在后端服务器上创build自签名证书,然后在每个服务器行上设置“verify none”。 …因此,从浏览器到HAProxy的连接将使用正式购买的SSL证书,但是HAProxy到后端服务器的连接将使用自签名证书。 自签证书的好处是免费,不需要更新和维护(我可以在将来设置到期,避免每年都要安装新版本)。 然而,可以理解的是,这会打开MITM攻击的后端,而且我读过的一些消息并不build议这样做。
我可以configurationHAProxy,以便我可以在后端服务器上使用自签名证书,但可能会将HAProxy服务器上的自签名证书列入白名单? …所以HAProxy到后台连接将被encryption,它不会受到MITM攻击,HAProxy将知道信任来自后端服务器的自签名证书。
我所描述的是可能的吗? 我是HAProxy SSLterminal新手,所以任何意见是赞赏。
我的configuration的相关部分如下:
frontend www-in bind *:80 bind *:443 ssl crt /etc/ssl-keys/my-public-ssl-key.pem no-sslv3 mode http default_backend https-backend # force redirect to https redirect scheme https if !{ ssl_fc } backend https-backend balance leastconn server web1 1.1.1.1:443 check ssl verify none server web2 2.2.2.2:443 check ssl verify none http-request set-header X-Forwarded-Port %[dst_port] http-request add-header X-Forwarded-Proto https if { ssl_fc }
这个问题与HAProxy并没有真正的联系,而是一般pipe理证书和证书的权限。
不知道你正在使用哪个操作系统,因为你没有说明这一点,但如果它是一些Linux的味道(尽pipe以下适用于Debian和衍生品):
确保你已经安装了包ca-certificates 。
您正在使用您自己的证书颁发机构 (ca)创build您的证书。
把your ca root cert放在/usr/local/share/ca-certificates/name-of-your-ca/ 。 (您可能必须自己创build文件夹name-of-your-ca 。)确保your ca root cert具有.crt扩展名。
(默认情况下, /usr/local/share/ca-certificates/由root:staff ,所以使用sudo或root来执行此操作。)
执行update-ca-certificates (通过sudo / as root )。
执行后,应该有一个文件/etc/ssl/cert/your-ca-root.pem链接到/usr/local/share/ca-certificates/name-of-your-ca/your-ca-root.crt 。
在HAProxy启用validation并获利。