동적 IP 보안 <dynamicIpSecurity>

개요

요소는 <dynamicIpSecurity> 악의적인 웹 요청을 차단하는 동적 수단을 제공합니다. 동적 IP 제한을 사용하면 관리자가 차단해야 하는 IP 주소를 식별할 필요가 없습니다. 대신 관리자는 설정된 조건을 충족하는 모든 IP 주소를 차단하도록 시스템을 구성할 수 있습니다. 여기에는 해당 클라이언트의 동시 HTTP 연결 요청 수가 특정 수를 초과하는 경우 원격 클라이언트 차단 또는 일정 기간 동안 수신된 요청 수가 특정 수를 초과하는 경우 클라이언트 차단이 포함될 수 있습니다. 동적 IP 제한은 서버 또는 사이트 수준에서 구성할 수 있습니다.

관리자는 클라이언트가 차단된 경우 반환될 HTTP 응답 상태 코드를 지정할 수 있습니다. 권한 없음(401); 사용할 수 없음(403); 또는 찾을 수 없음(404). 거부 작업 유형을 중단으로 설정하여 이유를 표시하지 않고 연결을 삭제할 수도 있습니다.

프록시 모드를 사용하도록 설정하면 HTTP 프록시 또는 부하 분산 장치를 통해 웹 서버에 연결하는 클라이언트의 원래 IP 주소를 식별하여 요청을 차단할 수 있습니다. 이 작업은 x-forwarded-for-HTTP 헤더를 검사하여 수행됩니다.

호환성

버전 참고
IIS 10.0 <dynamicIpSecurity> 요소가 IIS 10.0에서 수정되지 않았습니다.
IIS 8.5 <dynamicIpSecurity> 요소가 IIS 8.5에서 수정되지 않았습니다.
IIS 8.0 요소는 <dynamicIpSecurity> IIS 8.0에서 도입되었습니다.
IIS 7.5 해당 없음
IIS 7.0 해당 없음
IIS 6.0 해당 없음

설치 프로그램

Windows Server 2012 또는 Windows Server 2012 R2

  1. 작업 표시줄에서 서버 관리자를 클릭합니다.
  2. 서버 관리자관리 메뉴를 클릭한 다음 역할 및 기능 추가를 클릭합니다.
  3. 역할 및 기능 추가 마법사에서 다음을 클릭합니다. 설치 유형을 선택하고 다음을 클릭합니다. 대상 서버를 선택하고 다음을 클릭합니다.
  4. 서버 역할 페이지에서 웹 서버(IIS)를 확장하고, 웹 서버를 확장하고, 보안을 확장한 다음, IP 및 도메인 제한을 선택합니다. 다음을 클릭합니다.
    Windows Server 2012에 대해 선택한 IP 및 도메인 제한을 보여 주는 스크린샷 .
  5. 기능 선택 페이지에서 다음을 클릭합니다.
  6. 설치 선택 확인 페이지에서 설치를 클릭합니다.
  7. Results(결과) 페이지에서 Close(닫기)를 클릭합니다.

Windows 8 또는 Windows 8.1

  1. 시작 화면에서 포인터를 왼쪽 아래 모서리로 이동하고 시작 단추를 마우스 오른쪽 단추로 클릭한 다음 제어판 클릭합니다.
  2. 제어판프로그램 및 기능을 클릭한 다음 Windows 기능 켜기 또는 끄기를 클릭합니다.
  3. 인터넷 정보 서비스를 확장하고 World Wide Web Services를 확장한 다음 보안을 확장한 다음 IP 보안을 선택합니다.
    Windows 8에 대해 선택된 IP 보안을 보여 주는 스크린샷
  4. 확인을 클릭합니다.
  5. 닫기를 클릭합니다.

방법

웹 사이트에 대한 액세스를 거부하는 동적 IP 제한을 추가하는 방법

  1. IIS(인터넷 정보 서비스) 관리자를 엽니다.

    • Windows Server 2012 이상을 사용하는 경우:

      • 작업 표시줄에서 서버 관리자 클릭하고 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 클릭합니다.
    • Windows 8 이상을 사용하는 경우:

      • Windows 키를 누른 채로 문자 X를 누른 다음 제어판 클릭합니다.
      • 관리 도구를 클릭한 다음 IIS(인터넷 정보 서비스) 관리자를 두 번 클릭합니다.
  2. 연결 창에서 서버 이름을 선택하여 서버에 대한 동적 IP 제한을 추가하거나 사이트를 확장한 다음 사이트에 대한 동적 IP 제한을 추가할 사이트를 선택합니다.

  3. 창에서 IP 주소 및 도메인 제한 기능을 두 번 클릭합니다.

  4. 작업 창에서 동적 제한 설정 편집...을 클릭합니다.

  5. 동적 IP 제한 설정 대화 상자에서 동시 샘플 수 및/또는 요청 속도에 따라 IP 주소를 거부할지 여부를 지정하고 로깅 전용 모드를 사용하도록 설정할지 여부를 지정한 다음 확인을 클릭합니다.

    동적 IP 제한 설정 대화 상자를 보여 주는 스크린샷 모든 변수가 선택됩니다.

