netbis CF firewall bouncer 재구축 (origin filter) + VL acquisition 통합 + sigmatch v2.4
- crowdsec-safeline.md: VL → CrowdSec acquisition 3개(apisix/traefik/npm) → 1개 통합 (victorialogs-nginx.yaml, query OR 결합). Netbis NPM CrowdSec 연동 활성. netbis-cf-firewall 재구축 섹션 추가. - services/netbis.md: bouncer 폐기 → 재구축 정정. firewall_bouncer_token 정보 갱신. Worker bouncer는 트래픽 비례 비용으로 재구축 안 함 명시. - history/2026-04-25-netbis-cf-firewall-rebuild.md: 오늘 작업 종합 (sigmatch v2.4 MP 제거, VL 통합, CrowdSec 연동, CF Firewall bouncer 재구축, origin filter로 10k 한도 회피). origin filter [crowdsec, cscli] 적용으로 2026-04-23 폐기 사유였던 CF IP List 10k 한도 회피. Worker bouncer는 origin filter로 회피 불가 (트래픽 비례 비용) 이라 재구축 안 함.
This commit is contained in:
90
history/2026-04-25-netbis-cf-firewall-rebuild.md
Normal file
90
history/2026-04-25-netbis-cf-firewall-rebuild.md
Normal file
@@ -0,0 +1,90 @@
|
||||
---
|
||||
title: Netbis CF Firewall Bouncer 재구축 + sigmatch v2.4 + VL acquisition 통합
|
||||
updated: 2026-04-25
|
||||
tags: [netbis, crowdsec, cloudflare, sigmatch, vector, history]
|
||||
---
|
||||
|
||||
## 배경
|
||||
|
||||
2026-04-23 [[2026-04-23-netbis-bouncer-removal|netbis bouncer 전량 폐기]] 이후 netbis CF 측엔 enforcement 컴포넌트가 비어 있었음. 그동안 [[../projects/netbis-sigmatch|netbis-sigmatch]]가 자체 detect + 자체 enforcement (CF Account-level IP Access Rules 직접 호출) 모델로 차단을 시도했으나, 다음 문제들로 LIVE 전환 보류:
|
||||
|
||||
1. **2026-04-24 webhook callback 오탐**: 베팅 프로바이더 webhook (`/vinus/cback?bet_<hash>`)이 path entropy 기반 scanner_shape에 매칭. 어제 fix 적용 (path normalize, query string 제거)
|
||||
2. **2026-04-25 attack_contributor 누적 오탐**: A4 Matrix Profile trigger의 1% false positive가 단순 volume top 차단 단계에서 증폭되어 18시간 동안 99 distinct IP 누적 차단 (webhook 4~5개 + KR 일반 유저 + IPv6 모바일 240/4 가짜 IP). LIVE였으면 베팅 콜백 중단 사고
|
||||
|
||||
이로 인해 sigmatch 자체 detect 모델 한계 확인 → CrowdSec 시나리오 기반 공식 도구로 enforcement 이전 결정.
|
||||
|
||||
## 변경 요약
|
||||
|
||||
### 1. sigmatch v2.4 — A4 Matrix Profile 트리거 제거
|
||||
|
||||
- `loop.py`에서 `compute_mp_trigger` 호출 제거. `mp_seg` 로그 포맷 제거. `--mp-*` argparse 옵션은 deprecated 표기로 호환만 유지
|
||||
- `matrix_profile.py` 모듈은 보존 (관찰/연구용 수동 호출 가능)
|
||||
- 활성 103건 sqlite 정리 후 재시작
|
||||
- 사유: MP self-similar 시계열 가정이 daily seasonality 트래픽과 안 맞고, 단일 시그널이 attack_contributor 단계의 단순 volume top 차단으로 증폭되는 위험 패턴
|
||||
|
||||
상세: [[../projects/netbis-sigmatch|projects/netbis-sigmatch.md]]
|
||||
|
||||
### 2. VL → CrowdSec acquisition 통합
|
||||
|
||||
기존 분리:
|
||||
- `victorialogs-apisix.yaml`
|
||||
- `victorialogs-traefik.yaml`
|
||||
|
||||
신규 통합 (단일 파일):
|
||||
- `/etc/crowdsec/acquis.d/victorialogs-nginx.yaml`
|
||||
- query: `(program:apisix AND log_type:access) OR program:traefik OR (program:npm AND log_type:access)`
|
||||
- labels: `type: nginx`
|
||||
- 이전 파일 3개는 `.bak`로 보존 (롤백 가능)
|
||||
|
||||
같은 VL endpoint에 같은 label, query만 OR 결합 가능했음. connection 1개 + 메트릭 단일 source.
|
||||
|
||||
### 3. Netbis NPM 로그 → CrowdSec 신규 연동
|
||||
|
||||
- 기존: NPM → Vector → zlambda → VL (수집만)
|
||||
- 신규: 위 통합 acquisition에 합류 → nginx-logs parser → 시나리오 → LAPI decision
|
||||
- nginx-logs parser는 NPM proxy format 호환 (cscli explain 결과 s01-parse 정상, 시나리오 매칭됨)
|
||||
|
||||
### 4. CF Firewall Rule Bouncer 재구축
|
||||
|
||||
| 항목 | 값 |
|
||||
|---|---|
|
||||
| 패키지 | `crowdsec-cloudflare-bouncer 0.3.0` (apt) |
|
||||
| 컨테이너 | jp1 incus `crowdsec` (LAPI 동거) |
|
||||
| LAPI bouncer 이름 | `cs-cloudflare-bouncer-1777082222` |
|
||||
| origin filter | `[crowdsec, cscli]` |
|
||||
| API token | Vault `secret/cloud/cloudflare-netbis.firewall_bouncer_token` (Bearer cfut_…). global_api_key는 사용 불가 (`6003 Invalid request headers`) |
|
||||
| Token 권한 | Account Firewall Access Rules Write, Account Rule Lists Write, 6 zone Firewall Services Write |
|
||||
| CF 리소스 | IP List `crowdsec_managed_challenge`(`f728ad9d…`) + 6 zone Firewall Rule (managed_challenge) |
|
||||
|
||||
### 5. 폐기 사유 회피 검증
|
||||
|
||||
2026-04-23 폐기 사유였던 **CF IP List 10k 한도**가 origin filter로 회피됨:
|
||||
|
||||
| origin | LAPI 24h 누적 | CF List 푸시 |
|
||||
|---|---|---|
|
||||
| CAPI (커뮤니티) | 30k+ | ❌ 제외 |
|
||||
| lists (tor 등) | 2,195 | ❌ 제외 |
|
||||
| crowdsec (로컬) | 30+ | ✅ 푸시 |
|
||||
| cscli (수동) | 0 | ✅ 푸시 |
|
||||
|
||||
→ CF IP List에 한도 (10k) 이내로만 push. 향후 로컬 시나리오 폭주에 대비 sigmatch처럼 max_rules 안전장치 검토 가치 있음.
|
||||
|
||||
Worker bouncer는 트래픽 비례 비용 ($14~50/월 추정)이라 origin filter로 회피 불가 → **재구축 안 함**.
|
||||
|
||||
## 영향 받은 정본
|
||||
|
||||
- [[../projects/netbis-sigmatch|projects/netbis-sigmatch.md]] — v2.4
|
||||
- [[../infra/security/crowdsec-safeline|infra/security/crowdsec-safeline.md]] — VL 통합 acquisition + netbis-cf-firewall 섹션
|
||||
- [[../services/netbis|services/netbis.md]] — bouncer 재구축 정정, API token 정보
|
||||
|
||||
## 미해결 / 다음 결정
|
||||
|
||||
- **sigmatch 역할 재정의**: 자체 detect + enforcement → CrowdSec이 이걸 담당하므로 sigmatch는 (a) 폐기, (b) 관측/대시보드 전용, (c) 분포 anomaly 보조 (CrowdSec 시나리오로 못 잡는 영역) 중 결정 필요
|
||||
- **분산 DDoS 시나리오 미설치**: `http-ddos-by-asn`, `http-ddos-by-country` 같은 AS/Country 단위 시나리오 미설치. 필요 시 추가
|
||||
- **bouncer rename**: `cs-cloudflare-bouncer-1777082222` → `netbis-cf-firewall` 같은 의미 있는 이름. cscli 또는 config 수정으로 가능
|
||||
|
||||
## 운영 검증 시점 (작업 직후)
|
||||
|
||||
- LAPI bouncer list: `cs-cloudflare-bouncer-1777082222` ✔️ valid
|
||||
- CF IP List `crowdsec_managed_challenge` count: 1 (origin filter 정상 — 30k+ CAPI 제외 확인)
|
||||
- 6 zone Firewall Rule 모두 `managed_challenge` 액션으로 생성됨
|
||||
Reference in New Issue
Block a user