Microsoft MVP성태의 닷넷 이야기
개발 환경 구성: 253. TLS 1.2를 적용한 IIS 웹 사이트 구성 [링크 복사], [링크+제목 복사]
조회: 42800
글쓴 사람
정성태 (techsharer at outlook.com)
홈페이지
첨부 파일
 
(연관된 글이 3개 있습니다.)

TLS 1.2를 적용한 IIS 웹 사이트 구성

역시 이 글도 아래의 질문 덕분에 쓰여진 것입니다. ^^

windows 2008 r2에서 ms-sql 2008 서버사용시 tls문제점
; https://www.sysnet.pe.kr/3/0/1523

제목에서 밝혔듯이, 이번 글에서는 IIS 웹 사이트에 TLS 1.2 적용을 위한 방법을 알아보겠습니다. 그런데, 글을 쓸 필요도 없이 이렇게 검색되는군요. ^^

Enable TLS 1.1 and TLS 1.2 on Windows Server 2008 R2 and IIS 7.5
; http://www.adminhorror.com/2011/10/enable-tls-11-and-tls-12-on-windows_1853.html

그래서, IIS 웹 사이트에 인증서 바인딩시키고 "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols" 키에 다음과 같이 TLS 1.2만을 활성화하고 나머지 TLS 1.0/1.1은 비활성화 시켰습니다.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client]
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client]
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server]
"Enabled"=dword:00000000
"DisabledByDefault"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"Enabled"=dword:00000001
"DisabledByDefault"=dword:00000000

일반적으로는 이 설정이 EXE 프로세스를 재시작하는 것만으로 반영되지만, IIS의 경우는 System 프로세스에 커널 드라이버로 서비스되고 있기 때문에 이를 반영하려면 컴퓨터를 재부팅해야 합니다.

그 후로는, TLS 1.0/TLS 1.1 프로토콜로 접속하려 하면 다음과 같이 오류 화면이 뜨게 됩니다.

tls12_support_1.png

This page can’t be displayed

Turn on TLS 1.0, TLS 1.1, and TLS 1.2 in Advanced settings and try connecting to https://... again. If this error persists, contact your site administrator.


물론, "Use TLS 1.2" 옵션을 켜면 웹 브라우저에서 접속이 됩니다. 이 때의 네트워크 패킷을 "Microsoft Network Monitor"를 이용해 "tcp.port == 443" 필터로 놓고 웹 브라우저가 서버로 전송하는 handshake 패킷과,

  Frame: Number = 27930, Captured Frame Length = 232, MediaType = ETHERNET
+ Ethernet: Etype = Internet IP (IPv4),DestinationAddress:[00-15-5D-00-05-04],SourceAddress:[00-26-66-4D-F5-15]
+ Ipv4: Src = 192.168.0.5, Dest = 192.168.0.23, Next Protocol = TCP, Packet ID = 6958, Total IP Length = 218
+ Tcp: Flags=...AP..., SrcPort=56832, DstPort=HTTPS(443), PayloadLen=178, Seq=1561831547 - 1561831725, Ack=497462568, Win=1024 (scale factor 0x8) = 262144
  TLSSSLData: Transport Layer Security (TLS) Payload Data
- TLS: TLS Rec Layer-1 HandShake: Client Hello.
  - TlsRecordLayer: TLS Rec Layer-1 HandShake:
     ContentType: HandShake:
   - Version: TLS 1.2
      Major: 3 (0x3)
      Minor: 3 (0x3)
     Length: 173 (0xAD)
   - SSLHandshake: SSL HandShake ClientHello(0x01)
      HandShakeType: ClientHello(0x01)
      Length: 169 (0xA9)
    - ClientHello: TLS 1.2
     + Version: TLS 1.2
	 ...[생략]...
     + ClientHelloExtension: SessionTicket TLS(0x0023)

그에 대한 응답을 통해 TLS 1.2 프로토콜이 사용된 것임을 알 수 있습니다.

  Frame: Number = 27931, Captured Frame Length = 1527, MediaType = ETHERNET
+ Ethernet: Etype = Internet IP (IPv4),DestinationAddress:[00-26-66-4D-F5-15],SourceAddress:[00-15-5D-00-05-04]
+ Ipv4: Src = 192.168.0.23, Dest = 192.168.0.5, Next Protocol = TCP, Packet ID = 21794, Total IP Length = 0
+ Tcp: Flags=...AP..., SrcPort=HTTPS(443), DstPort=56832, PayloadLen=1473, Seq=497462568 - 497464041, Ack=1561831725, Win=513 (scale factor 0x8) = 131328
  TLSSSLData: Transport Layer Security (TLS) Payload Data
