サービス プリンシパル名 <spn>

概要

<spn> 要素は、SPN のコレクションにサービス プリンシパル名 (SPN) を追加します。 各 SPN は、Windows 認証用の拡張保護機能を使用して、クライアント アクティビティの一意のエンドポイントを指定します。

拡張保護は、認証リレーまたは "中間者" 攻撃を軽減するために、既存の Windows 認証機能を強化します。 この軽減策は、次の 2 つのセキュリティ メカニズムによって実装されるセキュリティ情報を使用して実現されます。

  • 主に SSL 接続に使用されるチャネル バインド トークン (CBT) を介して指定されるチャネル バインド情報。
  • サービス プリンシパル名 (SPN) を介して指定されるサービス バインド情報。これは、主に SSL を使用しない接続に使用されます。また、プロキシ サーバーやロード バランサーなどの SSL オフロードを提供するシナリオを通じて接続が確立された場合に使用されます。

<extendedProtection> 要素には <spn> 要素のコレクションを含めることができます。各要素には、サービス バインド情報の一意の SPN が含まれます。 各 SPN は、接続パス内の一意のエンドポイントを表します。これは、接続先サーバーまたはプロキシ サーバーの完全修飾ドメイン名 (FQDN) または NetBIOS 名である可能性があります。 たとえば、クライアントがプロキシ サーバーを介して宛先サーバーに接続している場合、移行先サーバー上の SPN コレクションには、プロキシ サーバーの SPN を含める必要があります。 コレクション内の各 SPN にはプレフィックスとして "HTTP" を付ける必要があるため、"www.contoso.com" の結果の SPN は "HTTP/www.contoso.com" になります。

IIS 拡張保護のチャネル バインドと追加の動作を構成する <extendedProtection> 要素には、次の 2 つの属性があります。

  • tokenChecking 属性は、チャネル バインド トークンをチェックするための動作を構成します。 この属性に指定できる値は、次のとおりです。

    名前 説明
    None この値は、IIS がチャネル バインド トークン チェックを実行しないことを指定します。 この設定は、拡張保護の前に存在していた動作をエミュレートします。

    数値は 0 です。
    Allow この値は、チャネル バインド トークンのチェックが有効になっているが、必須ではないことを指定します。 この設定により、拡張保護をサポートしているが、拡張保護を使用できないクライアントを引き続きサポートするクライアントとの安全な通信が可能になります。

    数値は 1 です。
    Require この値は、チャネル バインド トークンのチェックが必要であることを指定します。 この設定では、拡張保護をサポートしていないクライアントはサポートされません。

    数値は 2 です。
  • flags 属性は、拡張保護の追加動作を構成します。 使用可能なフラグは次のとおりです。

    名前 説明
    None このフラグは、拡張保護に対して追加の動作が有効になっていないことを指定します。 (たとえば、プロキシ サーバーが使用されておらず、SPN チェックが有効になっており、FQDN が必要です)。

    数値は 0 です。
    Proxy このフラグは、通信パスの一部がプロキシ経由であるか、クライアントが HTTP 経由で宛先サーバーに直接接続していることを指定します。

    数値は 1 です。
    NoServiceNameCheck このフラグは、SPN チェックが無効であることを指定します。このフラグは、SPN のみがチェックされているシナリオでは使用しないでください。

    数値は 2 です。
    AllowDotlessSpn このフラグは、SPN が FQDN である必要がないことを指定します。 このフラグを設定すると、NetBIOS ベースの SPN が許可されます。 注: このフラグの設定はセキュリティで保護されたシナリオではありません。FQDN ベース以外の名前は、名前解決のポイズニング攻撃に対して脆弱です。

    数値は 4 です。
    ProxyCohosting このフラグは、クライアントからサーバーへの通信パス全体で HTTP のみを使用することを指定します。通信パスで SSL を使用している部分がなく、SPN チェックが使用されます。 注: このフラグを指定する場合は、Proxy フラグも指定する必要があります。

    数値は 32 です。

拡張保護のシナリオ

次の例のシナリオがあるとします。

  • 次の各シナリオでは、ネットワーク環境で NetBIOS ベースの SPN がサポートされている場合に AllowDotlessSpn フラグを指定することもできますが、NetBIOS ベースの SPN はセキュリティで保護されません。
  • SPN チェックが使用され、チャネル バインド トークン チェックが使用されない次の各シナリオでは、NoServiceNameCheck フラグを指定しないでください。
シナリオ Flags 説明
クライアントが HTTP を使用して宛先サーバーに直接接続する Proxy, ProxyCohosting SPN チェックが使用され、チャネル バインド トークン チェックは使用されません。
クライアントが SSL を使用して宛先サーバーに直接接続する None チャネル バインド トークン チェックが使用され、SPN チェックは使用されません。
クライアントは、パス全体に HTTP を使用してプロキシ サーバー経由で宛先サーバーに接続する Proxy, ProxyCohosting SPN チェックが使用され、チャネル バインド トークン チェックは使用されません。
クライアントは、パス全体に SSL を使用してプロキシ サーバー経由で宛先サーバーに接続する Proxy SPN チェックが使用され、チャネル バインド トークン チェックは使用されません。
クライアントは SSL を使用してプロキシ サーバーに接続し、プロキシ サーバーは HTTP を使用して宛先サーバーに接続する (SSL のオフロード) Proxy SPN チェックが使用され、チャネル バインド トークン チェックは使用されません。

