HAProxy에 대한 SSL/TLS 구성
ThingWorx HA 클러스터링을 사용할 때 HAProxy에 대한 SSL 또는 TLS를 구성할 수 있습니다.
외부 SSL과 내부 SSL에 대해 HAProxy를 설정할 수 있습니다. 인증서 파일을 제공해야 합니다. ThingWorx에서는 경로 기반 라우팅을 위해 요청 객체에 액세스해야 하므로 SSL 통과를 사용할 수 없습니다. HAProxy에서 SSL을 구성하는 여러 가지 옵션이 있습니다. 다음 정보는 참조용이며 자세한 내용은 https://cbonte.github.io/haproxy-dconv/2.0/configuration.html을 참조하십시오.
클라이언트에서 HAProxy로의 외부 SSL
global 구성에서 인증서 및 개인 키의 기본 위치(선택 사항)를 설정할 수 있습니다. 프런트엔드 구성에서는 암호화 및 지원되는 TLS 수준을 구성할 수 있습니다. 예를 들면 다음과 같습니다.
global
# Default SSL material locations
ca-base /etc/ssl/certs
crt-base /etc/ssl/private
# Default ciphers to use on SSL-enabled listening sockets.
# For more information, see ciphers(1SSL). This list is from:
# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
# An alternative list with additional directives can be obtained from
# https://mozilla.github.io/server-side-tls/ssl-config-generator/?server=haproxy
ssl-default-bind-ciphers ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
ssl-default-bind-options no-sslv3
프런트 엔드 섹션은 수신 끝점 위치입니다. 여기에 사용할 바인딩 포트 및 인증서를 구성해야 합니다. 바인딩 구성에 대한 자세한 내용은 https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#5.1을 참조하십시오.
예를 들면 다음과 같습니다.
frontend ft_web
bind *:8443 ssl crt /certs/haproxy.pem name sslweb
* 
ThingWorx Flow를 ThingWorx HA 환경에 설치한 경우 포트 및 인증서를 바인딩해야 합니다.
HAProxy에서 응용 프로그램으로의 내부 SSL
백엔드 서버마다 내부 SSL을 구성합니다. 서버마다 설정을 다르게 지정할 수 있습니다. 다음 예에서는 모든 플랫폼 서버가 SSL을 지원하고 포트 8443에서 요청을 수신합니다. 해당 위치를 가리키고 SSL을 사용하도록 서버 끝점이 구성되어 있습니다. 이 예에서는 자체 서명 인증서를 사용하므로 확인이 none으로 설정되어 있습니다. 서버 구성 옵션에 대한 자세한 내용은 https://cbonte.github.io/haproxy-dconv/2.0/configuration.html#5.2를 참조하십시오.
backend platform
server platform1 platform1:8443 ssl verify none
server platform2 platform2:8443 ssl verify none
ThingWorx Flow에 대한 예
ThingWorx Flow를 ThingWorx HA 환경에 설치한 경우 백엔드 ThingWorx Flow 구성 정보를 추가합니다.
backend flow
server nginx <NGinx IP>:443 check ssl verify none
자체 서명된 인증서 만들기
예를 들면 다음과 같습니다.
openssl req -newkey rsa:2048 -nodes -x509 -days 365 -keyout haproxy.key -out haproxy.crt -subj "/CN=$HAPROXY_SSL_SERVER_CERT_CN" && \
cat haproxy.crt haproxy.key >> /certs/haproxy.pem
chmod 755 /certs/haproxy.pem && \
ThingWorx Flow에 대한 예
ThingWorx FlowThingWorx HA 환경에 설치한 경우 다음을 수행하십시오.
1. 필요한 모든 권한이 있는 certs 폴더를 / 아래에 만듭니다.
2. 다음 명령을 실행하여 인증서를 만듭니다.
sudo openssl req -newkey rsa:2048 -nodes -x509 -days 365 -keyout haproxy.key -out haproxy.crt -subj “/CN=<부하 분산 호스트>” && sudo cat haproxy.crt haproxy.key >> /certs/haproxy.pem
이 명령은 /etc/haproxy 폴더에 haproxy.crthaproxy.cfg를 만들고 /certs 폴더에 haproxy.pem을 만듭니다.
Docker 사용
공식 HAProxy 컨테이너를 사용하고 certshaproxy.cfg 파일에 마운트할 수 있습니다. 내부 HAProxy 컨테이너는 다음 구성을 지원합니다.
PLATFORM_ADDRESSES: platform1,platform2,platform3
CXSERVER_ADDRESSES: cxserver1,cxserver2
HAPROXY_STAT_USER: admin
HAPROXY_STAT_PASSWORD: thingworx
SSL_ENABLED: true
SSL_CERT_PATH: /certs/haproxy.pem
LOG_LEVEL: debug
PLATFORM_SECURE: true
PLATFORM_SECURE_PORT: 8443
PLATFORM_PORT: 8080
CXSERVER_SECURE: true
CXSERVER_SECURE_PORT: 8443
CXSERVER_PORT: 8080
FLOW_SECURE: true
FLOW_SECURE_PORT: 443
FLOW_PORT: 80
인증서를 /certs 폴더에 마운트해야 합니다.
haproxy:
image: artifactory.rd2.thingworx.io/twxdevops/tw-lb-haproxy:latest
container_name: haproxy
ports:
- 9100:8080
- 9143:8443
- 1936:1936
environment: *haproxy-env
volumes:
- certs:/certs
도움이 되셨나요?