- TLS: TLS Rec Layer-1 HandShake: Server Hello. Certificate. Server Hello Done.
  - TlsRecordLayer: TLS Rec Layer-1 HandShake:
     ContentType: HandShake:
   - Version: TLS 1.2
      Major: 3 (0x3)
      Minor: 3 (0x3)
     Length: 1468 (0x5BC)
   - SSLHandshake: SSL HandShake Server Hello Done(0x0E)
      HandShakeType: ServerHello(0x02)
      Length: 77 (0x4D)
    + ServerHello: 0x1
      HandShakeType: Certificate(0x0B)
      Length: 1379 (0x563)
    + Cert: 0x1
      HandShakeType: Server Hello Done(0x0E)
      Length: 0 (0x0)




재미있는 것은, 이렇게 TLS 1.2 사용을 강제하는 경우 RDP 접속도 안된다는 점입니다. 다행히 이 부분은 서버 측의 "Remote Desktop Session Host Configuration" 관리 콘솔에서 "RDP-Tcp"의 Security Layer 설정을 "RDP Security Layer"로 바꿔주는 것으로 해결할 수 있습니다. 이에 대해서는 다음의 글을 참고하세요. ^^

Remote Desktop Connection (RDP) stopped working after disabling TLS 1.0
; http://itexperiences.blogspot.kr/index.html2012/08/remote-desktop-connection-rdp-stopped.html

부가적으로 IIS 웹 사이트에 SSL 통신을 위한 인증서 관련해서 하나 더 짚고 넘어가겠습니다. 이에 대해서는 예전에 한번 설명한 적이 있습니다.

IIS 7 관리자 - Active Directory Certification Authority 로부터 SSL 사이트 인증서 받는 방법
; https://www.sysnet.pe.kr/2/0/1025

그런데, 아쉽게도 현재 Active Directory의 CA 서버로부터 자동으로 받게 되는 인증서는 기본적으로 1024비트로 되어 있습니다. 현재 최소 2048비트 이상의 키 길이를 가지도록 하는 것이 권장 사항이므로 이를 위해서는 부가적인 작업이 필요합니다. 그래도 이미 다른 글에서 모두 친절하게 잘 설명하고 있습니다. ^^

Creating 2048 bit Domain SSL Certificate 
; http://support.thycotic.com/kb/a247/creating-2048-bit-domain-ssl-certificate.aspx

저도 예전에 ^^ 인증서 템플릿을 수정하는 방법을 설명했었습니다.

CA 서비스 - 사용자 정의 템플릿 유형 추가
; https://www.sysnet.pe.kr/2/0/533

가볍게 정리해 보면!

CA 서비스가 설치된 컴퓨터에 접속해 "Certificate Authority" 관리 콘솔을 띄우고 "Certificate Templates" 노드에 마우스 우클릭을 해 "Manage" 메뉴를 선택합니다. 그럼, "Certificate Templates Console"이 뜨고, 거기에서 "Template Display Name"이 "Web Server"인 것을 선택해 속성 메뉴를 누르면 "Properties of New Template"창이 뜹니다. 거기에서 다음과 같은 설정의 인증서 템플릿을 만듭니다.

"General" 탭
 - "Template display name"에 적당한 이름(예: Web Server 2048 bit) 설정
 - "Publish certificate in Active Directory" 설정
 
"Request Handling" 탭
 - "Allow private key to be exported"를 선택

"Cryptography" 탭
 - "Minimum key size"를 2048로 설정(R2의 경우 기본값이 2048이므로 별도 설정 필요없음.)

"Security" 탭
 - "Authenticated Users" 계정의 "Enroll" 권한을 "Allow"

(참고로, 이 템플릿은 기본적으로 CA 서비스의 "Certificate Template"에 보이지 않으므로 "Certificate Template to Issue" 메뉴를 통해 추가해 주면 인증서 웹 요청 화면에서도 볼 수 있습니다.)

자, 이제 다시 IIS 관리자의 "Server Certificates"에서 1024비트로 받은 기존 인증서가 있다면 "Renew..." 하시고, 아니면 새롭게 도메인 인증서를 선택해 주시면 됩니다. (Renew한 경우, 당연히 Thumbprint 값이 바뀌므로 혹시 기존 서비스에서 hash 값을 등록한 것이 있다면 바꿔주어야 합니다.)

