2017-04-03 152 views
0

的HAProxy的文档(http://cbonte.github.io/haproxy-dconv/1.7/intro.html#3.3.2)列为基本特征:请求发送到后端

身份验证与后端服务器允许它真的是连接到它

预期HAProxy的节点的后台服务器

我一直在试图做到这一点,一直无法。所以这里的问题是:

我如何发送请求到后端与自签名证书进行身份验证。 uses这个后端的前端请求,就是http。

这是我的haproxy.cfg文件:

global 
    maxconn 4096 
    daemon 
    log 127.0.0.1 local0 

defaults 
    log  global 
    option dontlognull 
    retries 3 
    option redispatch 
    maxconn 2000 
    timeout connect 5s 
    timeout client 15min 
    timeout server 15min 

frontend public 
    bind *:8213 
    use_backend api if { path_beg /api/ } 
    default_backend web 

backend web 
    mode http 
    server blogweb1 127.0.0.1:4000 

backend api 
    mode tcp 
    acl clienthello req.ssl_hello_type 1 

    tcp-request inspect-delay 5s 
    tcp-request content accept if clienthello 

    server blogapi 127.0.0.1:8780 
+0

请在配置中显示您正在尝试的内容。首先,无需身份验证即可使用该服务器,证书安装在后端,代理服务器使用'server'行中的'ssl verify none'来进行连接而无需身份验证。 –

回答

0

我最终得到了这个开始工作。我相信抛弃我的是,在做了一个haproxy -f <configFile> -st之后,它并没有像我想的那样真正结束这个过程。所以,我的更改/更新都没有。我kill -9几十haproxy服务和重新命令(haproxy -f),现在它的工作。

现在,这是一个假设,虽然我对此非常有信心。我仍然会提出我的最终配置,以防万一有人从这里收集到一些东西。我用https://www.haproxy.com/doc/aloha/7.0/deployment_guides/tls_layouts.html。这个链接回答了我对“如何使用SSL验证后端”的问题,就像文档说的那样。

global 
    maxconn 4096 
    daemon 
    log 127.0.0.1 local0 

defaults 
    log  global 
    option dontlognull 
    retries 3 
    option redispatch 
    maxconn 2000 
    timeout connect 5s 
    timeout client 15min 
    timeout server 15min 

frontend public 
    bind *:443 
    mode http 
    use_backend api if { path_beg /api/ } 

backend api 
    mode http 
    option httplog 
    server blogapi 127.0.0.1:4430 ssl ca-file <caFile.Pem> crt <clientCert.pem> verify required