2015년 11월 25일 수요일

SSL CLIENT CERTIFICATE MANAGEMENT AT APPLICATION LEVEL [Mutual SSL]


Phase 1: Client Certificate mandatory

아래와 같은 설정에서, 오직 client certificate를 사용하는 유저만이 application에 연결되어질 수 있다.
이러한 기능은 "verify required" 라는 keyword를 통해서 이루어질 수 있다.

frontend ft_ssltests
 mode http
 bind 192.168.10.1:443 ssl crt ./server.pem ca-file ./ca.crt verify required
 default_backend bk_ssltests
 
backend ssltests
 mode http
 server s1 192.168.10.101:80 check
 server s2 192.168.10.102:80 check

만약 client가 아무런 certificate를 제공하지 않는다면, HAProxySSL Handshake 를 하는 동안,
연결을 끊어버릴 것이다.
이것은 사용자의 소프트웨어가 다음과 같은 상황에 레포트할 에러들이다.

Testing:

Connection with a certificate is allowed:
$ openssl s_client -connect 192.168.10.1:443 -cert ./client1.crt -key ./client1.key

Connection without a certificate is refused:
$ openssl s_client -connect 192.168.10.1:443
[...]ssl handshake failure[...]

Connection with an expired certificate is refused too:
$ openssl s_client -connect 192.168.10.1:443 -cert ./client_expired.crt -key ./client_expired.key
[...]ssl handshake failure[...]



Phase 2: Client Certificate optional

아래와 같은 설정에서, certificate를 사용하든 사용하지 않든 모든 user는 연결될 것이다. 이것은
"verify optional" 이라는 키워드로 이루어질 수 있다.
우리는 유저가 certificate를 가지고 있는지 없는 지에 따라 서로 다른 위치로 user를 재전송할 수 있다.

frontend ssltests
 mode http
 bind 192.168.10.1:443 ssl crt ./server.pem ca-file ./ca.crt verify optional
 use_backend sharepoint if { ssl_fc_has_crt }     # check if the certificate has been provided and give access to the application
 default_backend webmail
 
backend sharepoint
 mode http
 server srv1 192.168.10.101:80 check
 server srv2 192.168.10.102:80 check
 
backend webmail
 mode http
 server srv3 192.168.10.103:80 check
 server srv4 192.168.10.104:80 check


- 아무런 certificate를 제공하지 않는다면, HAProxy는 유저를 webmail로 보낼 것이다.
- 올바른 certificate를 제공한다면, HAProxy는 유저를 application (sharepoint in our example) 로 보낼 것이다.
- 만료된 certificate를 제공한다면, HAProxy는 연결을 거부할 것이다.



Phase 3: Client Certificate optional and managing expired certificates

아래와 같은 설정에서, certificate를 사용하든 사용하지 않든 모든 user는 연결될 것이다. 이것은
"verify optional" 이라는 키워드로 이루어질 수 있다.
crt-ignore-err 10” 옵션은 HAProxy에게 인증서 만료를 뜻하는 certificate error 10 을 무시하도록 설정한다.
우리는 certificate를 가진 user, 가지지않은 user , 만료된 certificate를 가진 user를 각각 다른 위치로 보낼 수 있다.
예를 들어, 만료된 인증서를 가진 사용자에게는 새로이 인증서를 요청하거나, 갱신할 수 있는 특정 페이지로 보낼 수 있는 것이다.


frontend ssltests
 mode http
 bind 192.168.10.1:443 ssl crt ./server.pem ca-file ./ca.crt verify optional crt-ignore-err 10
 use_backend static if { ssl_c_verify 10 }  # if the certificate has expired, route the user to a less sensitive server to print an help page
 use_backend sharepoint if { ssl_fc_has_crt }        # check if the certificate has been provided and give access to the application
 default_backend webmail
 
backend static
 mode http
 option http-server-close
 redirect location /certexpired.html if { ssl_c_verify 10 } ! { path /certexpired.html }
 server srv5 192.168.10.105:80 check
 server srv6 192.168.10.106:80 check
 
backend sharepoint
 mode http
 server srv1 192.168.10.101:80 check
 server srv2 192.168.10.102:80 check
 
backend webmail
 mode http
 server srv3 192.168.10.103:80 check
 server srv4 192.168.10.104:80 check


- 아무런 certificate를 제공하지 않는다면, HAProxy는 유저를 webmail로 보낼 것이다.
- 올바른 certificate를 제공한다면, HAProxy는 유저를 application (sharepoint in our example) 로 보낼 것이다.
- 만료된 certificate를 제공한다면, HAProxy는 유저를 만료된 인증서에 대해 설명하고 어떻게 갱신하는 지 설명이 있는
정적 페이지(static)로 보낼 것이다.


Phase 4: Client Certificate optional, managing expired certificates and a revocation list


아래와 같은 설정에서, certificate를 사용하든 사용하지 않든 모든 user는 연결될 것이다. 이것은
"verify optional" 이라는 키워드로 이루어질 수 있다.
crt-ignore-err all” 옵션은 HAProxy에게 어떠한 certificate error도 무시하게 한다.
crl-file ./ca_crl.pem” 옵션은 HAProxy에게 고객의 인증서가 폐기되었는지 체크를 하게 한다.

frontend ssltests
 mode http
 bind 192.168.10.1:443 ssl crt ./server.pem ca-file ./ca.crt verify optional crt-ignore-err all crl-file ./ca_crl.pem
 use_backend static unless { ssl_c_verify 0 }  # if there is an error with the certificate, then route the user to a less sensitive farm
 use_backend sharepoint if { ssl_fc_has_crt }           # check if the certificate has been provided and give access to the application
 default_backend webmail
 
backend static
 mode http
 option http-server-close
 redirect location /certexpired.html if { ssl_c_verify 10 } ! { path /certexpired.html } # SSL error 10 means "certificate expired"
 redirect location /certrevoked.html if { ssl_c_verify 23 } ! { path /certrevoked.html } # SSL error 23 means "Certificate revoked"
redirect location /othererrors.html unless { ssl_c_verify 0 } ! { path /othererrors.html }
 server srv5 192.168.10.105:80 check
 server srv6 192.168.10.106:80 check
 
backend sharepoint
 mode http
 server srv1 192.168.10.101:80 check
 server srv2 192.168.10.102:80 check
 
backend webmail
 mode http
 server srv3 192.168.10.103:80 check
 server srv4 192.168.10.104:80 check



- 아무런 certificate를 제공하지 않는다면, HAProxy는 유저를 webmail로 보낼 것이다.
- 올바른 certificate를 제공한다면, HAProxy는 유저를 application (sharepoint in our example) 로 보낼 것이다.
- 만료된 certificate를 제공한다면, HAProxy는 유저를 만료된 인증서에 대해 설명하고 어떻게 갱신하는 지 설명이 있는
정적 페이지(static)로 보낼 것이다.
- 폐기된 certificate를 제공한다면, HAProxy는 유저를 폐기된 인증서에 대한 설명이 있는 특정 페이지로 재전송할 것이다.
- certificate에 관한 다른 error에 대해서는, HAProxy는 유저를 해당 에러를 설명하고, 어떻게 support에게 접촉할 수 있는지
설명해주는 페이지로 재전송할 것이다.


원본 출처 : http://blog.haproxy.com/2012/10/03/ssl-client-certificate-management-at-application-level/

댓글 없음 :

댓글 쓰기