IT Knowledge/Security/images/29-siem과-보안-운영-diagram.svg
SIEM과 보안 운영 (SIEM & Security Operations)
보안 정보 및 사건 관리 시스템(SIEM)과 보안 운영 센터(SOC)를 이해합니다.
📌 학습 목표
- SIEM 시스템 이해
- 로그 수집 및 분석
- 사건 탐지 및 대응
- SOC (Security Operations Center) 구조 이해
- 보안 자동화 기법 습득
1. SIEM 개요
정의
Security Information and Event Management - 보안 로그을 수집, 분석, 시각화하는 시스템입니다.
SIEM 구성 요소
┌─────────────────────────────────────────────────┐
│ SIEM 시스템 │
│ ┌──────────────────────────────────────┐ │
│ │ 데이터 수집 (Log Collection) │ │
│ │ - 시스템 로그 │ │
│ │ - 네트워크 로그 │ │
│ │ - 애플리케이션 로그 │ │
│ └──────────────┬───────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────┐ │
│ │ 정규화 (Normalization) │ │
│ │ - 로그 포맷 통일 │ │
│ │ - 타임스탬프 동기화 │ │
│ └──────────────┬───────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────┐ │
│ │ 분석 엔진 (Analysis Engine) │ │
│ │ - 시그니처 기반 탐지 │ │
│ │ - 이상 탐지 │ │
│ │ - 상관 분석 │ │
│ └──────────────┬───────────────────┘ │
│ ↓ │
│ ┌──────────────────────────────────────┐ │
│ │ 알림 및 보고 (Alerting) │ │
│ │ - 이메일 알림 │ │
│ │ - SMS 알림 │ │
│ │ - 대시보드 │ │
│ └──────────────────────────────────────┘ │
└─────────────────────────────────────────────────┘
SIEM 유형
| 유형 | 설명 | 예시 |
|---|---|---|
| On-Premise | 사설 서버에 설치 | Splunk Enterprise, QRadar |
| Cloud | 클라우드 기반 | AWS Security Hub, Azure Sentinel |
| Hybrid | 온프레미스 + 클라우드 | QRadar Cloud |
2. 주요 SIEM 솔루션
ELK Stack (Elasticsearch, Logstash, Kibana)
구성
┌──────────────────────────────────────────────┐
│ ELK Stack │
├──────────────────────────────────────────────┤
│ Beats (데이터 수집) │
│ - Filebeat: 파일 로그 │
│ - Metricbeat: 메트릭 │
│ - Packetbeat: 네트워크 패킷 │
├──────────────────────────────────────────────┤
│ Logstash (데이터 파이프라인) │
│ - 필터링 │
│ - 변환 │
│ - 라우팅 │
├──────────────────────────────────────────────┤
│ Elasticsearch (데이터 저장 및 검색) │
│ - 역색 │
│ - 분석 │
├──────────────────────────────────────────────┤
│ Kibana (시각화 및 대시보드) │
│ - 차트 │
│ - 그래프 │
│ - 대시보드 │
└──────────────────────────────────────────────┘
Filebeat 구성
# /etc/filebeat/filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- /var/log/*.log
fields:
event_type: system_log
output.elasticsearch:
hosts: ["localhost:9200"]
index: "filebeat-%{[agent.version]}-%{+yyyy.MM.dd}"
setup.kibana:
host: "localhost:5601"Logstash 구성
# /etc/logstash/conf.d/syslog.conf
input {
file {
path => "/var/log/syslog"
type => "syslog"
}
}
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{SYSLOGBASE} %{GREEDYDATA:syslog_message}" }
}
}
}
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "syslog-%{+YYYY.MM.dd}"
}
}Splunk
특징
- 강력한 검색 및 분석
- Splunk Processing Language (SPL)
- 다양한 애드온
SPL 예시
# 로그 검색
index=security sourcetype=linux_auth | stats count by user
# 실패한 로그인 탐지
index=security eventtype=failed_login | stats count by src_ip, user
# 시간 기반 분석
index=security | timechart span=1h count by event_type
# 상관 분석
index=security (eventtype=failed_login OR eventtype=successful_login)
| stats count by src_ip, user
| where count > 10Wazuh (오픈소스 SIEM)
Wazuh Agent 구성
<!-- /var/ossec/etc/ossec.conf -->
<ossec_config>
<client>
<server>
<address>wazuh-server-ip</address>
<port>1514</port>
<protocol>tcp</protocol>
</server>
</client>
<syscheck>
<frequency>3600</frequency>
<scan_on_start>yes</scan_on_start>
<directories check_all="yes">/etc,/usr/bin</directories>
</syscheck>
</ossec_config>Wazuh Server 구성
<!-- /var/ossec/etc/ossec.conf -->
<ossec_config>
<global>
<email_notification>yes</email_notification>
<email_to>admin@example.com</email_to>
<smtp_server>smtp.example.com</smtp_server>
</global>
<ruleset>
<rules_dir>rules</rules_dir>
<decoders_dir>decoders</decoders_dir>
</ruleset>
</ossec_config>3. 로그 수집 및 정규화
로그 소스
| 소스 | 로그 유형 | 위치 |
|---|---|---|
| 시스템 | /var/log/auth.log, /var/log/syslog | Linux |
| 네트워크 | 방화벽, 라우터, 스위치 | 네트워크 장치 |
| 애플리케이션 | Apache, Nginx, App 로그 | 웹 서버 |
| 데이터베이스 | MySQL, PostgreSQL 로그 | DB 서버 |
정규화 예시
# 로그 파싱
import re
# Apache 로그
apache_log = '192.168.1.1 - - [01/Oct/2024:00:00:00 +0000] "GET /index.html HTTP/1.1" 200 1234'
pattern = r'(?P<ip>\d+\.\d+\.\d+\.\d+) - - \[(?P<timestamp>[^\]]+)\] "(?P<method>\w+) (?P<path>\S+) (?P<protocol>\S+)" (?P<status>\d+) (?P<size>\d+)'
match = re.match(pattern, apache_log)
if match:
log_data = match.groupdict()
print(log_data)
# {'ip': '192.168.1.1', 'timestamp': '01/Oct/2024:00:00:00 +0000', 'method': 'GET', 'path': '/index.html', 'protocol': 'HTTP/1.1', 'status': '200', 'size': '1234'}4. 사건 탐지
규칙 기반 탐지
예시: 실패한 로그인 탐지
# Wazuh 규칙
<rule id="5501" level="5">
<if_sid>5500</if_sid>
<match>failed login</match>
<description>Failed login attempt detected</description>
</rule>예시: SQL 인젝션 탐지
<rule id="5502" level="10">
<field name="url">.*union.*select.*</field>
<field name="method">POST</field>
<description>Possible SQL injection attempt</description>
</rule>이상 탐지
통계 기반 이상 탐지
# Python 예시
import numpy as np
from sklearn.ensemble import IsolationForest
# 로그 데이터
log_data = np.array([[100], [105], [102], [5000], [101], [103]])
# 이상 탐지 모델
model = IsolationForest(contamination=0.1)
model.fit(log_data)
# 예측
predictions = model.predict(log_data)
anomalies = log_data[predictions == -1]
print("Anomalies:", anomalies)머신러닝 기반 탐지
# 예시: 랜덤 포레스트
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
# 데이터 준비
X = [...] # 로그 특징
y = [...] # 정상(0)/이상(1)
# 모델 훈련
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
model = RandomForestClassifier(n_estimators=100)
model.fit(X_train, y_test)
# 예측
predictions = model.predict(X_test)5. SOC (Security Operations Center)
SOC 구조
┌─────────────────────────────────────────────────┐
│ SOC 구조 │
├───────────────────────────────────────────────┤
│ Tier 1: 탐지 및 분석 │
│ - 알림 모니터링 │
│ - 기본 분석 │
│ - 위선순위 결정 │
├───────────────────────────────────────────────┤
│ Tier 2: 조사 및 대응 │
│ - 심층 분석 │
│ - 대응 절차 수행 │
│ - 위협 완화 │
├───────────────────────────────────────────────┤
│ Tier 3: 위협 헌팅 및 취약점 분석 │
│ - 고급 분석 │
│ - 위협 인텔리전스 │
│ - 보안 전략 수립 │
├───────────────────────────────────────────────┤
│ SOC 관리자 │
│ - 팀 관리 │
│ - 전략 계획 │
│ - 보안 거버넌스 │
└──────────────────────────────────────────────┘
역할 및 책임
| 역할 | 책임 | 예시 |
|---|---|---|
| SOC Analyst L1 | 알림 모니터링, 기본 분석 | 로그 분석, 탐지 |
| SOC Analyst L2 | 조사 및 대응, 위협 완화 | 사건 조사, 대응 |
| SOC Analyst L3 | 위협 헌팅, 취약점 분석 | 악성코드 분석 |
| SOC Manager | 팀 관리, 전략 계획 | 리소스 할당, 거버넌스 |
6. 보안 자동화
SOAR (Security Orchestration, Automation and Response)
자동화 플레이북 예시
# Splunk SOAR 플레이북
- name: Block Malicious IP
trigger:
conditions:
- event.severity == "high"
- event.type == "malicious_ip"
actions:
- name: Block IP in Firewall
action: firewall.block
parameters:
ip: event.ip
duration: "24h"
- name: Send Email Notification
action: email.send
parameters:
to: security@example.com
subject: "Malicious IP Blocked: {{ event.ip }}"
body: "IP {{ event.ip }} was blocked due to malicious activity."
- name: Update Incident
action: incident.update
parameters:
incident_id: event.incident_id
status: "in_progress"
notes: "IP {{ event.ip }} blocked in firewall"자동화 도구
| 도구 | 설명 | 사용 사례 |
|---|---|---|
| Splunk SOAR | Splunk 통합 자동화 플랫폼 | 이벤트 대응 자동화 |
| Cortex XSOAR | Palo Alto 자동화 플랫폼 | 위협 대응 자동화 |
| Shuffle | 오픈소스 SOAR 플랫폼 | 워크플로 자동화 |
| The Hive | 오픈소스 보안 대응 플랫폼 | 사건 관리 자동화 |
7. 보안 모니터링 대시보드
Kibana 대시보드
{
"title": "Security Overview",
"panels": [
{
"title": "Event Types",
"type": "pie",
"query": "index=security | stats count by event_type"
},
{
"title": "Failed Logins",
"type": "line",
"query": "index=security eventtype=failed_login | timechart count"
},
{
"title": "Top Source IPs",
"type": "table",
"query": "index=security | stats count by src_ip | sort -count | head 10"
}
]
}Grafana 대시보드
{
"dashboard": {
"title": "Security Monitoring",
"panels": [
{
"title": "Events by Type",
"type": "stat",
"targets": [
{
"expr": "sum(security_events_total) by (event_type)"
}
]
},
{
"title": "Failed Login Rate",
"type": "graph",
"targets": [
{
"expr": "rate(security_events_failed_login_total[5m])"
}
]
}
]
}
}🎯 실습 과제
1. ELK Stack 구성
# Elasticsearch 설치
sudo apt-get install elasticsearch
# Kibana 설치
sudo apt-get install kibana
# Filebeat 설치
sudo apt-get install filebeat
# 로그 전송
sudo filebeat setup -e -k <kibana-token>
sudo service filebeat start2. Wazuh SIEM 구성
# Wazuh Server 설치
curl -so wazuh-install.sh https://packages.wazuh.com/4.7/wazuh-install.sh
sudo bash wazuh-install.sh a
# Wazuh Agent 설치 (클라이언트)
curl -so wazuh-agent.deb https://packages.wazuh.com/4.7/wazuh-agent.deb
sudo dpkg -i wazuh-agent.deb
# Wazuh Manager 등록
sudo /var/ossec/bin/agent-auth -m wazuh-server-ip
# Wazuh Agent 시작
sudo service wazuh-agent start3. 탐지 규칙 생성
# Wazuh 규칙 파일
<group name="rules_demo">
<rule id="100001" level="5">
<if_sid>5710</if_sid>
<match>sshd:|Failed password</match>
<description>SSH brute force attack detected</description>
</rule>
</group>✅ 학습 체크리스트
- SIEM 시스템 이해
- ELK Stack 구성 능력
- 로그 수집 및 정규화 이해
- 사건 탐지 규칙 작성 능력
- SOC 구조 이해
- 보안 자동화(SOAR) 이해
- 대시보드 구성 능력
🔗 관련 노트
📚 참고 자료
다음 학습: 취약점 관리 및 패치