일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- nginx ingress
- Argo
- MLflow
- Litmus
- keda
- 카오스 엔지니어링
- seldon core
- Pulumi
- opentelemetry
- blue/green
- Kubeflow
- eBPF
- xdp
- tekton
- knative
- 오퍼레이터
- Kubernetes 인증
- CANARY
- Model Serving
- opensearch
- kubernetes operator
- serving
- Kopf
- Continuous Deployment
- gitops
- CI/CD
- argocd
- mlops
- Kubernetes
- operator
- Today
- Total
Kubernetes 이야기
NGINX WAF 본문

ModSecurity는 Trustwave의 SpiderLabs에서 개발한 Apache, IIS 및 Nginx용 오픈 소스 크로스 플랫폼 WAF(웹 애플리케이션 방화벽) 엔진이다. 웹 애플리케이션에 대한 다양한 공격으로부터 보호하고 HTTP 트래픽 모니터링, 로깅 및 실시간 분석을 허용하는 강력한 이벤트 기반 프로그래밍 언어가 있다.
ModSecurity-nginx 커넥터 는 NGINX와 libmodsecurity(ModSecurity v3) 간의 연결 지점이다.
OWASP ModSecurity CRS(핵심 규칙 집합)는 ModSecurity 또는 호환 가능한 웹 응용 프로그램 방화벽과 함께 사용하기 위한 일반 공격 탐지 규칙 집합이다.

개방형 웹 애플리케이션 보안 프로젝트(OWASP)
OWASP ModSecurity 핵심 규칙 집합(CRS)은 자유롭게 액세스할 수 있는 "탐지 규칙" 모음이다. 즉, 들어오는 트래픽을 검사하는 데 사용할 수 있는 규칙이다 . 그런 다음 이러한 규칙을 Mod_Security와 같은 호환 가능한 웹 애플리케이션 방화벽과 함께 사용할 수 있다.
"Core Rule Set"은 "OWASP Top 10" 을 포함하여 알려진 광범위한 공격으로부터 웹 애플리케이션을 보호하기 위해 개발되었다 . 이것은 3년마다 재정의되는 웹 애플리케이션에서 가장 자주 발생하는 보안 위험 및 보안 격차의 상위 10개 목록이다. 핵심 규칙 세트에는 현재 다음 위험으로부터 웹 서비스를 보호하는 규칙이 포함되어 있다.
- SQL 주입(SQLi)
- 교차 사이트 스크립팅(XSS)
- 로컬 파일 포함(LFI)
- 원격 파일 포함(RFI)
- PHP 코드 삽입
- 자바 코드 주입 HTTPoxy
- Shellshock
- 유닉스/윈도우 Shell 인젝션
- 세션 고정
- 스크립팅/스캐너/봇 감지
- 메타데이터/오류 누출
설정
Kubernetes에서 NGINX Ingress Controller의 구성 맵을 편집하고 "mod_security"와 OWASP CRS(Open Web Application Security Project - Core Rule Set)를 활성화해야 한다.
# k edit cm -n ingress-nginx ingress-nginx-controller
...
#
apiVersion: v1
data:
allow-snippet-annotations: "true"
enable-modsecurity: "true"
enable-owasp-modsecurity-crs: "true"
kind: ConfigMap
...
ModSecurity가 활성화되지만, 수신 리소스에 대해서는 아직 작동하지 않는다. 이를 위해서는 Ingress 주석도 적용해야 한다.
kind: Ingress
metadata:
annotations:
# Configure ModSecurity
nginx.ingress.kubernetes.io/enable-modsecurity: "true"
nginx.ingress.kubernetes.io/enable-owasp-core-rules: "true"
nginx.ingress.kubernetes.io/modsecurity-transaction-id: "$request_id"
nginx.ingress.kubernetes.io/modsecurity-snippet: |
SecRuleEngine On
SecRequestBodyAccess On
...
스테이징 또는 테스트 환경에서 ModSecurity를 실행하고 이에 대해 테스트 세트를 실행하는 것이 좋다. ModSecurity가 활성화된 상태에서 응용 프로그램이 제대로 작동하려면 일부 규칙을 비활성화해야 할 수 있다.
modsecurity.conf 설정을 수정하려면
1) modsecurity.conf mount
kubectl exec -it $POD_NAME -n ingress-nginx -- cat /etc/nginx/modsecurity/modsecurity.conf > modsecurity.conf
내용을
kubectl create configmap modsecurity --from-file=modsecurity.conf=modsecurity.conf -n=ingress-nginx
configmap 으로 만든 후 볼륨 마운트 하도록 한다.
2) snippet
data:
modsecurity-snippet: |-
SecRuleEngine On
SecRequestBodyAccess On
SecRule ARGS|ARGS_NAMES "\.classLoader\." "log,\
deny,\
phase:2,\
id:76000001,\
severity:CRITICAL,\
msg:\'Possible Spring4Shell exploitation\'"
'Kubernetes > 보안' 카테고리의 다른 글
OWASP Kubernetes Top Ten (0) | 2022.12.22 |
---|---|
pod security admission (1) | 2022.08.31 |
KubeClarity (0) | 2022.08.25 |
Container/Kubernetes Compliance ( 컨테이너/쿠베네티스 규정 준수 ) (0) | 2022.06.17 |
Kubernetes scan 도구 - popeye (0) | 2022.05.15 |