追加情報

拡張保護の詳細については、次のトピックを参照してください。

統合 Windows 認証と拡張保護

サービス プリンシパル名

互換性

バージョン メモ
IIS 10.0 <spn> 要素は、IIS 10.0 では変更されませんでした。
IIS 8.5 <spn> 要素は、IIS 8.5 では変更されませんでした。
IIS 8.0 <spn> 要素は IIS 8.0 では変更されませんでした。
IIS 7.5 <extendedProtection> 要素の <spn> 要素が IIS 7.5 で導入されました。
IIS 7.0 該当なし
IIS 6.0 該当なし

段取り

IIS 7 以降の既定のインストールには、Windows 認証の役割サービスは含まれません。 IIS で Windows 認証を使用するには、役割サービスをインストールし、Web サイトまたはアプリケーションの匿名認証を無効にしてから、サイトまたはアプリケーションの Windows 認証を有効にする必要があります。

Note

役割サービスをインストールすると、IIS 7 は ApplicationHost.config ファイルに次の構成設定をコミットします。

<windowsAuthentication enabled="false" />

Windows Server 2012 または Windows Server 2012 R2

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

Windows 8 または Windows 8.1

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

Windows Server 2008 または Windows Server 2008 R2

  1. タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。
  2. [サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。
  3. [Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] を選択します。
  4. 役割サービスの追加ウィザード[役割サービスの選択] ページで、[Windows 認証] を選択し、[次へ] を選択します。
    スクリーンショットには、[セキュリティ] ウィンドウが展開され、[Windows 認証] が選択されている役割サービスの追加ウィザードの [役割サービスの選択] ページが表示されます。
  5. [インストール オプションの確認] ページで、[インストール] をクリックします。
  6. [結果] ページで、 [閉じる]をクリックします。

Windows Vista または Windows 7

  1. タスク バーで、[スタート][コントロール パネル] の順にクリックします。
  2. [コントロール パネル][プログラムと機能] を選択し、[Windows の機能の有効化または無効化] を選択します。
  3. [インターネット インフォメーション サービス][World Wide Web サービス][セキュリティ] の順に展開します。
  4. [Windows 認証] を選択し、[OK] を選択します。
    [Windows 認証] が強調表示された [World Wide Web サービスとセキュリティ] ウィンドウのスクリーンショット。

操作方法

Windows 認証の拡張保護を有効にする方法

  1. インターネット インフォメーション サービス (IIS) マネージャーを開きます。

    • Windows Server 2012 または Windows Server 2012 R2 を使用している場合:

      • タスク バーで、[サーバー マネージャー] をクリックし、[ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows 8 または Windows 8.1 を使用している場合:

      • Windows キーを押しながら文字 X を押し、[コントロール パネル] をクリックします。
      • [管理ツール] をクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
    • Windows Server 2008 または Windows Server 2008 R2 を使用している場合:

      • タスク バーで、[スタート] ボタンをクリックし、[管理ツール][インターネット インフォメーション サービス (IIS) マネージャー] の順にクリックします。
    • Windows Vista または Windows 7 を使用している場合:

      • タスク バーで、[スタート][コントロール パネル] の順にクリックします。
      • [管理ツール] をダブルクリックし、[インターネット インフォメーション サービス (IIS) マネージャー] をダブルクリックします。
  2. [接続] ウィンドウで、サーバー名を展開し、[サイト] を展開し、Windows 認証の拡張保護を有効にするサイト、アプリケーション、または Web サービスを展開します。

  3. [ホーム] ウィンドウの [セキュリティ] セクションまでスクロールし、[認証] をダブルクリックします。

  4. [認証] ウィンドウで、[Windows 認証] を選択します。

  5. [操作] ウィンドウで、[有効] をクリックします。
    スクリーンショットは、Windows 認証が選択された [認証] ウィンドウを示しています。[有効化] オプションが [操作] ウィンドウに表示されます。

  6. [操作] ウィンドウの [詳細設定] をクリックします。

  7. [詳細設定] ダイアログ ボックスが表示されたら、[拡張保護] ドロップダウン メニューで次のいずれかのオプションを選択します。

    • 拡張保護を有効にしながら、拡張保護をサポートしていないクライアントに対して下位レベルのサポートを提供する場合は、[同意する] を選択します。
    • 下位レベルのサポートを提供せずに拡張保護を有効にする場合は、[必須] を選択します。
      [拡張保護] ドロップダウン メニューから [承諾] オプションが選択されていることを示す [詳細設定] ダイアログ ボックスのスクリーンショット。
  8. [OK] をクリックして [詳細設定] ダイアログ ボックスを閉じます。

構成

<extendedProtection> 要素の <spn> 要素は、ApplicationHost.config ファイル内のサイト、アプリケーション、または仮想ディレクトリ レベルで構成できます。

属性

属性 説明
name 省略可能な文字列属性。

一意の SPN を指定します。

既定値はありません。

子要素

なし。

構成サンプル

次の例では、既定の Web サイトの拡張保護を使用して Windows 認証を有効にし、SPN のコレクションに 2 つの SPN エントリを追加する <extendedProtection> 要素を表示します。

<location path="Default Web Site">
   <system.webServer>
      <security>
         <authentication>
            <windowsAuthentication enabled="true">
               <extendedProtection tokenChecking="Allow" flags="None">
                  <spn name="HTTP/www.contoso.com" />
                  <spn name="HTTP/contoso.com" />
               </extendedProtection>
            </windowsAuthentication>
         </authentication>
      </security>
   </system.webServer>
</location>

サンプル コード

次の例では、既定の Web サイトの拡張保護を使用して Windows 認証を構成し、SPN のコレクションに 2 つの SPN エントリを追加する方法を示します。

AppCmd.exe

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

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/windowsAuthentication /extendedProtection.tokenChecking:"Allow" /extendedProtection.flags:"None" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/windowsAuthentication /+"extendedProtection.[name='HTTP/www.contoso.com']" /commit:apphost

appcmd.exe set config "Default Web Site" -section:system.webServer/security/authentication/windowsAuthentication /+"extendedProtection.[name='HTTP/contoso.com']" /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 windowsAuthenticationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Default Web Site");
         windowsAuthenticationSection["enabled"] = true;

         ConfigurationElement extendedProtectionElement = windowsAuthenticationSection.GetChildElement("extendedProtection");
         extendedProtectionElement["tokenChecking"] = @"Allow";
         extendedProtectionElement["flags"] = @"None";

         ConfigurationElementCollection extendedProtectionCollection = extendedProtectionElement.GetCollection();

         ConfigurationElement spnElement = extendedProtectionCollection.CreateElement("spn");
         spnElement["name"] = @"HTTP/www.contoso.com";
         extendedProtectionCollection.Add(spnElement);

         ConfigurationElement spnElement1 = extendedProtectionCollection.CreateElement("spn");
         spnElement1["name"] = @"HTTP/contoso.com";
         extendedProtectionCollection.Add(spnElement1);

         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 windowsAuthenticationSection As ConfigurationSection = config.GetSection("system.webServer/security/authentication/windowsAuthentication", "Default Web Site")
      windowsAuthenticationSection("enabled") = True

      Dim extendedProtectionElement As ConfigurationElement = windowsAuthenticationSection.GetChildElement("extendedProtection")
      extendedProtectionElement("tokenChecking") = "Allow"
      extendedProtectionElement("flags") = "None"

      Dim extendedProtectionCollection As ConfigurationElementCollection = extendedProtectionElement.GetCollection

      Dim spnElement As ConfigurationElement = extendedProtectionCollection.CreateElement("spn")
      spnElement("name") = "HTTP/www.contoso.com"
      extendedProtectionCollection.Add(spnElement)

      Dim spnElement1 As ConfigurationElement = extendedProtectionCollection.CreateElement("spn")
      spnElement1("name") = "HTTP/contoso.com"
      extendedProtectionCollection.Add(spnElement1)

      serverManager.CommitChanges()
   End Sub
End Module

JavaScript

var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";

var windowsAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/windowsAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site");
windowsAuthenticationSection.Properties.Item("enabled").Value = true;

var extendedProtectionElement = windowsAuthenticationSection.ChildElements.Item("extendedProtection");
extendedProtectionElement.Properties.Item("tokenChecking").Value = "Allow";
extendedProtectionElement.Properties.Item("flags").Value = "None";

var extendedProtectionCollection = extendedProtectionElement.Collection;

var spnElement = extendedProtectionCollection.CreateNewElement("spn");
spnElement.Properties.Item("name").Value = "HTTP/www.contoso.com";
extendedProtectionCollection.AddElement(spnElement);

var spnElement1 = extendedProtectionCollection.CreateNewElement("spn");
spnElement1.Properties.Item("name").Value = "HTTP/contoso.com";
extendedProtectionCollection.AddElement(spnElement1);

adminManager.CommitChanges();

VBScript

Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"

Set windowsAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/windowsAuthentication", "MACHINE/WEBROOT/APPHOST/Default Web Site")
windowsAuthenticationSection.Properties.Item("enabled").Value = True

Set extendedProtectionElement = windowsAuthenticationSection.ChildElements.Item("extendedProtection")
extendedProtectionElement.Properties.Item("tokenChecking").Value = "Allow"
extendedProtectionElement.Properties.Item("flags").Value = "None"

Set extendedProtectionCollection = extendedProtectionElement.Collection

Set spnElement = extendedProtectionCollection.CreateNewElement("spn")
spnElement.Properties.Item("name").Value = "HTTP/www.contoso.com"
extendedProtectionCollection.AddElement(spnElement)

Set spnElement1 = extendedProtectionCollection.CreateNewElement("spn")
spnElement1.Properties.Item("name").Value = "HTTP/contoso.com"
extendedProtectionCollection.AddElement(spnElement1)

adminManager.CommitChanges()