次の方法で共有


多対一マッピング <manyToOneMappings>

概要

<iisClientCertificateMappingAuthentication> 要素の <manyToOneMappings> 要素は、クライアントのブラウザー証明書の条件に基づいて、複数のクライアント証明書をユーザー アカウントにマップします。 多対一の証明書マッピングは、Windows 認証基本認証など、より一般的に使用される認証方法の代わりに使用できます。

多対一ルールに対して有効にできるアクセス方法には、許可拒否の 2 種類があります。 これらの設定を使用すると、サイトへのアクセスを許可するクライアント証明書のグループを受け入れながら、別の条件に基づいて他の証明書グループのアクセスを拒否するルールを作成できます。 たとえば、人事組織単位内のすべての Contoso 従業員のアクセスを許可しながら、営業組織単位の従業員のアクセスを拒否するルールを作成できます。

クライアント証明書には、多対一ルールの条件として使用できる 2 つのフィールドがあります。

  • [発行者] - このフィールドは、クライアント証明書を発行した証明機関 (CA) に関する情報を指定します。
  • [サブジェクト] - このフィールドは、クライアント証明書が発行されたエンティティに関する情報を指定します。

これらの各フィールドには、共通 LDAP サブフィールドを含めることができます。次に例を挙げます。

  • CN = commonName (例: "Nancy Davolio")
  • OU = organizationalUnitName (例: "Sales")
  • O = organizationName (例: "Contoso")
  • L = localityName (例: "Redmond")
  • S = stateOrProvinceName (例: "WA")
  • C = countryName (例: "US")

マッピングを作成するには、特定の値のフィールドとサブフィールドのペアに基づいてルールを作成します。 たとえば、Contoso CA によって発行された証明書を持つすべてのクライアントへのアクセスを許可するために、発行者の O サブフィールドを Contoso と照合するルールを作成できます。 これにより、Contoso 組織に含まれていないクライアントからのクライアント接続が効果的に排除されます。

Note

多対一の証明書マッピングは、個々のクライアント証明書を個々のユーザー アカウントにマップする一対一の証明書マッピングとは異なります。

互換性

バージョン メモ
IIS 10.0 <manyToOneMappings> 要素は、IIS 10.0 では変更されませんでした。
IIS 8.5 <manyToOneMappings> 要素は、IIS 8.5 では変更されませんでした。
IIS 8.0 <manyToOneMappings> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <manyToOneMappings> 要素は、IIS 7.5 では変更されませんでした。
IIS 7.0 <iisClientCertificateMappingAuthentication> 要素の <manyToOneMappings> 要素が IIS 7.0 で導入されました。
IIS 6.0 <manyToOneMappings> 要素は、IIS 6.0 IIsCertMapper メタベース オブジェクトを置き換えます。

段取り

<iisClientCertificateMappingAuthentication> 要素は、IIS 7 以降の既定のインストールでは使用できません。 インストールするには、次の手順を使用します。

