FTP IP 보안 <ipSecurity>
개요
요소는 <ipSecurity>
FTP 7에서 IP 기반 보안 제한 목록을 정의합니다. 이러한 제한은 IP 버전 4 주소, IP 버전 4 주소 범위 또는 DNS 도메인 이름을 기반으로 할 수 있습니다.
호환성
버전 | 참고 |
---|---|
IIS 10.0 | <ipSecurity> 요소가 IIS 10.0에서 수정되지 않았습니다. |
IIS 8.5 | <ipSecurity> 요소가 IIS 8.5에서 수정되지 않았습니다. |
IIS 8.0 | <ipSecurity> 요소가 IIS 8.0에서 수정되지 않았습니다. |
IIS 7.5 | <ipSecurity> 요소의 <system.ftpServer/security> 요소는 IIS 7.5의 기능으로 제공됩니다. |
IIS 7.0 | <ipSecurity> 요소의 <system.ftpServer/security> 요소는 IIS 7.0에 대한 별도의 다운로드인 FTP 7.0에서 도입되었습니다. |
IIS 6.0 | 해당 없음 |
참고
FTP 7.0 및 FTP 7.5 서비스는 IIS 7.0용 대역 외 서비스를 제공했으며, 다음 URL에서 모듈을 다운로드하고 설치해야 했습니다.
Windows 7 및 Windows Server 2008 R2에서는 FTP 7.5 서비스가 IIS 7.5의 기능으로 제공됩니다. 따라서 FTP 서비스를 더 이상 다운로드할 필요가 없습니다.
설치 프로그램
웹 서버에 대한 FTP 게시를 지원하려면 FTP 서비스를 설치해야 합니다. 이렇게 하려면 다음 단계를 수행합니다.
Windows Server 2012 또는 Windows Server 2012 R2
작업 표시줄에서 서버 관리자를 클릭합니다.
서버 관리자관리 메뉴를 클릭한 다음 역할 및 기능 추가를 클릭합니다.
역할 및 기능 추가 마법사에서 다음을 클릭합니다. 설치 유형을 선택하고 다음을 클릭합니다. 대상 서버를 선택하고 다음을 클릭합니다.
서버 역할 페이지에서 웹 서버(IIS)를 확장한 다음 FTP 서버를 선택합니다.
다음을 클릭한 다음 기능 선택 페이지에서 다음을 다시 클릭합니다.
설치 선택 확인 페이지에서 설치를 클릭합니다.
Results(결과) 페이지에서 Close(닫기)를 클릭합니다.
Windows 8 또는 Windows 8.1
시작 화면에서 포인터를 왼쪽 아래 모서리로 이동하고 시작 단추를 마우스 오른쪽 단추로 클릭한 다음 제어판 클릭합니다.
제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.
인터넷 정보 서비스를 확장한 다음 FTP 서버를 선택합니다.
확인을 클릭합니다.
닫기를 클릭합니다.
Windows Server 2008 R2
작업 표시줄에서 시작을 클릭하고 관리 도구를 가리킨 다음 서버 관리자 클릭합니다.
서버 관리자 계층 창에서 역할을 확장한 다음 웹 서버(IIS)를 클릭합니다.
웹 서버(IIS) 창에서 역할 서비스 섹션으로 스크롤한 다음 역할 서비스 추가를 클릭합니다.
역할 서비스 추가 마법사의 역할 서비스 선택 페이지에서 FTP 서버를 확장합니다.
FTP 서비스를 선택합니다.
다음을 클릭합니다.
설치 선택 확인 페이지에서 설치를 클릭합니다.
Results(결과) 페이지에서 Close(닫기)를 클릭합니다.
Windows 7
작업 표시줄에서 시작을 클릭한 다음 제어판 클릭합니다.
제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.
인터넷 정보 서비스를 확장한 다음 FTP 서버를 확장합니다.
FTP 서비스를 선택합니다.
확인을 클릭합니다.
Windows Server 2008 또는 Windows Vista
다음 URL에서 설치 패키지를 다운로드합니다.
다음 연습의 지침에 따라 FTP 서비스를 설치합니다.
방법
FTP 사이트에 대한 허용 또는 액세스를 위해 IP 제한을 추가하는 방법
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(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
연결 창에서 서버 이름을 확장하고 사이트를 확장한 다음 IP 제한을 추가할 FTP 사이트 또는 URL을 확장합니다.
FTP IPv4 주소 및 도메인 제한 기능의 작업 창에서 항목 허용 추가... 또는 거부 항목 추가...를 클릭합니다.
FTP 사이트에 대한 IP 제한 기능 설정을 편집하는 방법
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(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
연결 창에서 서버 이름을 확장하고 사이트를 확장한 다음 IP 제한을 구성할 FTP 사이트 또는 URL을 확장합니다.
지정되지 않은 클라이언트에 대한 기본 액세스 동작을 선택하고 도메인 이름으로 제한을 사용할지 여부를 지정한 다음 확인을 클릭합니다.
구성
요소는 <ipSecurity>
사이트 또는 URL 수준에서 구성됩니다.
규칙은 목록에 표시되는 순서대로 위에서 아래로 처리됩니다. 허용 목록에 있는 특성이 마지막으로 처리됩니다. IPsec(인터넷 프로토콜 보안) 제한에 대한 모범 사례는 거부 규칙을 먼저 나열하는 것입니다. 허용 목록에 있는 특성이false로 설정된 경우 지울 수 없습니다.
특성
attribute | Description |
---|---|
allowUnlisted |
선택적 부울 특성입니다. 목록에 없는 IP 주소를 허용할지 여부를 지정합니다. allowUnlisted 특성을 true로 설정하면 목록에 없는 IP 주소가 서버에 액세스할 수 있습니다. allowUnlisted 특성을 false로 설정하면 서버가 잠기므로 나열되지 않는 한 모든 IP 주소에 액세스할 수 없습니다. 이 특성을 false로 설정하고 로컬 루프백 주소(127.0.0.1)를 허용된 IP 주소로 나열하지 않으면 로컬 콘솔에서 브라우저를 사용하여 서버에 액세스할 수 없습니다. 기본값은 true 입니다. |
enableReverseDns |
선택적 부울 특성입니다. FTP 서버에 대해 역방향 DNS(Domain Name System) 조회를 사용하거나 사용하지 않도록 설정할지 여부를 지정합니다. 역방향 조회에는 IP 주소가 알려진 경우 도메인 이름을 조회하는 작업이 포함됩니다. 주의: 역방향 DNS 조회는 상당한 리소스와 시간을 사용합니다. 기본값은 false 입니다. |
자식 요소
요소 | Description |
---|---|
add |
선택적 요소입니다. IP 주소 제한 컬렉션에 IP 제한을 추가합니다. |
remove |
선택적 요소입니다. 컬렉션에서 제한에 대한 참조를 제거합니다 <ipSecurity> . |
clear |
선택적 요소입니다. 컬렉션에서 제한 사항에 대한 모든 참조를 <ipSecurity> 제거합니다. |
구성 샘플
다음 샘플에서는 FTP 사이트의 요소에 있는 <system.ftpServer>
몇 가지 보안 관련 구성 설정을 보여 줍니다. 더 구체적으로 말하자면, 이 예제의 <location>
설정은 다음을 하는 방법을 보여 줍니다.
- 관리자 그룹에 대한 읽기 및 쓰기 액세스에 대한 FTP 권한 부여 규칙을 지정합니다.
- *.exe, *.bat 및 *.cmd 파일을 거부하는 FTP 요청 필터링 옵션을 지정합니다.
- 최대 콘텐츠 길이 10000000바이트 및 최대 URL 길이 1024바이트에 대한 FTP 요청 제한을 지정합니다.
- FrontPage 서버 확장과 함께 사용되는 _vti_bin 가상 디렉터리에 대한 FTP 액세스를 차단합니다.
- 127.0.0.1에서 액세스를 허용하고 169.254.0.0/255.255.0.0 범위의 IP 주소에서 액세스를 거부하는 FTP IP 필터링 옵션을 지정합니다.
<location path="ftp.example.com">
<system.ftpServer>
<security>
<authorization>
<add accessType="Allow" roles="administrators" permissions="Read, Write" />
</authorization>
<requestFiltering>
<fileExtensions allowUnlisted="true">
<add fileExtension=".exe" allowed="false" />
<add fileExtension=".bat" allowed="false" />
<add fileExtension=".cmd" allowed="false" />
</fileExtensions>
<requestLimits maxAllowedContentLength="1000000" maxUrl="1024" />
<hiddenSegments>
<add segment="_vti_bin" />
</hiddenSegments>
</requestFiltering>
<ipSecurity enableReverseDns="false" allowUnlisted="true">
<add ipAddress="127.0.0.1" allowed="true" />
<add ipAddress="169.254.0.0" subnetMask="255.255.0.0" allowed="false" />
</ipSecurity>
</security>
</system.ftpServer>
</location>
샘플 코드
다음 예제에서는 목록에 없는 IP 주소를 허용하도록 FTP IP 보안을 구성한 다음, 127.0.0.1에서 액세스를 허용하고 169.254.0.0/255.255.0.0 범위의 IP 주소에서 액세스를 거부하는 IP 제한을 지정합니다.
AppCmd.exe
appcmd.exe set config "Default Web Site" -section:system.ftpServer/security/ipSecurity /allowUnlisted:"True" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.ftpServer/security/ipSecurity /+"[ipAddress='127.0.0.1',allowed='True']" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.ftpServer/security/ipSecurity /+"[ipAddress='169.254.0.0',subnetMask='255.255.0.0']" /commit:apphost
참고
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 ipSecuritySection = config.GetSection("system.ftpServer/security/ipSecurity", "Default Web Site");
ConfigurationElementCollection ipSecurityCollection = ipSecuritySection.GetCollection();
ipSecuritySection["allowUnlisted"] = true;
ConfigurationElement addElement = ipSecurityCollection.CreateElement("add");
addElement["ipAddress"] = @"127.0.0.1";
addElement["allowed"] = true;
ipSecurityCollection.Add(addElement);
ConfigurationElement addElement1 = ipSecurityCollection.CreateElement("add");
addElement1["ipAddress"] = @"169.254.0.0";
addElement1["subnetMask"] = @"255.255.0.0";
ipSecurityCollection.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 ipSecuritySection As ConfigurationSection = config.GetSection("system.ftpServer/security/ipSecurity", "Default Web Site")
Dim ipSecurityCollection As ConfigurationElementCollection = ipSecuritySection.GetCollection
ipSecuritySection("allowUnlisted") = True
Dim addElement As ConfigurationElement = ipSecurityCollection.CreateElement("add")
addElement("ipAddress") = "127.0.0.1"
addElement("allowed") = True
ipSecurityCollection.Add(addElement)
Dim addElement1 As ConfigurationElement = ipSecurityCollection.CreateElement("add")
addElement1("ipAddress") = "169.254.0.0"
addElement1("subnetMask") = "255.255.0.0"
ipSecurityCollection.Add(addElement1)
serverManager.CommitChanges()
End Sub
End Module
JavaScript
var adminManager = new ActiveXObject('Microsoft.ApplicationHost.WritableAdminManager');
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST";
var ipSecuritySection = adminManager.GetAdminSection("system.ftpServer/security/ipSecurity", "MACHINE/WEBROOT/APPHOST/Default Web Site");
var ipSecurityCollection = ipSecuritySection.Collection;
ipSecuritySection.Properties.Item("allowUnlisted").Value = true;
var addElement = ipSecurityCollection.CreateNewElement("add");
addElement.Properties.Item("ipAddress").Value = "127.0.0.1";
addElement.Properties.Item("allowed").Value = true;
ipSecurityCollection.AddElement(addElement);
var addElement1 = ipSecurityCollection.CreateNewElement("add");
addElement1.Properties.Item("ipAddress").Value = "169.254.0.0";
addElement1.Properties.Item("subnetMask").Value = "255.255.0.0";
ipSecurityCollection.AddElement(addElement1);
adminManager.CommitChanges();
VBScript
Set adminManager = createObject("Microsoft.ApplicationHost.WritableAdminManager")
adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
Set ipSecuritySection = adminManager.GetAdminSection("system.ftpServer/security/ipSecurity", "MACHINE/WEBROOT/APPHOST/Default Web Site")
Set ipSecurityCollection = ipSecuritySection.Collection
ipSecuritySection.Properties.Item("allowUnlisted").Value = True
Set addElement = ipSecurityCollection.CreateNewElement("add")
addElement.Properties.Item("ipAddress").Value = "127.0.0.1"
addElement.Properties.Item("allowed").Value = True
ipSecurityCollection.AddElement(addElement)
Set addElement1 = ipSecurityCollection.CreateNewElement("add")
addElement1.Properties.Item("ipAddress").Value = "169.254.0.0"
addElement1.Properties.Item("subnetMask").Value = "255.255.0.0"
ipSecurityCollection.AddElement(addElement1)
adminManager.CommitChanges()