3주 차 Firewall 챌린지
I’m happy to translate the article for you, but I’ll need the text you’d like translated. Could you please paste the content (or the portion you want translated) here? I’ll keep the source line exactly as you provided and preserve all formatting, code blocks, URLs, and technical terms.
시나리오
당신은 보안 엔지니어입니다. 네트워크가 가동 중입니다. 방화벽을 구성하지 않으면 회사가 취약해집니다.
해결책 없음. 단계별 안내 없음. 요구사항과 규칙 집합 검증기만 제공합니다.
위협적으로 들리나요? 좋습니다. 바로 그게 목적입니다.
당신이 만들고 있는 것
📝 당신의 산출물: 파일(challenge4-ruleset.txt)에 저장된 완전한 iptables 규칙 집합
당신은 3‑구역 기업 방화벽을 구성하여 보호합니다:
- Internet ↔ Server Farm (웹, 메일, 데이터베이스, DNS 서버)
- Corporate LAN ↔ Server Farm (직원 접근)
- Corporate LAN ↔ Internet (브라우징, 업데이트)
18개의 구체적인 요구사항이 포함됩니다:
- ✅ 접근 제어 (누가 무엇에 접근할 수 있는가?)
- ✅ 보안 로깅 (속도 제한 포함)
- ✅ 스푸핑 방지 보호
- ✅ 상태 기반 연결 추적
- ✅ 네트워크 분할
당신이 만들어야 할 것
- iptables 명령이 포함된 bash 스크립트 (
challenge4-solution.sh) iptables-save로 저장된 규칙 파일 (challenge4-ruleset.txt)- 규칙 파일을 Claude/ChatGPT에 업로드하여 AI 채점 받기
Why This Challenge Is Different
Most firewall tutorials:
- Give you the commands
- Explain each line
- Hold your hand through setup
- Test nothing
This challenge:
- Gives you requirements, not commands
- You figure out the implementation
- Clear success criteria (pass/fail)
- Tests real‑world scenarios
It’s designed like a take‑home security interview.
왜 이 챌린지는 다를까
대부분의 방화벽 튜토리얼:
- 명령어를 제공한다
- 각 줄을 설명한다
- 설정 과정을 손잡아준다
- 테스트를 하지 않는다
이 챌린지:
- 명령어가 아닌 요구사항을 제공한다
- 구현을 스스로 찾아야 한다
- 명확한 성공 기준(통과/실패)
- 실제 시나리오를 테스트한다
집에서 수행하는 보안 인터뷰와 같은 형태로 설계되었습니다.
배울 내용
1. 상태 기반 방화벽
# Implement connection tracking
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
이 규칙이 먼저 적용되는 이유를 이해하는 것이 초보자와 전문가를 구분합니다.
2. 네트워크 분할
- 인터넷 → 웹/메일 서버만 접근 가능
- 직원 → 내부 포털에 접근 가능, 데이터베이스는 직접 접근 불가
- IT 관리자 → 모든 서버에 SSH 접근 가능
- 웹 서버 → 데이터베이스 접근 가능, 직원은 직접 DB에 접근할 수 없음
3. 보안 로깅 (디스크 손상 없이)
# Rate‑limited logging prevents log‑flooding attacks
iptables -A FORWARD -m limit --limit 5/min --limit-burst 10 -j LOG
언제 로그를 남기고, 언제 속도 제한을 적용해야 하는지, 그리고 두 가지가 왜 중요한지 배우게 됩니다.
4. 스푸핑 방지 보호
# Block packets claiming to be from your network but arriving on the wrong interface
iptables -A FORWARD -i eth1 ! -s 192.168.10.0/24 -j DROP
이는 IP 스푸핑 공격을 방어합니다.
도전 과제 구조
1부: 기본 설정
- 기본 정책 설정
- 상태 기반 연결 추적 구성
- 잘못된 패킷 차단
2부: 인터넷 ↔ 서버 팜
- 웹 서버에만 HTTP/HTTPS 허용
- 메일 서버에만 SMTP 허용
- 그 외 모든 트래픽 차단(로그 기록 포함)
3부: 기업 LAN ↔ 서버 팜
- 직원들은 웹 포털 및 이메일에 접근
- IT 관리자는 모든 서버에 SSH 접근 가능
- 웹 서버는 데이터베이스에 쿼리 가능
- 그 외 모든 접근 차단
4부: 기업 LAN ↔ 인터넷
- 직원들은 웹 탐색 및 DNS 사용
- 인터넷이 기업 LAN에 직접 접근할 수 없음
5부: 보안 강화
- 스푸핑 방지 규칙
- 연결 속도 제한
- 포괄적인 로그 기록
총계: 올바르게 구현해야 할 18개의 구체적인 요구사항.
얼마나 어려울까요?
- 초보자? 고생하게 될 겁니다(그게 목적입니다).
- 중급자? iptables 기본을 안다면 45–60 분 안에 끝낼 수 있습니다.
- 전문가? 증명해 보세요. 첫 시도부터 완벽히 해결하세요.
모두가 포트폴리오에 넣을 현실적인 기업 방화벽 규칙 집합을 얻게 됩니다.
도전 과제 워크플로우
1. Write iptables script → 2. Save ruleset file → 3. Upload to AI → 4. Get graded
(30‑60 min) (iptables‑save) (Claude) (Score/100)
↓
Fix & retry
until 95+/100
실제 iptables 규칙 파일을 만들어야 합니다 – 이는 읽기 연습이 아닙니다!
이 챌린지 수행 방법
⚠️ 중요
실제 iptables 규칙 파일을 만들어야 합니다. 요구사항만 읽어서는 안 됩니다!
The challenge has 7 clear steps:
단계 1: 챌린지 받기
git clone https://github.com/fosres/AppSec-Exercises.git
cd AppSec-Exercises/Week-3-Firewalls
cat Challenge_4_Corporate_Network_Firewall.md
단계 2: 모든 18개 요구사항 읽기
The challenge document includes:
- ✅ Network topology diagram (3 zones: Internet, Corporate LAN, Server Farm)
- ✅ 18 numbered requirements (what to allow/block)
- ✅ Clear specifications for rate limiting
- ✅ Clear specifications for logging
- ✅ Success‑criteria checklist
Read everything before writing a single command!
Note: A working solution exists here, but try it yourself first! You’ll learn much more from struggling than from copying.
단계 3: iptables 스크립트 작성
# Create your solution file
vim challenge4-solution.sh
Add the necessary iptables commands, make the script executable, and test it on a suitable Linux host.
단계 4: 규칙 집합 저장
sudo iptables-save > challenge4-ruleset.txt
단계 5: AI 채점용 업로드
Submit challenge4-ruleset.txt to Claude/ChatGPT (or the provided validator) and review the feedback.
단계 6: 반복
Fix any issues reported by the validator, re‑save the ruleset, and re‑upload until you achieve a passing score (≥ 95/100).
단계 7: 작업 문서화
Add comments to challenge4-solution.sh explaining each rule and why it satisfies the corresponding requirement. This will be valuable for future reference and for showcasing your solution in a portfolio.
I’m happy to help you flesh out the firewall script, but I’ll need the full list of the 18 specific requirements you’d like to implement. Could you please provide those requirements (or a brief description of each one)? Once I have that information, I can add the corresponding iptables rules to the script for you.
Step 4 – 스크립트 테스트 (선택 사항)
VM이나 실험 환경이 있는 경우:
# Make executable
chmod +x challenge4-solution.sh
# Run it
sudo ./challenge4-solution.sh
# Verify rules loaded
sudo iptables -L FORWARD -v -n
Tip: 실험 환경이 없으면 Step 5로 건너뛸 수 있습니다.
단계 5 – 규칙 집합을 파일에 저장
채점에 필수입니다.
스크립트를 실행한 경우
# Save the active iptables rules
sudo iptables-save > challenge4-ruleset.txt
실험실이 없는 경우
- 스크립트에서
iptables명령만 추출하여 규칙 집합 파일을 수동으로 생성합니다. sudo와echo라인을 제거하고iptables명령만 남깁니다.- 형식은
iptables-save출력과 일치해야 합니다.
예시 challenge4-ruleset.txt
# Generated by iptables-save v1.8.9
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -m conntrack --ctstate INVALID -j DROP
-A FORWARD ! -s 192.168.10.0/24 -i eth1 -j LOG --log-prefix "LAN-SPOOF: "
-A FORWARD ! -s 192.168.10.0/24 -i eth1 -j DROP
# ... rest of your rules ...
COMMIT
# Completed on [date]
이 파일이 채점 제출 파일입니다!
Source: …
6단계 – AI 기반 채점 받기
규칙 집합을 Claude 또는 ChatGPT에 업로드하여 즉시 피드백을 받으세요.
- 해당 AI 인터페이스로 이동합니다.
- 다음 프롬프트를 복사/붙여넣기 합니다:
I completed the Corporate Network Firewall Challenge (Challenge 4).
Please grade my iptables ruleset against all 18 requirements.
Challenge requirements:
[Paste the entire Challenge_4_Corporate_Network_Firewall.md file here]
My iptables ruleset:
[Paste your challenge4-ruleset.txt file here]
Please provide:
1. Score out of 100
2. Which requirements I passed/failed
3. Specific issues with my rules
4. Security problems or best‑practice violations
5. Suggestions for improvement
AI는 다음을 수행합니다:
- ✅ 18개 요구사항을 체계적으로 확인
- ✅ 규칙 순서가 올바른지 검증
- ✅ 보안 문제 식별
- ✅ 속도 제한 및 로깅이 올바르게 적용됐는지 확인
- ✅ 상세 점수 분해와 개선 제안 제공
예시 채점 결과
Score: 85/100
✅ Requirement 1: ESTABLISHED connections (PASS)
✅ Requirement 2: INVALID drop (PASS)
❌ Requirement 4: Missing rate limiting on LOG rule (FAIL)
⚠️ Requirement 7: Using entire subnet instead of specific IP (SECURITY ISSUE)
...
Issues found:
1. LOG rule missing -m limit (will flood logs during attack)
2. -d 192.168.20.0/24 too broad (should be 192.168.20.10)
Your score: 85/100 – Fix these issues for 100/100!
Step 7 – 완벽해질 때까지 반복
점수가 95/100 이하인 경우:
- AI의 피드백을 주의 깊게 읽으세요.
- 식별된 구체적인 문제를 수정하세요.
- 스크립트를 업데이트하세요.
- 새로운 규칙 집합을 저장하세요:
sudo iptables-save > challenge4-ruleset.txt - 채점에 다시 제출하세요.
점수 95‑100/100을 달성할 때까지 반복하세요 — 그때 비로소 마스터했음을 알 수 있습니다.
왜 레포를 별표해야 할까요 ⭐
이것은 단순한 블로그 글이 아니라 전체 실습 커리큘럼입니다.
레포에는 다음이 포함됩니다:
- ✅ Challenge 1: 기본 Linux 방화벽 (초급)
- ✅ Challenge 2: 다중 인터페이스 DMZ 설정 (중급)
- ✅ Challenge 3: PCI‑DSS 준수 방화벽 (고급)
- ✅ Challenge 4: 기업 네트워크 (이것!)
- 🔜 추가 챌린지 예정: VPN 통합, 클라우드 방화벽, 쿠버네티스 네트워크 정책
별표의 장점:
- ✅ 나중에 북마크
- ✅ 오픈소스 보안 교육 지원
- ✅ 새로운 챌린지 알림 받기
- ✅ 감사 표시 (무료!)
일반적인 실수 (시도하기 전까지는 보지 마세요!)
⚠️ 진지하게, 이 내용을 읽기 전에 먼저 챌린지를 시도하세요!
실수 1: ESTABLISHED 연결을 놓침
# Wrong: Each direction needs explicit rules
# Right: One ESTABLISHED rule handles return traffic
-A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
실수 2: 규칙 순서 오류
# Wrong: DROP before ALLOW
-A FORWARD -i eth0 -o eth1 -j DROP # 모든 트래픽 차단!
-A FORWARD -i eth0 -o eth1 -p tcp --dport 443 -j ACCEPT # 도달하지 않음
# Right: ALLOW before DROP
-A FORWARD -i eth0 -o eth1 -p tcp --dport 443 -j ACCEPT
-A FORWARD -i eth0 -o eth1 -j DROP
실수 3: LOG 규칙에 레이트 제한을 두지 않음
# Wrong: Attackers can flood your logs
-A FORWARD -j LOG
# Right: Rate‑limited logging
-A FORWARD -m limit --limit 5/min --limit-burst 10 -j LOG
실수 4: 목적지 IP 범위를 너무 넓게 지정
# Wrong: Allows access to entire server network
-A FORWARD -d 192.168.20.0/24 -p tcp --dport 3306 -j ACCEPT
# Right: Only specific database server
-A FORWARD -d 192.168.20.30 -p tcp --dport 3306 -j ACCEPT
⚠️ WARNING: 해결책을 보기 전에 먼저 스스로 챌린지를 시도해 보세요.
직접 고민하면서 풀면 복사해서 푸는 것보다 10배 이상 더 많이 배울 수 있습니다.
작업용 솔루션 (참고용)
👉 View solution (100/100 score)
Remember: multiple valid approaches exist. The linked solution is one way to score 100/100; your own solution may differ and be equally valid.
완료 후…
습득하게 될 기술
- 처음부터 엔터프라이즈 수준 방화벽을 구성합니다.
- 상태 기반 필터링과 무상태 필터링의 차이를 설명합니다.
- 다중 영역 네트워크 아키텍처를 설계합니다.
- 시스템에 영향을 주지 않으면서 보안 로그를 구현합니다.
- 보안 인터뷰에서 방화벽 관련 질문을 완벽히 답합니다.
이력서 항목
“엔터프라이즈 수준 기업 방화벽을 3구역 분할, 상태 기반 필터링, 스푸핑 방지 보호 및 포괄적인 보안 로깅과 함께 구성했습니다.”
포트폴리오 팁
- GitHub 솔루션 링크(공유하는 경우).
- 인터뷰 시 언급: “네트워크 분할, 속도 제한 로깅, 스푸핑 방지 등을 포함한 18가지 실제 요구사항을 테스트하는 기업 방화벽 챌린지를 완료했습니다.”
The Community
After completing the challenge
- Compare with my solution (optional) – see the 100/100 ruleset, learn alternative approaches.
- Share your solution (optional) – create a GitHub Gist, write a blog post, help others in the discussion.
- Give feedback – Was anything unclear? Should requirements be more/less detailed? What other challenges would you like?
- Star the repo ⭐ – support the project, get notified of new challenges, help others discover it.
준비됐나요? 당신의 미션 🎯
- ⭐ 레포지토리 별표 달기 (요구사항을 얻기 위해).
- 📖 모든 18개의 요구사항을 꼼꼼히 읽으세요.
- 💻 iptables 스크립트 작성 (18개 요구사항을 규칙으로).
- 💾 규칙 집합을
challenge4-ruleset.txt로iptables-save사용해 저장하세요. - 🤖 Claude/ChatGPT에 업로드하여 즉시 AI 채점받기.
- 🔁 문제를 수정하고 다시 제출하여 95 +/100 점을 달성할 때까지 반복하세요.