SSL 클라이언트 인증서 설정
다음 단계에 따라 Windows, macOS, Linux의 브라우저 및 Mattermost 데스크톱 앱에 SSL 클라이언트 인증서를 구성합니다. 시작하기 전에 NGINX를 SSL 및 HTTP/2와 함께 프록시로 구성하고 Let's Encrypt와 같은 유효한 SSL 인증서를 포함하여 시스템에 Mattermost 설치 공식 가이드 를 따르세요.
다음 단계에 따라 Windows, macOS, Linux의 브라우저 및 Mattermost 데스크톱 앱에 SSL 클라이언트 인증서를 구성합니다.
시작하기 전에 NGINX를 SSL 및 HTTP/2와 함께 프록시로 구성하고 Let's Encrypt와 같은 유효한 SSL 인증서를 포함하여 시스템에 Mattermost 설치 공식 가이드 를 따르세요.
이 가이드에서는 Mattermost 서버 도메인 이름이 example.mattermost.com 이고 사용자 계정은 이메일 mmuser@mattermost.com 과 비밀번호 mmuser-password 를 가진 mmuser 입니다.
웹 앱을 위한 상호 TLS 인증 설정#
- 클라이언트 인증서 서명을 위한 인증 기관(CA) 키 및 인증서를 생성합니다. TLS 연결을 설정할 때 NGINX 프록시 서버는 웹 앱에서 제공하는 클라이언트 인증서를 요청하고 검증합니다.
- 이전에 생성한 CA 인증서로 사용자의 클라이언트 인증서에 서명합니다:
mmuser의 새로 생성된 클라이언트 인증서를 확인합니다:/etc/nginx/sites-available/mattermost파일을 열고 NGINX 프록시 서버가 클라이언트 인증서를 요청하고 검증하도록 다음 줄을 수정합니다:
openssl genrsa -des3 -out ca.mattermost.key 4096
pass phrase: capassword
<pre><code class="language-sh">openssl req -new -x509 -days 365 -key ca.mattermost.key -out ca.mattermost.crt</code></pre>
<pre><code class="language-text">Country Name: US
State: Maryland
Locality Name: Meade
Organization Name: Mattermost
Organization Unit: Smarttotem
Common Name: example.mattermost.com
Email Address: admin@mattermost.com</code></pre>
<li class="numbered"><code>mmuser</code> 의 패스프레이즈를 사용하여 클라이언트 측 키와 인증서 서명 요청을 생성합니다:
openssl genrsa -des3 -out mmuser-mattermost.key 1024
passphrase: mmuser-passphrase
openssl req -new -key mmuser-mattermost.key -out mmuser-mattermost.csr
Country 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
openssl x509 -req -days 365 -in mmuser-mattermost.csr -CA ca.mattermost.crt -CAkey ca.mattermost.key -set_serial 01 -out mmuser-mattermost.crt
openssl x509 -in mmuser-mattermost.crt -text -noout
:emphasize-lines: 4-5, 10-11, 16-17
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;
...
<li class="numbered">프록시에 다음 curl 명령을 사용하여 <code>mmuser</code> 의 CA 키가 작동하는지 확인합니다:
curl -v -s -k --key mmuser-mattermost.key --cert mmuser-mattermost.crt:mmuser-passphrase https://example.mattermost.com
Mattermost 로그인 페이지가 표시되어야 합니다. 다음이 표시되면:
No required SSL certificate was sent는 문제가 발생했음을 의미합니다. 위 단계를 검토하고 다시 시도하세요.Error reading X.509 key or certificate file: Decryption has failed.는 curl이 별도로 프롬프트를 표시하지 않으므로 인증서와 함께 패스프레이즈가 포함되어야 합니다.
- 브라우저에서 사용할 인증서를 클라이언트 시스템에 설치하기 위해 CA 키와 인증서에서 PKCS12 파일을 생성합니다:
- 필요한 경우 다른 사용자에 대해 2-7 단계를 반복합니다.
- 7단계에서 생성된
.p12파일을 키체인에 가져옵니다. macOS의 Chrome 브라우저에서: https://example.mattermost.com으로 이동합니다. 클라이언트 인증서 요청에 대한 팝업이 표시됩니다.
openssl pkcs12 -export -out mmuser-mattermost.p12 -inkey mmuser-mattermost.key -in mmuser-mattermost.crt -certfile ca.mattermost.crt
Enter Export Password: mmuser-passphrase
1. Settings > Advanced > Privacy and security > Manage certificates 로 이동합니다. 이렇게 하면 Keychain Access 앱이 열립니다.
2. File > Import Items 로 이동하여mmuser-mattermost.p12 파일을 선택합니다.
