2017-08-23 2 views
0

HAProxyを使用して2つのサーバーを(逆接続性を使用して)安全に接続しようとしています。私は、プロキシのために、以下の設定を使用しています:HAProxyを使用するサーバー間の逆接続

global 
    log 127.0.0.1 local0 
    log 127.0.0.1 local1 notice 
    #log loghost local0 info 
    maxconn 4096 
    uid 99 
    gid 99 
    daemon 
    debug 

defaults 
    log  global 
    log-format {"type":"haproxy","timestamp":%Ts,"http_status":%ST,"http_request":"%r","remote_addr":"%ci","bytes_read":%B,"upstream_addr":"%si","backend_name":"%b","retries":%rc,"bytes_uploaded":%U,"upstream_response_time":"%Tr","upstream_connect_time":"%Tc","session_duration":"%Tt","termination_state":"%ts"} 
    mode http 
    option httplog 
    option dontlognull 
    retries 3 
    option redispatch 
    option http-server-close 
    maxconn 250 
    timeout connect 5000 
    timeout client 50000 
    timeout server 50000 

frontend front_reverse 
    mode http 
    bind haproxy:8081 ssl crt /x509/certs/example.com.pem 
    use_backend back_reverse 

backend back_reverse 
    mode http 
    option ssl-hello-chk 
    server onpremsrv example.com:8882 check 
    http-request set-header X-Real-IP %[src] 
    option forwardfor 

listen stats 
    bind haproxy:9000 
    mode http 
    stats enable 
    stats uri/
    stats hide-version 
    stats auth admin:admin 

バックエンドからのトラフィックを受信するサーバーは、次の出力:

onprem_1  | TRACE [ssl#8 172.32.0.4:39376] RECEIVED: RESPONSE: 503 Service Unavailable HTTP/1.0 HEADERS: {Cache-Control=[no-cache], Connection=[close], Content-Type=[text/html]} CONTENT: HeapBuffer[pos=0 lim=0 cap=0: empty] [...] [...] 
onprem_1  | TRACE [ssl#8 172.32.0.4:39376] RECEIVED: CONTENT: HeapBuffer[pos=105 lim=212 cap=272: 3C 68 74 6D 6C 3E 3C 62 6F 64 79 3E 3C 68 31 3E...] [...] 
onprem_1  | TRACE [tcp#7 172.32.0.4:39376] RECEIVED: SESSION_UNSECURED 

第二のサーバへの接続が閉じられます。私はそれがHAProxy設定のSSL部分に関連していると信じています。何か案は?

答えて

0

SSLパススルーを使用して2台のサーバーを接続することができました。全体のセットアップはドッカーのコンテナで実行されます。まず、証明書を生成する際に使用したホスト名を変更しました。 (haproxyホスト名を使用して)haproxy.cfgを変更して、の変更をdocker-compose.ymlに反映させました。

global 
    log 127.0.0.1 local0 
    log 127.0.0.1 local1 notice 
    #log loghost local0 info 
    maxconn 4096 
    uid 99 
    gid 99 
    daemon 
    debug 

defaults 
    log  global 
    log-format {"type":"haproxy","timestamp":%Ts,"http_status":%ST,"http_request":"%r","remote_addr":"%ci","bytes_read":%B,"upstream_addr":"%si","backend_name":"%b","retries":%rc,"bytes_uploaded":%U,"upstream_response_time":"%Tr","upstream_connect_time":"%Tc","session_duration":"%Tt","termination_state":"%ts"} 
    mode http 
    option httplog 
    option dontlognull 
    retries 3 
    option redispatch 
    option http-server-close 
    maxconn 250 
    timeout connect 5000 
    timeout client 50000 
    timeout server 50000 


# SSL/TLS Passthrough 

frontend front_forward 
    mode tcp 
    bind haproxy:8080 
    use_backend back_forward 

backend back_forward 
    server onpremsrv cloud:8881 
    mode tcp 
    timeout server 30s 

frontend front_reverse 
    mode tcp 
    bind haproxy:8081 
    use_backend back_reverse 

backend back_reverse 
    server onpremsrv cloud:8882 
    mode tcp 
    timeout server 30s 

# SSL/TLS Passthrough 

listen stats 
    bind haproxy:9000 
    mode http 
    stats enable 
    stats uri/
    stats hide-version 
    stats auth admin:admin 
関連する問題