구성

요소는 <dynamicIpSecurity> 서버 또는 사이트 수준에서 구성됩니다.

특성

attribute Description
denyAction 선택적 열거형 특성입니다.

IIS가 클라이언트에 다시 보내야 하는 기본 거부 모드 응답을 지정합니다.

기본값은 Forbidden입니다.
Description
AbortRequest 기본적으로 IIS는 의 거부 모드 응답을 Abort 클라이언트에 다시 보내도록 지정합니다.

숫자 값은 입니다 0.

Unauthorized 기본적으로 IIS는 의 거부 모드 응답을 Unauthorized 클라이언트에 다시 보내도록 지정합니다. 원격 엔드에서 브라우저 기반 클라이언트를 사용하는 경우 권한 없음을 반환하면 인증 대화 상자가 원격 클라이언트에 표시되어 IIS에 대한 가짜 인증 시도가 발생할 수 있습니다.

숫자 값은 입니다 401.

Forbidden 기본적으로 IIS는 의 거부 모드 응답을 Forbidden 클라이언트에 다시 보내도록 지정합니다.

숫자 값은 입니다 403.

NotFound 기본적으로 IIS는 의 거부 모드 응답을 Not Found 클라이언트에 다시 보내도록 지정합니다.

숫자 값은 입니다 404.

enableLoggingOnlyMode 선택적 부울 특성입니다.

IIS가 실제로 거부하지 않고 거부될 클라이언트의 요청을 기록할 것을 지정합니다.

기본값은 false입니다.
enableProxyMode 선택적 부울 특성입니다.

IIS는 IIS에서 볼 수 있는 클라이언트 IP의 요청을 차단할 뿐만 아니라 x-forwarded-for HTTP 헤더에서 수신된 IP 주소의 요청을 차단할 수 있습니다. 이 헤더를 사용하면 HTTP 프록시 또는 부하 분산 장치를 통해 연결하는 클라이언트의 원래 IP 주소를 식별할 수 있습니다. 이를 프록시 모드라고 합니다.

기본값은 false입니다.

자식 요소

요소 Description
denyByConcurrentRequests 선택적 요소입니다.

특정 원격 클라이언트가 시간에 따라 수신된 요청 수에 따라 차단되도록 지정합니다.
denyByRequestRate 선택적 요소입니다.

클라이언트의 동시 HTTP 연결 요청 수에 따라 특정 원격 클라이언트가 차단되도록 지정합니다.

구성 샘플

다음 구성 샘플에서는 동적 IP 주소 제한을 설정하는 방법을 보여 줍니다.

<system.webServer>
   <security>
      <dynamicIpSecurity enableLoggingOnlyMode="true">
         <denyByConcurrentRequests enabled="true" maxConcurrentRequests="10" />
         <denyByRequestRate enabled="true" maxRequests="30" 
            requestIntervalInMilliseconds="300" />
      </dynamicIpSecurity>
   </security>
</system.webServer>

샘플 코드

다음 예제에서는 사이트에 대해 dynamicIpSecurity>를 구성<합니다.

AppCmd.exe

