IP address lists – F5 WAF for NGINX를 통한 정책 적용 IP 목록 관리

F5 WAF for NGINX는 IP address lists 기능을 제공하며, 이를 통해 하나의 정책 파일에서 클라이언트의 IP 주소를 화이트리스트(허용), 블랙리스트(차단), 정책 기반 리스트(Policy-based) 형태로 그룹화하고 각각 다른 동작 방식을 적용할 수 있습니다.

이 포스트에서는 F5 WAF for NGINX의 IP address lists 기능을 활용하여

  • 여러 클라이언트 IP를 리스트로 관리하고,
  • 각 리스트별로 정책 동작(policy-default, always, never)을 설정하며,
  • 실제 curl 요청을 통해 정상 응답, 차단, 허용 여부를 검증하는 과정을 다룹니다.

이 과정을 통해, F5 WAF for NGINX가 IP 기반 접근 제어를 얼마나 유연하게 처리할 수 있는지 확인할 수 있습니다.

목차

1. 환경 및 버전 정보
2. F5 WAF for NGINX IP address lists 구성
3. IP address lists 포함 정책 적용 및 확인
4. 결론

1. 환경 및 버전 정보

구성 요소버전
OSUbuntu 24.04.3
NGINX PlusR35
F5 WAF for NGINX5.9.0
NGINX Instance Manager2.20.0

2. F5 WAF for NGINX IP address lists 구성

F5 WAF for NGINX의 IP address lists 기능은 정책 파일에서 ip-address-lists 필드를 통해 다음과 같이 구성할 수 있습니다.

{
  "policy": {
    "name": "IpGroups_policy",
    "template": {
      "name": "POLICY_TEMPLATE_NGINX_BASE"
    },
    "applicationLanguage": "utf-8",
    "caseInsensitive": false,
    "enforcementMode": "blocking",
    "ip-address-lists": [
      {
        "name": "Policy",
        "description": "Block by policy",
        "blockRequests": "policy-default",
        "ipAddresses": [
          {
            "ipAddress": "192.168.40.220/32"
          },
          {
            "ipAddress": "1111:fc00:0:112::2"
          }
        ]
      },
      {
        "name": "Blacklist",
        "description": "Always block IPs in list",
        "blockRequests": "always",
        "ipAddresses": [
          {
            "ipAddress": "192.168.40.224/32"
          }
        ]
      },
      {
        "name": "Whitelist",
        "description": "Never block IPs in list",
        "blockRequests": "never",
        "neverLogRequests": true,
        "ipAddresses": [
          {
            "ipAddress": "192.168.200.0/24"
          },
          {
            "ipAddress": "192.168.201.0/24"
          }
        ]
      }
    ]
  }
}
  • name: IP 리스트의 이름을 설정합니다.
  • blockRequests: IP 리스트의 정책 적용 방식을 설정합니다. 기본 값은 policy-default 입니다.
    • policy-default: 정책 파일의 설정에 따라 요청을 처리합니다.
    • always: 정책 설정과 무관하게 모든 요청을 차단합니다.
    • never: 정책 위반 여부와 무관하게 모든 요청을 허용합니다.
  • neverLogRequests: true로 설정 시 정책 위반 여부(알림/차단), 로깅 설정과 무관하게 해당 요청은 보안 로그에 기록되지 않습니다. 기본 값은 false 입니다.
  • ipAddress: IP 리스트에 포함될 IP 목록을 설정합니다. IPv4, IPv6 모두 구성 가능하며, CIDR 표기법으로 서브넷을 정의할 수 있습니다.

3. IP address lists 포함 정책 적용 및 확인

IP address lists 구성이 포함된 정책의 IP 리스트별 동작 방식(policy-default, always, never)에 따른 차이를 확인하기 위해 정책 파일을 다음과 같이 구성했습니다.

ip_list_policy.json
{
  "policy": {
    "name": "IpGroups_policy",
    "template": {
      "name": "POLICY_TEMPLATE_NGINX_BASE"
    },
    "applicationLanguage": "utf-8",
    "caseInsensitive": false,
    "enforcementMode": "blocking",
    "ip-address-lists": [
      {
        "name": "Policy",
        "description": "Block by policy",
        "blockRequests": "policy-default",
        "ipAddresses": [
          {
            "ipAddress": "192.168.40.220/32"
          }
        ]
      },
      {
        "name": "Blacklist",
        "description": "Always block IPs in list",
        "blockRequests": "always",
        "ipAddresses": [
          {
            "ipAddress": "192.168.40.224/32"
          }
        ]
      },
      {
        "name": "Whitelist",
        "description": "Never block IPs in list",
        "blockRequests": "never",
        "ipAddresses": [
          {
            "ipAddress": "192.168.200.0/24"
          },
          {
            "ipAddress": "192.168.201.0/24"
          }
        ]
      }
    ]
  }
}
  • 192.168.40.220 IP 클라이언트의 요청은 F5 WAF for NGINX의 기본 정책(default policy) 동작 방식에 따라 처리됩니다.
  • 192.168.40.224 IP 클라이언트의 요청은 정책 위반 여부와 무관하게 무조건 차단됩니다.
  • 192.168.200.0/24, 192.168.201.0/24 범위 IP 클라이언트의 요청은 정책 위반 여부와 무관하게 무조건 허용됩니다.

해당 IP address lists 포함 정책을 적용한 NGINX의 설정 파일은 다음과 같습니다.

