동시 요청에 의한 <거부 DenyByConcurrentRequests>

개요

요소는 <denyByConcurrentRequests> 해당 클라이언트의 동시 HTTP 연결 요청 수가 특정 수를 초과하는 경우 원격 클라이언트가 차단되도록 지정합니다.

호환성

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

설치 프로그램

동시 요청 수만큼 웹 서버에서 클라이언트 차단을 지원하려면 IP 및 도메인 제한 역할 서비스를 설치해야 합니다.

Windows Server 2012 또는 Windows Server 2012 R2

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

Windows 8 또는 Windows 8.1

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

방법

동시 요청 수로 IP 주소를 거부하는 방법

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

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

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

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

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

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

  5. 동적 IP 제한 설정 대화 상자에서 동시 요청 수에 따라 IP 주소 거부를 선택하고 최대 동시 요청 수를 입력한 다음 확인을 클릭합니다.

    선택한 동시 요청 수에 따라 거부 I P 주소가 있는 동적 IP 제한 설정 대화 상자를 보여 주는 스크린샷

구성

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

특성

attribute Description
enabled 선택적 부울 특성입니다.

해당 클라이언트의 동시 HTTP 연결 요청 수에 따라 원격 클라이언트를 차단할 수 있습니다.

기본값은 false입니다.
maxConcurrentRequests 선택적 uint 특성입니다.

클라이언트가 차단되는 클라이언트의 동시 HTTP 연결 요청 수입니다.

기본값은 5입니다.

자식 요소

없음

구성 샘플

다음 구성 샘플에서는 동적 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