概要
<customAuthentication>
要素には、FTP サイトのカスタム認証について既定の設定を指定します。 この形式の認証は、カスタム認証プロバイダーを使用してユーザー名とパスワードを検証します。
カスタム認証プロバイダーが FTP サイトに追加されると、FTP サービスは、FTP 構成設定にプロバイダーが指定されている順序で、有効になっている各カスタム認証プロバイダーでのユーザーの認証を試みます。 カスタム認証プロバイダーを使用してユーザーを認証できない場合、FTP サービスはユーザーの認証に基本認証 (有効な場合) を試みます。
カスタム認証プロバイダーを使用する主な利点は、ユーザー アカウントをご使用のサーバーやドメインに作成する必要がないことです。 これで、ネットワークのセキュリティが向上します。
Note
FTP 7.0 と FTP 7.5 には、次の 2 つのカスタム認証プロバイダーが付属しています。
- ASP.NET メンバーシップ認証: これは、ASP.NET メンバーシップ データベースを使用して、ユーザー名とパスワードを検証します。 詳細については、Microsoft の IIS.net Web サイトの「.NET メンバーシップ認証を使用した FTP の構成」トピックを参照してください。
- IIS マネージャー認証: これは、IIS 管理ユーザー ストアを使用して、ユーザー名とパスワードを検証します。 詳細については、Microsoft の IIS.net Web サイトの IIS 7.0 マネージャー認証を使用して FTP を構成する方法に関するトピックを参照してください。
Note
<customAuthentication/providers>
要素に追加されるカスタム認証プロバイダーは、<system.ftpServer/providerDefinitions>
コレクションに登録する必要があります。
Note
カスタム認証プロバイダーの作成のサポートは、FTP 7.5 で導入されました。 カスタム認証プロバイダーを作成する方法の詳細については、Microsoft の www.iis.net/learn Web サイトの FTP 7.5 向けの開発に関するセクションを参照してください。
互換性
バージョン | メモ |
---|---|
IIS 10.0 | <customAuthentication> 要素は IIS 10.0 では変更されませんでした。 |
IIS 8.5 | <customAuthentication> 要素は IIS 8.5 では変更されませんでした。 |
IIS 8.0 | <customAuthentication> 要素は IIS 8.0 では変更されませんでした。 |
IIS 7.5 | <authentication> 要素の <customAuthentication> 要素は、IIS 7.5 の機能として付属しています。 |
IIS 7.0 | <authentication> 要素の <customAuthentication> 要素が、IIS 7.0 用の別個のダウンロードとして FTP 7.0 で導入されました。 |
IIS 6.0 | <ftpServer> 要素とその子要素は、LM/MSFTPSVC メタベース パスにある IIS 6.0 の FTP 設定を置き換えます。 |
Note
FTP 7.0 サービスと FTP 7.5 サービスは IIS 7.0 とは別に出荷され、次の URL からモジュールをダウンロードしてインストールする必要がありました。
Windows 7 と Windows Server 2008 R2 では、FTP 7.5 サービスは IIS 7.5 の機能として付属しているため、FTP サービスのダウンロードは必要なくなりました。
段取り
Web サーバーの FTP 公開をサポートするには、FTP サービスをインストールする必要があります。 そのためには、次のステップに従います。
Windows Server 2012 または Windows Server 2012 R2
タスク バーで [サーバー マネージャー]をクリックします。
[サーバー マネージャー] で、[管理] メニューを選択し、[役割と機能の追加] を選択します。
[役割と機能の追加] ウィザードで、[次へ] をクリックします。 インストールの種類を選択し、[次へ] をクリックします。 対象サーバーを選択し、[次へ] をクリックします。
[サーバーの役割] ページで、[Web サーバー (IIS)] を展開して、[FTP サーバー] を選びます。
[次へ] をクリックし、[機能の選択] ページで再度 [次へ] をクリックします。
[インストール オプションの確認] ページで、[インストール] をクリックします。
[結果] ページで、 [閉じる]をクリックします。
Windows 8 または Windows 8.1
[スタート] 画面で、ポインターを左下隅まで移動し、[スタート] ボタンを右クリックし、[コントロール パネル] をクリックします。
[コントロール パネル]で [プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
[インターネット インフォメーション サービス] を展開し、[FTP サーバー] を展開します。
OK をクリックします。
閉じるをクリックします。
Windows Server 2008 R2
タスク バーで [スタート] をクリックし、[管理ツール] をポイントして、[サーバー マネージャ] をクリックします。
[サーバー マネージャ] 階層ウィンドウで [役割] を展開し、[Web サーバー (IIS)] をクリックします。
[Web サーバー (IIS)] ウィンドウで、[役割サービス] セクションまでスクロールし、[役割サービスの追加] をクリックします。
[役割サービスの追加] ウィザードの [役割サービスの選択] ページで [FTP サーバー] を展開します。
[FTP Service] を選択します。
次へ をクリックします。
[インストール オプションの確認] ページで、[インストール] をクリックします。
[結果] ページで、 [閉じる]をクリックします。
Windows 7
タスク バーで、[スタート]、[コントロール パネル] の順にクリックします。
[コントロール パネル]で [プログラムと機能] をクリックし、[Windows の機能の有効化または無効化] をクリックします。
[インターネット インフォメーション サービス]、[FTP サーバー] の順に展開します。
[FTP Service] を選択します。
OK をクリックします。
Windows Server 2008 または Windows Vista
次の URL からインストール パッケージをダウンロードします。
次のチュートリアルの手順に従って、FTP サービスをインストールします。
操作方法
FTP サイトに対して IIS マネージャー認証を有効にする方法
次のようにインターネット インフォメーション サービス (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) マネージャー] をダブルクリックします。
[接続] ウィンドウでサーバー名を展開し、[サイト] ノードを展開してから、サイトの名前をクリックします。
サイトの [ホーム] ウィンドウで、[FTP 認証] 機能をダブルクリックします。
[カスタム プロバイダー] ダイアログ ボックスが表示されたら、[IisManagerAuth] をクリックして選びます。 OK をクリックします。
必要に応じて、[基本認証] または [匿名認証] のいずれかのモードを強調表示し、[操作] ウィンドウで [無効にする] をクリックして、無効にできます。
FTP に対して IIS マネージャー認証を構成する方法の詳細については、Microsoft の www.iis.net/learn Web サイトの IIS 7.0 マネージャー認証を使用して FTP を構成する方法に関するトピックを参照してください。
FTP サイトに対してマネージド コード カスタム認証プロバイダーを追加する方法
Note
これらの手順は、カスタム FTP 認証プロバイダーが既にインストールされ、サーバーのグローバル アセンブリ キャッシュ (GAC) に登録されていることを前提としています。マネージド アセンブリを登録する方法の詳細については、Microsoft MSDN Web サイトの「グローバル アセンブリ キャッシュ ツール (Gacutil.exe)」トピックを参照してください。
次のように、拡張プロバイダーのアセンブリ情報を確認します。
- Windows エクスプローラーで、"C:\Windows\assembly" パスを開きます。ここで、C: はオペレーティング システム ドライブです。
- アセンブリを見つけます。 たとえば、FtpAuthenticationDemo です。
- アセンブリを右クリックし、[プロパティ] をクリックします。
- カルチャ値をコピーします。 たとえば、Neutral です。
- バージョン番号をコピーします。 たとえば、1.0.0.0 です。
- 公開キー トークン値をコピーします。 たとえば、426f62526f636b73 です。
- [キャンセル] をクリックします。
次のように、拡張プロバイダーを FTP 認証プロバイダーのグローバル リストに追加します。
- [インターネット インフォメーション サービス (IIS) マネージャー] を開きます。
- [接続] ウィンドウのコンピューター名をクリックします。
- メイン ウィンドウで [FTP Authentication] をダブルクリックします。
- [操作] ウィンドウで [Custom Providers...] (カスタム プロバイダー...) を選択します。
- [登録] をクリックします。
- [名前] ボックスに、カスタム認証プロバイダーのフレンドリ名を入力します。 たとえば、FtpAuthenticationDemo です。
- [マネージド プロバイダー (.NET)] を選択します。
- 前にコピーした情報を使用して、拡張プロバイダーのアセンブリ情報を入力します。 次に例を示します。
FtpAuthentication.FtpAuthDemo, FtpAuthenticationDemo, version=1.0.0.0, Culture=neutral, PublicKeyToken=426f62526f636b73 - OK をクリックします。
- プロバイダーの一覧でカスタム認証プロバイダーのチェック ボックスをオフにします。
- OK をクリックします。
次のように、FTP サイトに対してカスタム認証プロバイダーを追加します。
- インターネット インフォメーション サービス (IIS) マネージャーで FTP サイトを開きます。
- メイン ウィンドウで [FTP 認証] をダブルクリックします。
- [操作] ウィンドウで [カスタム プロバイダー] をクリックします。
- プロバイダーの一覧でカスタム認証プロバイダーをオンにして選択し、有効にします。
- OK をクリックします。
構成
属性
なし。
子要素
要素 | 説明 |
---|---|
providers |
省略可能な要素です。 カスタム認証プロバイダーの既定のコレクションを指定します。 |
構成サンプル
次の構成サンプルは、既定のカスタム認証プロバイダーを定義する FTP サービスの <siteDefaults>
要素の例を示しています。
<siteDefaults>
<ftpServer>
<security>
<authentication>
<customAuthentication>
<providers>
<add name="FtpCustomAuthenticationModule" enabled="true" />
</providers>
</customAuthentication>
</authentication>
</security>
</ftpServer>
</siteDefaults>
サンプル コード
次のコード サンプルは、FTP サービスの既定のカスタム認証プロバイダーの構成を示しています。
AppCmd.exe
appcmd.exe set config -section:system.applicationHost/sites /+"siteDefaults.ftpServer.security.authentication.customAuthentication.providers.[name='FtpCustomAuthenticationModule',enabled='True']" /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 sitesSection = config.GetSection("system.applicationHost/sites");
ConfigurationElement siteDefaultsElement = sitesSection.GetChildElement("siteDefaults");
ConfigurationElement ftpServerElement = siteDefaultsElement.GetChildElement("ftpServer");
ConfigurationElement securityElement = ftpServerElement.GetChildElement("security");
ConfigurationElement authenticationElement = securityElement.GetChildElement("authentication");
ConfigurationElement customAuthenticationElement = authenticationElement.GetChildElement("customAuthentication");
ConfigurationElementCollection providersCollection = customAuthenticationElement.GetCollection("providers");
ConfigurationElement addElement1 = providersCollection.CreateElement("add");
addElement1["name"] = @"FtpCustomAuthenticationModule";
addElement1["enabled"] = true;
providersCollection.Add(addElement1);
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 sitesSection As ConfigurationSection = config.GetSection("system.applicationHost/sites")
Dim siteDefaultsElement As ConfigurationElement = sitesSection.GetChildElement("siteDefaults")
Dim ftpServerElement As ConfigurationElement = siteDefaultsElement.GetChildElement("ftpServer")
Dim securityElement As ConfigurationElement = ftpServerElement.GetChildElement("security")
Dim authenticationElement As ConfigurationElement = securityElement.GetChildElement("authentication")
Dim customAuthenticationElement As ConfigurationElement = authenticationElement.GetChildElement("customAuthentication")
Dim providersCollection As ConfigurationElementCollection = customAuthenticationElement.GetCollection("providers")
Dim addElement1 As ConfigurationElement = providersCollection.CreateElement("add")
addElement1("name") = "FtpCustomAuthenticationModule"
addElement1("enabled") = True
providersCollection.Add(addElement1)
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST");
var siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults");
var ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer");
var securityElement = ftpServerElement.ChildElements.Item("security");
var authenticationElement = securityElement.ChildElements.Item("authentication");
var customAuthenticationElement = authenticationElement.ChildElements.Item("customAuthentication");
var providersCollection = customAuthenticationElement.ChildElements.Item("providers").Collection;
var addElement1 = providersCollection.CreateNewElement("add");
addElement1.Properties.Item("name").Value = "FtpCustomAuthenticationModule";
addElement1.Properties.Item("enabled").Value = true;
providersCollection.AddElement(addElement1);
adminManager.CommitChanges();
VBScript
Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set sitesSection = adminManager.GetAdminSection("system.applicationHost/sites", "MACHINE/WEBROOT/APPHOST")
Set siteDefaultsElement = sitesSection.ChildElements.Item("siteDefaults")
Set ftpServerElement = siteDefaultsElement.ChildElements.Item("ftpServer")
Set securityElement = ftpServerElement.ChildElements.Item("security")
Set authenticationElement = securityElement.ChildElements.Item("authentication")
Set customAuthenticationElement = authenticationElement.ChildElements.Item("customAuthentication")
Set providersCollection = customAuthenticationElement.ChildElements.Item("providers").Collection
Set addElement1 = providersCollection.CreateNewElement("add")
addElement1.Properties.Item("name").Value = "FtpCustomAuthenticationModule"
addElement1.Properties.Item("enabled").Value = True
providersCollection.AddElement(addElement1)
adminManager.CommitChanges()