Windows Server 2012 または Windows Server 2012 R2

  1. タスク バーで [サーバー マネージャー]をクリックします。
  2. [サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。
  3. [役割と機能の追加] ウィザードで、[次へ] をクリックします。 インストールの種類を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。
  4. [サーバー ロール] ページで、[Web サーバー (IIS)][Web サーバー] の順に展開し、[セキュリティ] を展開して、[IIS クライアント証明書マッピング認証] を選択します。 次へ をクリックします。
    [I I S クライアント証明書マッピング認証] オプションが強調表示されている [サービス ロール] ページのスクリーンショット。
  5. [機能の選択] ページで、[次へ] をクリックします。
  6. [インストール オプションの確認] ページで、[インストール] をクリックします。
  7. [結果] ページで、 [閉じる]をクリックします。

Windows 8 または Windows 8.1

  1. [スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。
  2. [コントロール パネル][プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
  3. [インターネット インフォメーション サービス] を展開し、[World Wide Web サービス] を展開し、[セキュリティ] を展開して、[IIS クライアント証明書マッピング認証] を選択します。
    [I I S Client Certificate Mapping Authentication]\(I I S クライアント証明書マッピング認証\) フォルダーが選択され、強調表示されているスクリーンショット。
  4. OK をクリックします。
  5. 閉じるをクリックします。

Windows Server 2008 または Windows Server 2008 R2

  1. タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。
  2. [サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。
  3. [Web Server (IIS)] (Web サーバー (IIS)) ウィンドウで、[Role Services] (役割サービス) セクションまでスクロールし、[Add Role Services] (役割サービスの追加) をクリックします。
  4. 役割サービスの追加ウィザード[役割サービスの選択] ページで、[IIS クライアント証明書マッピング認証] を選択し、[次へ] をクリックします。
    強調表示されている I I S クライアント証明書マッピング認証を示す役割サービスの追加ウィザードのスクリーンショット。
  5. [インストール オプションの確認] ページで、[インストール] をクリックします。
  6. [結果] ページで、 [閉じる]をクリックします。

Windows Vista または Windows 7

  1. タスク バーで、[スタート][コントロール パネル] の順にクリックします。
  2. [コントロール パネル][プログラムと機能] をクリックし、[Turn Windows Features on or off] (Windows の機能の有効化または無効化) をクリックします。
  3. [インターネット インフォメーション サービス] を展開し、[IIS クライアント証明書マッピング認証] を選択し、[OK] をクリックします。
    展開されたセキュリティ フォルダーのスクリーンショット。強調表示されている I I S クライアント証明書マッピング認証フォルダーが示されています。

操作方法

IIS 7 の IIS クライアント証明書マッピング認証を構成するためのユーザー インターフェイスはありません。 IIS クライアント証明書マッピング認証をプログラムで構成する方法の例については、このドキュメントの「コード サンプル」セクションを参照してください。

構成

属性

なし。

子要素

要素 説明
add 省略可能な要素です。

manyToOneMappings のコレクションにマッピングを追加します。
clear 省略可能な要素です。

manyToOneMappings コレクションからマッピングへのすべての参照を削除します。

構成サンプル

次の構成サンプルでは、既定の Web サイトに対して次の操作を実行します。

  • 多対一の証明書マッピングを使用して IIS クライアント証明書マッピング認証を有効にします。
  • Contoso と一致するクライアント証明書のサブジェクトの組織フィールドに基づいて、ユーザー アカウントの多対一の証明書マッピング規則を作成します。
  • SSL を要求し、クライアント証明書をネゴシエートするようにサイトを構成します。
<location path="Default Web Site">
   <system.webServer>
      <security>
         <authentication>
            <windowsAuthentication enabled="false" />
            <anonymousAuthentication enabled="false" />
            <digestAuthentication enabled="false" />
            <basicAuthentication enabled="false" />
            <iisClientCertificateMappingAuthentication enabled="true"
                  manyToOneCertificateMappingsEnabled="true">
               <manyToOneMappings>
                  <add name="Contoso Employees"
                        enabled="true"
                        permissionMode="Allow"
                        userName="Username"
                        password="[enc:AesProvider:57686f6120447564652c2049495320526f636b73:enc]">
                     <rules>
                        <add certificateField="Subject"
                           certificateSubField="O"
                           matchCriteria="Contoso"
                           compareCaseSensitive="true" />
                     </rules>
                  </add>
               </manyToOneMappings>
            </iisClientCertificateMappingAuthentication>
         </authentication>
         <access sslFlags="Ssl, SslNegotiateCert" />
      </security>
   </system.webServer>
</location>

サンプル コード

次のコード サンプルでは、既定の Web サイトに対して次の操作を実行します。

  • 多対一の証明書マッピングを使用して IIS クライアント証明書マッピング認証を有効にします。
  • Contoso と一致するクライアント証明書のサブジェクトの組織フィールドに基づいて、ユーザー アカウントに多対一の証明書マッピング規則を作成します。
  • SSL を要求し、クライアント証明書をネゴシエートするようにサイトを構成します。

AppCmd.exe

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/iisClientCertificateMappingAuthentication /enabled:"True" /manyToOneCertificateMappingsEnabled:"True" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/iisClientCertificateMappingAuthentication /+"manyToOneMappings.[name='Contoso Employees',enabled='True',permissionMode='Allow',userName='Username',password='Password']" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/iisClientCertificateMappingAuthentication /+"manyToOneMappings.[name='Contoso Employees'].rules.[certificateField='Subject',certificateSubField='O',matchCriteria='Contoso',compareCaseSensitive='True']" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/access /sslFlags:"Ssl, SslNegotiateCert" /commit:apphost

Note

AppCmd.exe を使用してこれらの設定を構成するときは、commit パラメーターを必ず apphost に設定する必要があります。 これで、ApplicationHost.config ファイルの適切な場所セクションに構成設定がコミットされます。

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["manyToOneCertificateMappingsEnabled"] = true;

         ConfigurationElementCollection manyToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("manyToOneMappings");
         ConfigurationElement addElement = manyToOneMappingsCollection.CreateElement("add");
         addElement["name"] = @"Contoso Employees";
         addElement["enabled"] = true;
         addElement["permissionMode"] = @"Allow";
         addElement["userName"] = @"Username";
         addElement["password"] = @"Password";

         ConfigurationElementCollection rulesCollection = addElement.GetCollection("rules");
         ConfigurationElement addElement1 = rulesCollection.CreateElement("add");
         addElement1["certificateField"] = @"Subject";
         addElement1["certificateSubField"] = @"O";
         addElement1["matchCriteria"] = @"Contoso";
         addElement1["compareCaseSensitive"] = true;
         rulesCollection.Add(addElement1);
         manyToOneMappingsCollection.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("manyToOneCertificateMappingsEnabled") = True

      Dim manyToOneMappingsCollection As ConfigurationElementCollection = iisClientCertificateMappingAuthenticationSection.GetCollection("manyToOneMappings")
      Dim addElement As ConfigurationElement = manyToOneMappingsCollection.CreateElement("add")
      addElement("name") = "Contoso Employees"
      addElement("enabled") = True
      addElement("permissionMode") = "Allow"
      addElement("userName") = "Username"
      addElement("password") = "Password"

      Dim rulesCollection As ConfigurationElementCollection = addElement.GetCollection("rules")
      Dim addElement1 As ConfigurationElement = rulesCollection.CreateElement("add")
      addElement1("certificateField") = "Subject"
      addElement1("certificateSubField") = "O"
      addElement1("matchCriteria") = "Contoso"
      addElement1("compareCaseSensitive") = True
      rulesCollection.Add(addElement1)
      manyToOneMappingsCollection.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("manyToOneCertificateMappingsEnabled").Value = true;

var manyToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("manyToOneMappings").Collection;
var addElement = manyToOneMappingsCollection.CreateNewElement("add");
addElement.Properties.Item("name").Value = "Contoso Employees";
addElement.Properties.Item("enabled").Value = true;
addElement.Properties.Item("permissionMode").Value = "Allow";
addElement.Properties.Item("userName").Value = "Username";
addElement.Properties.Item("password").Value = "Password";

var rulesCollection = addElement.ChildElements.Item("rules").Collection;
var addElement1 = rulesCollection.CreateNewElement("add");
addElement1.Properties.Item("certificateField").Value = "Subject";
addElement1.Properties.Item("certificateSubField").Value = "O";
addElement1.Properties.Item("matchCriteria").Value = "Contoso";
addElement1.Properties.Item("compareCaseSensitive").Value = true;
rulesCollection.AddElement(addElement1);
manyToOneMappingsCollection.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("manyToOneCertificateMappingsEnabled").Value = True

Set manyToOneMappingsCollection = iisClientCertificateMappingAuthenticationSection.ChildElements.Item("manyToOneMappings").Collection
Set addElement = manyToOneMappingsCollection.CreateNewElement("add")
addElement.Properties.Item("name").Value = "Contoso Employees"
addElement.Properties.Item("enabled").Value = True
addElement.Properties.Item("permissionMode").Value = "Allow"
addElement.Properties.Item("userName").Value = "Username"
addElement.Properties.Item("password").Value = "Password"

Set rulesCollection = addElement.ChildElements.Item("rules").Collection
Set addElement1 = rulesCollection.CreateNewElement("add")
addElement1.Properties.Item("certificateField").Value = "Subject"
addElement1.Properties.Item("certificateSubField").Value = "O"
addElement1.Properties.Item("matchCriteria").Value = "Contoso"
addElement1.Properties.Item("compareCaseSensitive").Value = True
rulesCollection.AddElement(addElement1)
manyToOneMappingsCollection.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()