ip_list.conf
server {
    listen 80;
    server_name ip-list.devopssong.com;

    access_log /var/log/nginx/ip_list_access.log;
    error_log /var/log/nginx/ip_list_error.log;

    proxy_http_version 1.1;

    app_protect_enable on;
    app_protect_policy_file /etc/app_protect/conf/ip_list_policy.json;

    app_protect_security_log_enable on;
    app_protect_security_log /etc/app_protect/conf/log_default.json /var/log/nginx/waf.log;
    app_protect_security_log /etc/app_protect/conf/log_sm.json syslog:server=192.168.40.225:514;

    location / {
        proxy_pass http://127.0.0.1:8080;
    }
}

앞서 구성한 정책 파일이 적용되어있으며, NGINX Instance Manager Security Monitoring을 위한 보안 로깅 구성이 적용되어 있습니다.
요청이 프록시 되는 8080 포트는 NGINX 기본 html 페이지를 응답으로 제공합니다.

$ curl http://ip-list.devopssong.com


<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>

......

3개의 서로 다른 클라이언트(192.168.40.220, 192.168.40.224, 192.168.201.214)에서 정상 요청을 NGINX로 전송하고, 응답을 확인합니다.

정책 기반 처리(policy-default) 클라이언트: 192.168.40.220
$ curl --interface 192.168.40.220 http://ip-list.devopssong.com

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>

......

요청이 정책을 위반하지 않았기 때문에, 정상 응답을 수신합니다.

차단 처리(always) 클라이언트: 192.168.40.224
$ curl --interface 192.168.40.224 http://ip-list.devopssong.com

<html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: 2166908741080275862<br><br><a href='javascript:history.back();'>[Go Back]</a></body></html>

차단 처리하는 IP 리스트에 포함된 클라이언트로 요청 시 정상 요청도 차단됨을 확인할 수 있습니다.

허용 처리 클라이언트(never): 192.168.201.214
$ curl --interface 192.168.201.214 http://ip-list.devopssong.com

<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>

......

정상 응답 수신을 확인할 수 있습니다.

NGINX Instance Manager의 Security Monitoring 대시보드에서 이벤트 로그를 조회하면 위와 같이 IP address lists 에 포함된 3개 클라이언트 요청의 알림, 차단 내역을 확인할 수 있습니다.

IP address lists 정상 요청, 차단 IP 리스트 결과
IP address lists 정상 요청, 차단 IP 리스트 결과
IP address lists 정상 요청, 차단 IP 리스트 결과

차단 내용을 확인하면 IP is blacklisted, VIOL_BLACKLISTED_IP를 확인할 수 있습니다. Bot Client Detected의 경우 F5 WAF for NGINX 기본 정책 구성 상 curl 클라이언트를 Bot Client로 판단하여 알림 처리되는 Violation입니다.

다음은 정책 기반 처리 클라이언트와 허용 처리 클라이언트로 각각 정책에 의해 차단되는 요청을 전송하고 결과를 확인하겠습니다.

정책 기반 처리(policy-default) 클라이언트: 192.168.40.220
$ curl --interface 192.168.40.220 'http://ip-list.devopssong.com/<script>'

<html><head><title>Request Rejected</title></head><body>The requested URL was rejected. Please consult with your administrator.<br><br>Your support ID is: 2166908741080277902<br><br><a href='javascript:history.back();'>[Go Back]</a></body></html>

클라이언트의 요청이 정책을 위반하여 차단됩니다.

허용 처리 클라이언트(never): 192.168.201.214
$ curl --interface 192.168.201.214 'http://ip-list.devopssong.com/<script>'

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.29.0</center>
</body>
</html>

클라이언트의 요청이 정책을 위반하였으나, 허용 처리 IP 리스트에 포함된 클라이언트로 차단되지 않습니다.

NGINX Instance Manager의 Security Monitoring 대시보드에서 이벤트 로그를 조회하여 두 요청의 결과를 확인할 수 있습니다.

차단된 요청을 대시보드에서 확인하면 XSS 공격 시그니처와 Violations로 차단되었음을 확인할 수 있습니다.

IP address lists 위반 요청, 허용 IP 리스트 결과
IP address lists 위반 요청, 허용 IP 리스트 결과
IP address lists 위반 요청, 허용 IP 리스트 결과
IP address lists 위반 요청, 허용 IP 리스트 결과

허용된 요청을 대시보드에서 확인하면 차단된 요청과 동일한 시그니처, Violation이 감지되었으나, 클라이언트가 허용 처리된 IP 리스트에 포함되어 요청이 차단되지 않고 통과됩니다.

4. 결론

IP address lists 기능은 F5 WAF for NGINX에서 IP 기반 보안 정책을 정교하게 제어할 수 있는 핵심 기능입니다.
이를 통해 관리자는 서비스 환경에 따라

  • 신뢰할 수 있는 IP는 항상 허용(never),
  • 의심되거나 위험한 IP는 무조건 차단(always),
  • 특정 IP는 정책 위반 여부에 따라 차단(policy-default)
    하도록 세밀하게 설정할 수 있습니다.

실제 테스트에서도, 블랙리스트 IP는 정상 요청조차 차단되었고, 화이트리스트 IP는 정책 위반 요청도 통과함을 확인했습니다.
따라서 IP address lists는 보안 효율성과 정책 유연성을 동시에 강화할 수 있는 실무적인 접근 제어 기능으로, 다양한 운영 환경에서 효과적으로 활용될 수 있습니다.

기존에 사용중이던 NGINX에 WAF 및 IP 리스트 기반 정책 적용과 같은 기능이 필요하신가요? NGINX STORE를 통해 문의하여 무료로 NGINX One trial을 통해 F5 WAF for NGINX를 체험해 보세요.

NGINX STORE를 통한 솔루션 도입 및 기술지원 무료 상담 신청

* indicates required