SSL 클라이언트 인증서 설정
Entry, Professional, Enterprise, Enterprise Advanced 플랜에서 사용할 수 있습니다.
다음 절차에 따라 브라우저와 Windows, macOS, Linux용 Mattermost 데스크톱 앱에 SSL 클라이언트 인증서를 구성하세요.
시작하기 전에 Mattermost 설치 공식 가이드를 따라 시스템에 Mattermost를 설치하세요. SSL 및 HTTP/2를 갖춘 프록시로서의 NGINX 구성과 Let's Encrypt 같은 유효한 SSL 인증서도 함께 준비합니다.
이 가이드에서는 Mattermost 서버 도메인 이름을 example.mattermost.com으로, 사용자 계정을 mmuser(이메일 mmuser@mattermost.com, 비밀번호 mmuser-password)로 가정합니다.
웹 앱에 상호 TLS 인증 설정
클라이언트 인증서에 서명할 인증 기관(CA) 키와 인증서를 만듭니다. TLS 연결을 수립할 때 NGINX 프록시 서버는 웹 앱이 제공하는 클라이언트 인증서를 요청하고 검증합니다.
openssl genrsa -des3 -out ca.mattermost.key 4096pass phrase: capasswordopenssl req -new -x509 -days 365 -key ca.mattermost.key -out ca.mattermost.crtCountry Name: US State: Maryland Locality Name: Meade Organization Name: Mattermost Organization Unit: Smarttotem Common Name: example.mattermost.com Email Address: admin@mattermost.commmuser용 클라이언트 측 키를 패스프레이즈와 함께 만들고, 인증서 서명 요청(CSR)을 생성합니다.openssl genrsa -des3 -out mmuser-mattermost.key 1024passphrase: mmuser-passphraseopenssl req -new -key mmuser-mattermost.key -out mmuser-mattermost.csrCountry Name: US State: Maryland Locality Name: Meade Organization Name: Mattermost Organization Unit: Smarttotem Common Name: mmuser Email Address: mmuser@mattermost.com Challenge password: mmuser-passphrase앞서 만든 CA 인증서로 사용자의 클라이언트 인증서에 서명합니다.
openssl x509 -req -days 365 -in mmuser-mattermost.csr -CA ca.mattermost.crt -CAkey ca.mattermost.key -set_serial 01 -out mmuser-mattermost.crtmmuser용으로 새로 생성한 클라이언트 인증서를 확인합니다.openssl x509 -in mmuser-mattermost.crt -text -noout/etc/nginx/sites-available/mattermost파일을 열고 다음 줄을 수정해, NGINX 프록시 서버가 클라이언트 인증서를 요청하고 검증하도록 합니다.ssl on; ssl_certificate /etc/letsencrypt/live/example.mattermost.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/example.mattermost.com/privkey.pem; ssl_client_certificate /opt/mattermost/config/ca.mattermost.crt; ssl_verify_client on; ... location ~ /api/v[0-9]+/(users/)?websocket$ { proxy_set_header X-SSL-Client-Cert $ssl_client_cert; proxy_set_header X-SSL-Client-Cert-Subject-DN $ssl_client_s_dn; ... location / { proxy_set_header X-SSL-Client-Cert $ssl_client_cert; proxy_set_header X-SSL-Client-Cert-Subject-DN $ssl_client_s_dn; ...프록시에 다음 curl 명령을 실행해
mmuser용 CA 키가 동작하는지 확인합니다.curl -v -s -k --key mmuser-mattermost.key --cert mmuser-mattermost.crt:mmuser-passphrase https://example.mattermost.comMattermost 로그인 페이지가 표시되어야 합니다. 다음과 같은 결과가 나온다면 확인이 필요합니다.
No required SSL certificate was sent: 무언가 잘못된 것입니다. 위 단계를 다시 검토한 뒤 재시도하세요.Error reading X.509 key or certificate file: Decryption has failed.: curl은 패스프레이즈를 따로 묻지 않으므로, 패스프레이즈가 인증서와 함께 포함되어 있는지 확인하세요.
브라우저에서 사용할 수 있도록 클라이언트 머신에 인증서를 설치하기 위해, CA 키와 인증서로 PKCS12 파일을 생성합니다.
openssl pkcs12 -export -out mmuser-mattermost.p12 -inkey mmuser-mattermost.key -in mmuser-mattermost.crt -certfile ca.mattermost.crtEnter Export Password: mmuser-passphrase필요에 따라 다른 사용자에 대해서도 위 2~7단계를 반복합니다.
7단계에서 생성한
.p12파일을 키체인으로 가져옵니다. macOS의 Chrome 브라우저에서는 다음과 같이 진행합니다.- Settings > Advanced > Privacy and security > Manage certificates로 이동합니다. 키체인 접근 앱이 열립니다.
- File > Import Items로 이동해
mmuser-mattermost.p12파일을 선택합니다.
https://example.mattermost.com으로 이동합니다. 클라이언트 인증서를 요청하는 팝업이 표시되어야 합니다.