그럼, 다음과 같이 2048비트 길이의 인증서가 준비됩니다. ^^

tls12_support_2.png




[이 글에 대해서 여러분들과 의견을 공유하고 싶습니다. 틀리거나 미흡한 부분 또는 의문 사항이 있으시면 언제든 댓글 남겨주십시오.]

[연관 글]






[최초 등록일: ]
[최종 수정일: 1/23/2015]

Creative Commons License
이 저작물은 크리에이티브 커먼즈 코리아 저작자표시-비영리-변경금지 2.0 대한민국 라이센스에 따라 이용하실 수 있습니다.
by SeongTae Jeong, mailto:techsharer at outlook.com

비밀번호

댓글 작성자
 




1  2  3  4  5  6  7  [8]  9  10  11  12  13  14  15  ...
NoWriterDateCnt.TitleFile(s)
13432정성태10/31/20232452오류 유형: 878. 탐색기의 WSL 디렉터리 접근 시 "Attempt to access invalid address." 오류 발생
13431정성태10/31/20232788스크립트: 60. 파이썬 - 비동기 FastAPI 앱을 gunicorn으로 호스팅
13430정성태10/30/20232676닷넷: 2153. C# - 사용자가 빌드한 ICU dll 파일을 사용하는 방법
13429정성태10/27/20232958닷넷: 2152. Win32 Interop - C/C++ DLL로부터 이중 포인터 버퍼를 C#으로 받는 예제파일 다운로드1
13428정성태10/25/20233034닷넷: 2151. C# 12 - ref readonly 매개변수
13427정성태10/18/20233248닷넷: 2150. C# 12 - 정적 문맥에서 인스턴스 멤버에 대한 nameof 접근 허용(Allow nameof to always access instance members from static context)
13426정성태10/13/20233407스크립트: 59. 파이썬 - 비동기 호출 함수(run_until_complete, run_in_executor, create_task, run_in_threadpool)
13425정성태10/11/20233193닷넷: 2149. C# - PLinq의 Partitioner<T>를 이용한 사용자 정의 분할파일 다운로드1
13423정성태10/6/20233171스크립트: 58. 파이썬 - async/await 기본 사용법
13422정성태10/5/20233317닷넷: 2148. C# - async 유무에 따른 awaitable 메서드의 병렬 및 예외 처리
13421정성태10/4/20233393닷넷: 2147. C# - 비동기 메서드의 async 예약어 유무에 따른 차이
13420정성태9/26/20235580스크립트: 57. 파이썬 - UnboundLocalError: cannot access local variable '...' where it is not associated with a value
13419정성태9/25/20233218스크립트: 56. 파이썬 - RuntimeError: dictionary changed size during iteration
13418정성태9/25/20233922닷넷: 2146. C# - ConcurrentDictionary 자료 구조의 동기화 방식
13417정성태9/19/20233451닷넷: 2145. C# - 제네릭의 형식 매개변수에 속한 (매개변수를 가진) 생성자를 호출하는 방법
13416정성태9/19/20233256오류 유형: 877. redis-py - MISCONF Redis is configured to save RDB snapshots, ...
13415정성태9/18/20233754닷넷: 2144. C# 12 - 컬렉션 식(Collection Expressions)
13414정성태9/16/20233511디버깅 기술: 193. Windbg - ThreadStatic 필드 값을 조사하는 방법
13413정성태9/14/20233708닷넷: 2143. C# - 시스템 Time Zone 변경 시 이벤트 알림을 받는 방법
13412정성태9/14/20236988닷넷: 2142. C# 12 - 인라인 배열(Inline Arrays) [1]
13411정성태9/12/20233491Windows: 252. 권한 상승 전/후 따로 관리되는 공유 네트워크 드라이브 정보
13410정성태9/11/20235029닷넷: 2141. C# 12 - Interceptor (컴파일 시에 메서드 호출 재작성) [1]
13409정성태9/8/20233886닷넷: 2140. C# - Win32 API를 이용한 모니터 전원 끄기
13408정성태9/5/20233842Windows: 251. 임의로 만든 EXE 파일을 포함한 ZIP 파일의 압축을 해제할 때 Windows Defender에 의해 삭제되는 경우
13407정성태9/4/20233587닷넷: 2139. C# - ParallelEnumerable을 이용한 IEnumerable에 대한 병렬 처리
13406정성태9/4/20233554VS.NET IDE: 186. Visual Studio Community 버전의 라이선스
1  2  3  4  5  6  7  [8]  9  10  11  12  13  14  15  ...