appcmd.exe set config "Default Web Site" -section:system.webServer/security/dynamicIpSecurity /denyAction:"Unauthorized" /enableProxyMode:"True" /enableLoggingOnlyMode:"True"  /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/security/dynamicIpSecurity /denyByConcurrentRequests.enabled:"True" /denyByConcurrentRequests.maxConcurrentRequests:"10" /commit:apphost
appcmd.exe set config "Default Web Site" -section:system.webServer/security/dynamicIpSecurity /denyByRequestRate.enabled:"True" /denyByRequestRate.maxRequests:"25" /denyByRequestRate.requestIntervalInMilliseconds:"210"  /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 dynamicIpSecuritySection = config.GetSection("system.webServer/security/dynamicIpSecurity", "Default Web Site");
            dynamicIpSecuritySection["denyAction"] = @"Forbidden";
            dynamicIpSecuritySection["enableProxyMode"] = true;
            dynamicIpSecuritySection["enableLoggingOnlyMode"] = true;
            
            ConfigurationElement denyByConcurrentRequestsElement = dynamicIpSecuritySection.GetChildElement("denyByConcurrentRequests");
            denyByConcurrentRequestsElement["enabled"] = true;
            denyByConcurrentRequestsElement["maxConcurrentRequests"] = 10;
            
            ConfigurationElement denyByRequestRateElement = dynamicIpSecuritySection.GetChildElement("denyByRequestRate");
            denyByRequestRateElement["enabled"] = true;
            denyByRequestRateElement["maxRequests"] = 10;
            denyByRequestRateElement["requestIntervalInMilliseconds"] = 10;
            
            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 dynamicIpSecuritySection As ConfigurationSection = config.GetSection("system.webServer/security/dynamicIpSecurity", "Default Web Site")
      dynamicIpSecuritySection("denyAction") = "Forbidden"
      dynamicIpSecuritySection("enableProxyMode") = true
      dynamicIpSecuritySection("enableLoggingOnlyMode") = true
      Dim denyByConcurrentRequestsElement As ConfigurationElement = dynamicIpSecuritySection.GetChildElement("denyByConcurrentRequests")
      denyByConcurrentRequestsElement("enabled") = true
      denyByConcurrentRequestsElement("maxConcurrentRequests") = 10
      Dim denyByRequestRateElement As ConfigurationElement = dynamicIpSecuritySection.GetChildElement("denyByRequestRate")
      denyByRequestRateElement("enabled") = true
      denyByRequestRateElement("maxRequests") = 10
      denyByRequestRateElement("requestIntervalInMilliseconds") = 10
      serverManager.CommitChanges
   End Sub
End Module

JavaScript

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

var dynamicIpSecuritySection = adminManager.GetAdminSection ("system.webServer/security/dynamicIpSecurity", "MACHINE/WEBROOT/APPHOST/Default Web Site");
dynamicIpSecuritySection.Properties.Item("denyAction").Value = "Unauthorized";
dynamicIpSecuritySection.Properties.Item("enableProxyMode").Value = true;
dynamicIpSecuritySection.Properties.Item("enableLoggingOnlyMode").Value = true;
var denyByConcurrentRequestsElement = dynamicIpSecuritySection.ChildElements.Item("denyByConcurrentRequests");
denyByConcurrentRequestsElement.Properties.Item("enabled").Value = true;
denyByConcurrentRequestsElement.Properties.Item("maxConcurrentRequests").Value = 10;
var denyByRequestRateElement = dynamicIpSecuritySection.ChildElements.Item("denyByRequestRate");
denyByRequestRateElement.Properties.Item("enabled").Value = true;
denyByRequestRateElement.Properties.Item("maxRequests").Value = 25;
denyByRequestRateElement.Properties.Item("requestIntervalInMilliseconds").Value = 210;

adminManager.CommitChanges();

VBScript

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

Set dynamicIpSecuritySection = adminManager.GetAdminSection ("system.webServer/security/dynamicIpSecurity", "MACHINE/WEBROOT/APPHOST/Default Web Site")
dynamicIpSecuritySection.Properties.Item("denyAction").Value = "Unauthorized"
dynamicIpSecuritySection.Properties.Item("enableProxyMode").Value = true
dynamicIpSecuritySection.Properties.Item("enableLoggingOnlyMode").Value = true
Set denyByConcurrentRequestsElement = dynamicIpSecuritySection.ChildElements.Item ("denyByConcurrentRequests")
denyByConcurrentRequestsElement.Properties.Item("enabled").Value = true
denyByConcurrentRequestsElement.Properties.Item("maxConcurrentRequests").Value = 10
Set denyByRequestRateElement = dynamicIpSecuritySection.ChildElements.Item("denyByRequestRate")
denyByRequestRateElement.Properties.Item("enabled").Value = true
denyByRequestRateElement.Properties.Item("maxRequests").Value = 25
denyByRequestRateElement.Properties.Item("requestIntervalInMilliseconds").Value = 210

adminManager.CommitChanges()

PowerShell

Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity" -name "denyAction" -value "Unauthorized"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity" -name "enableProxyMode" -value "True"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity" -name "enableLoggingOnlyMode" -value "True"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity/denyByConcurrentRequests" -name "enabled" -value "True"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity/denyByConcurrentRequests" -name "maxConcurrentRequests" -value 20
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity/denyByRequestRate" -name "enabled" -value "True"
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity/denyByRequestRate" -name "maxRequests" -value 20
Set-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location 'Default Web Site' -filter "system.webServer/security/dynamicIpSecurity/denyByRequestRate" -name "requestIntervalInMilliseconds" -value 20