일대일 매핑 <추가 추가>
개요
<add>
요소의 <oneToOneMappings>
요소는 개별 클라이언트 인증서와 개별 사용자 계정 간의 고유한 매핑을 지정합니다.
참고
일대일 인증서 매핑은 여러 인증서를 단일 사용자 계정에 매핑할 수 있는 다 대 일 인증서 매핑과 다릅니다.
호환성
버전 | 참고 |
---|---|
IIS 10.0 | <add> 요소가 IIS 10.0에서 수정되지 않았습니다. |
IIS 8.5 | <add> 요소가 IIS 8.5에서 수정되지 않았습니다. |
IIS 8.0 | <add> 요소가 IIS 8.0에서 수정되지 않았습니다. |
IIS 7.5 | <add> 요소가 IIS 7.5에서 수정되지 않았습니다. |
IIS 7.0 | <add> 요소의 <oneToOneMappings> 요소는 IIS 7.0에서 도입되었습니다. |
IIS 6.0 | 요소는 <oneToOneMappings> IIS 6.0 IIsCertMapper 메타베이스 개체를 대체합니다. |
설치 프로그램
<iisClientCertificateMappingAuthentication>
IIS 7 이상의 기본 설치에서는 요소를 사용할 수 없습니다. 설치하려면 다음 단계를 사용합니다.
Windows Server 2012 또는 Windows Server 2012 R2
- 작업 표시줄에서 서버 관리자를 클릭합니다.
- 서버 관리자관리 메뉴를 클릭한 다음 역할 및 기능 추가를 클릭합니다.
- 역할 및 기능 추가 마법사에서 다음을 클릭합니다. 설치 유형을 선택하고 다음을 클릭합니다. 대상 서버를 선택하고 다음을 클릭합니다.
- 서버 역할 페이지에서 웹 서버(IIS)를 확장하고, 웹 서버를 확장하고, 보안을 확장한 다음, IIS 클라이언트 인증서 매핑 인증을 선택합니다. 다음을 클릭합니다.
.
- 기능 선택 페이지에서 다음을 클릭합니다.
- 설치 선택 확인 페이지에서 설치를 클릭합니다.
- Results(결과) 페이지에서 Close(닫기)를 클릭합니다.
Windows 8 또는 Windows 8.1
- 시작 화면에서 포인터를 왼쪽 아래 모서리로 이동하고 시작 단추를 마우스 오른쪽 단추로 클릭한 다음 제어판 클릭합니다.
- 제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.
- 인터넷 정보 서비스를 확장하고 World Wide Web Services를 확장한 다음 보안을 확장한 다음 IIS 클라이언트 인증서 매핑 인증을 선택합니다.
- 확인을 클릭합니다.
- 닫기를 클릭합니다.
Windows Server 2008 또는 Windows Server 2008 R2
- 작업 표시줄에서 시작을 클릭하고 관리 도구를 가리킨 다음 서버 관리자 클릭합니다.
- 서버 관리자 계층 창에서 역할을 확장한 다음 웹 서버(IIS)를 클릭합니다.
- 웹 서버(IIS) 창에서 역할 서비스 섹션으로 스크롤한 다음 역할 서비스 추가를 클릭합니다.
- 역할 서비스 추가 마법사의 역할 서비스 선택 페이지에서 IIS 클라이언트 인증서 매핑 인증을 선택하고 다음을 클릭합니다.
- 설치 선택 확인 페이지에서 설치를 클릭합니다.
- Results(결과) 페이지에서 Close(닫기)를 클릭합니다.
Windows Vista 또는 Windows 7
- 작업 표시줄에서 시작을 클릭한 다음 제어판 클릭합니다.
- 제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.
- 인터넷 정보 서비스를 확장한 다음 IIS 클라이언트 인증서 매핑 인증을 선택한 다음 확인을 클릭합니다.
방법
IIS 7에 대한 IIS 클라이언트 인증서 매핑 인증을 구성하기 위한 사용자 인터페이스가 없습니다. IIS 클라이언트 인증서 매핑 인증을 프로그래밍 방식으로 구성하는 방법에 대한 예제는 이 문서의 코드 샘플 섹션을 참조하세요.
구성
특성
attribute | Description |
---|---|
certificate |
필수 문자열 특성입니다. 클라이언트 인증서에서 base64로 인코딩된 공용 인증서를 지정합니다. IIS는 이 인증서를 웹 클라이언트가 인터넷을 통해 보낸 인증서의 복사본과 비교합니다. 매핑을 진행하려면 두 데이터 문자열이 동일해야 합니다. 클라이언트가 다른 인증서를 가져오는 경우 복사본에 원본과 동일한 사용자 정보가 모두 포함되어 있더라도 원본과 일치하지 않습니다. 이 특성에서 클라이언트 인증서의 base64로 인코딩된 문자열에 줄 바꿈이 있는 경우 제거해야 합니다. 줄 바꿈은 서버의 인증서를 브라우저에서 보낸 인증서와 비교하는 서버의 기능을 방해할 수 있습니다. |
enabled |
선택적 부울 특성입니다. 일대일 매핑을 사용할지 여부를 지정합니다. 기본값은 true 입니다. |
password |
선택적 문자열 특성입니다. 클라이언트를 인증하는 데 사용되는 계정의 암호를 지정합니다. 참고: 암호화되지 않은 암호 문자열을 구성 파일에 저장하지 않도록 하려면 항상 AppCmd.exe 사용하여 암호를 입력합니다. 이러한 관리 도구를 사용하는 경우 암호 문자열은 XML 구성 파일에 기록되기 전에 자동으로 암호화됩니다. 이렇게 하면 암호화되지 않은 암호를 저장하는 것보다 더 나은 암호 보안이 제공됩니다. |
username |
선택적 문자열 특성입니다. 클라이언트를 인증하는 데 사용되는 계정의 사용자 이름을 지정합니다. |
자식 요소
없음
구성 샘플
다음 구성 샘플에서는 기본 웹 사이트에 대한 일대일 인증서 매핑을 사용하여 IIS 클라이언트 인증서 매핑 인증을 사용하도록 설정하고, 사용자 계정에 대한 일대일 인증서 매핑을 만들고, SSL을 요구하고 클라이언트 인증서를 협상하도록 사이트를 구성합니다.
<location path="Default Web Site">
<system.webServer>
<security>
<access sslFlags="Ssl, SslNegotiateCert" />
<authentication>
<windowsAuthentication enabled="false" />
<anonymousAuthentication enabled="false" />
<digestAuthentication enabled="false" />
<basicAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="true"
oneToOneCertificateMappingsEnabled="true">
<oneToOneMappings>
<add enabled="true"
userName="administrator"
password="[enc:57686f6120447564652c2049495320526f636b73:enc]"
certificate="Base64-Encoded-Certificate-Data" />
</oneToOneMappings>
</iisClientCertificateMappingAuthentication>
</authentication>
</security>
</system.webServer>
</location>
클라이언트 인증서에서 Base-64로 인코딩된 문자열을 검색하는 방법
참고
이 항목의 모든 샘플에 대해 Base-64로 인코딩된 인증서 데이터를 검색하려면 다음 단계를 사용하여 인증서를 내보낼 수 있습니다.
시작을 클릭한 다음 실행을 클릭합니다.
MMC를 입력한 다음 확인을 클릭합니다.
Microsoft 관리 콘솔이 열리면 파일을 클릭한 다음 스냅인 추가/제거를 클릭합니다.
스냅인 추가 또는 제거 대화 상자에서 다음을 수행합니다.
- 사용 가능한 스냅인 목록에서 인증서 를 강조 표시한 다음 추가를 클릭합니다.
- 내 사용자 계정에 대한 인증서를 관리하도록 선택한 다음 마침을 클릭합니다.
- 확인 을 클릭하여 대화 상자를 닫습니다.
Microsoft 관리 콘솔에서 다음을 수행합니다.
- 인증서 - 현재 사용자, 개인, 인증서를 차례로 확장합니다.
- 인증서 목록에서 내보낼 인증서를 마우스 오른쪽 단추로 클릭한 다음 모든 작업을 클릭한 다음 내보내기를 클릭합니다.
인증서 내보내기 마법사가 열리면 다음을 수행합니다.
- 다음을 클릭합니다.
- 아니요, 프라이빗 키를 내보내지 않음을 선택한 다음, 다음을 클릭합니다.
- Base-64로 인코딩된 X.509 9(를 선택합니다. CER) 내보내기 형식에 대해 다음을 클릭합니다.
- 인증서를 데스크톱에 MyCertificate.cer로 저장하도록 선택한 다음, 다음을 클릭합니다.
- 마침을 클릭합니다. 내보내기 성공이라는 대화 상자가 표시됩니다.
Microsoft Management Console을 닫습니다.
Windows 메모장을 사용하여 내보낸 MyCertificate.cer 파일을 엽니다.
- 텍스트의 시작에서 "-----BEGIN CERTIFICATE-----"를 제거합니다.
- 텍스트 끝에서 "인증서---------- 보내기"를 제거합니다.
- 모든 줄을 한 줄의 텍스트로 연결 - 이 항목의 모든 샘플에 사용할 Base-64로 인코딩된 인증서 데이터입니다.
샘플 코드
다음 코드 샘플에서는 기본 웹 사이트에 대한 일대일 인증서 매핑을 사용하여 IIS 클라이언트 인증서 매핑 인증을 사용하도록 설정하고, 사용자 계정에 대한 단일 일대일 인증서 매핑을 만들고, SSL을 요구하고 클라이언트 인증서를 협상하도록 사이트를 구성합니다.
참고
아래에 나열된 코드 샘플에 대한 Base-64로 인코딩된 인증서 데이터를 검색하려면 이 문서의 구성 세부 정보 섹션에 나열된 단계를 사용하여 인증서를 내보낼 수 있습니다.
AppCmd.exe
참고
AppCmd.exe 구문 분석할 수 없는 인증서 문자열의 문자 때문에 AppCmd.exe 사용하여 IIS 일대일 인증서 매핑을 구성해서는 안 됩니다.
C#
using System;
using System.Text;
using Microsoft.Web.Administration;
internal static class Sample
{
private static void Main()
{
using (ServerManager serverManager = new ServerManager())
{
Configuration config = serverManager.GetApplicationHostConfiguration();
ConfigurationSection iisClientCertificateMappingAuthenticationSection = config.GetSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "Default Web Site");
iisClientCertificateMappingAuthenticationSection["enabled"] = true;
iisClientCertificateMappingAuthenticationSection["oneToOneCertificateMappingsEnabled"] = true;
ConfigurationElementCollection oneToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("oneToOneMappings");
ConfigurationElement addElement = oneToOneMappingsCollection.CreateElement("add");
addElement["enabled"] = true;
addElement["userName"] = @"Username";
addElement["password"] = @"Password";
addElement["certificate"] = @"Base-64-Encoded-Certificate-Data";
oneToOneMappingsCollection.Add(addElement);
ConfigurationSection accessSection = config.GetSection("system.webServer/security/access", "Default Web Site");
accessSection["sslFlags"] = @"Ssl, SslNegotiateCert";
serverManager.CommitChanges();
}
}
}
VB.NET
Imports System
Imports System.Text
Imports Microsoft.Web.Administration
Module Sample
Sub Main()
Dim serverManager As ServerManager = New ServerManager
Dim config As Configuration = serverManager.GetApplicationHostConfiguration
Dim iisClientCertificateMappingAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "Default Web Site")
iisClientCertificateMappingAuthenticationSection("enabled") = True
iisClientCertificateMappingAuthenticationSection("oneToOneCertificateMappingsEnabled") = True
Dim oneToOneMappingsCollection As ConfigurationElementCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("oneToOneMappings")
Dim addElement As ConfigurationElement = oneToOneMappingsCollection.CreateElement("add")
addElement("enabled") = True
addElement("userName") = "Username"
addElement("password") = "Password"
addElement("certificate") = "Base-64-Encoded-Certificate-Data"
oneToOneMappingsCollection.Add(addElement)
Dim accessSection As ConfigurationSection = config.GetSection("system.webServer/security/access", "Default Web Site")
accessSection("sslFlags") = "Ssl, SslNegotiateCert"
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var iisClientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site");
iisClientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = true;
iisClientCertificateMappingAuthenticationSection.Properties.Item("oneToOneCertificateMappingsEnabled").Value = true;
var oneToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("oneToOneMappings").Collection;
var addElement = oneToOneMappingsCollection.CreateNewElement("add");
addElement.Properties.Item("enabled").Value = true;
addElement.Properties.Item("userName").Value = "Username";
addElement.Properties.Item("password").Value = "Password";
addElement.Properties.Item("certificate").Value = "Base-64-Encoded-Certificate-Data";
oneToOneMappingsCollection.AddElement(addElement);
var accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site");
accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert";
adminManager.CommitChanges();
VBScript
Set adminManager = WScript.CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set iisClientCertificateMappingAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/iisClientCertificateMappingAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site")
iisClientCertificateMappingAuthenticationSection.Properties.Item("enabled").Value = True
iisClientCertificateMappingAuthenticationSection.Properties.Item("oneToOneCertificateMappingsEnabled").Value = True
Set oneToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("oneToOneMappings").Collection
Set addElement = oneToOneMappingsCollection.CreateNewElement("add")
addElement.Properties.Item("enabled").Value = True
addElement.Properties.Item("userName").Value = "Username"
addElement.Properties.Item("password").Value = "Password"
addElement.Properties.Item("certificate").Value = "Base-64-Encoded-Certificate-Data"
oneToOneMappingsCollection.AddElement(addElement)
Set accessSection = adminManager.GetAdminSection("system.webServer/security/access", "MACHINE/WEBROOT/APPHOST/Default Web Site")
accessSection.Properties.Item("sslFlags").Value = "Ssl, SslNegotiateCert"
adminManager.CommitChanges()