콘텐츠로 이동

구성

이 섹션에서는 사용자가 DoveRunner Mobile App Security 온프레미스 버전을 사용자 정의할 수 있는 방법을 보여줍니다. Logstash 구성, Helm 파일 구성이 소개됩니다.

Logstash는 로그 데이터를 수집, 변환, 전송하는 핵심 구성 요소입니다.

/etc/logstash/conf.d/doverunner.conf
input {
beats {
port => 5044
}
http {
port => 8080
codec => json
}
}
filter {
if [fields][log_type] == "security" {
mutate {
add_field => { "[@metadata][target_index]" => "security-logs" }
}
}
if [fields][log_type] == "audit" {
mutate {
add_field => { "[@metadata][target_index]" => "audit-logs" }
}
}
# 타임스탬프 파싱
date {
match => [ "timestamp", "ISO8601" ]
}
# IP 주소 지리적 위치 확인
geoip {
source => "client_ip"
target => "geoip"
}
}
output {
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "%{[@metadata][target_index]}-%{+YYYY.MM.dd}"
}
# 디버깅용 stdout 출력 (프로덕션에서는 제거)
stdout {
codec => rubydebug
}
}
apiVersion: v1
kind: ConfigMap
metadata:
name: logstash-config
namespace: doverunner
data:
logstash.yml: |
http.host: "0.0.0.0"
path.config: /usr/share/logstash/pipeline
pipeline.workers: 4
pipeline.batch.size: 125
pipeline.batch.delay: 50
queue.type: persisted
queue.max_events: 10000
dead_letter_queue.enable: true
pipelines.yml: |
- pipeline.id: security-logs
path.config: "/usr/share/logstash/pipeline/security.conf"
pipeline.workers: 2
- pipeline.id: audit-logs
path.config: "/usr/share/logstash/pipeline/audit.conf"
pipeline.workers: 1
security.conf: |
input {
beats {
port => 5044
type => "security"
}
}
filter {
# 보안 로그 특화 필터
if [message] =~ /THREAT_DETECTED/ {
mutate {
add_tag => ["high_priority"]
add_field => { "alert_level" => "critical" }
}
}
# JSON 파싱
json {
source => "message"
target => "parsed"
}
# 필드 정규화
mutate {
rename => { "[parsed][device_id]" => "device_id" }
rename => { "[parsed][threat_type]" => "threat_type" }
rename => { "[parsed][app_package]" => "app_package" }
}
}
output {
elasticsearch {
hosts => ["${ELASTICSEARCH_HOSTS}"]
index => "security-logs-%{+YYYY.MM.dd}"
template_name => "security-logs"
template_pattern => "security-logs-*"
template => "/usr/share/logstash/templates/security-template.json"
}
# 중요 알림은 별도 처리
if "high_priority" in [tags] {
http {
url => "${ALERT_WEBHOOK_URL}"
http_method => "post"
content_type => "application/json"
mapping => {
"alert_type" => "security_threat"
"device_id" => "%{device_id}"
"threat_type" => "%{threat_type}"
"timestamp" => "%{@timestamp}"
}
}
}
}
; A 레코드
console.yourdomain.com. IN A <LOAD_BALANCER_IP>
api.yourdomain.com. IN A <LOAD_BALANCER_IP>
admin.yourdomain.com. IN A <LOAD_BALANCER_IP>
; CNAME 레코드 (선택사항)
www.yourdomain.com. IN CNAME console.yourdomain.com.
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: doverunner-ingress
namespace: doverunner
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
cert-manager.io/cluster-issuer: "letsencrypt-prod"
nginx.ingress.kubernetes.io/proxy-body-size: "100m"
spec:
tls:
- hosts:
- console.yourdomain.com
- api.yourdomain.com
secretName: doverunner-tls
rules:
- host: console.yourdomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: doverunner-adc
port:
number: 80
- host: api.yourdomain.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: doverunner-api
port:
number: 80
Terminal window
# Cert-Manager 설치
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml
# ClusterIssuer 생성
cat <<EOF | kubectl apply -f -
apiVersion: cert-manager.io/v1
kind: ClusterIssuer
metadata:
name: letsencrypt-prod
spec:
acme:
server: https://acme-v02.api.letsencrypt.org/directory
email: admin@yourdomain.com
privateKeySecretRef:
name: letsencrypt-prod-key
solvers:
- http01:
ingress:
class: nginx
EOF
Terminal window
# 1. 개인키 생성
openssl genrsa -out private.key 4096
# 2. 인증서 서명 요청 생성
openssl req -new -key private.key -out certificate.csr \
-subj "/C=KR/ST=Seoul/L=Seoul/O=YourCompany/CN=*.yourdomain.com"
# 3. 자체 서명 인증서 생성
openssl x509 -req -days 365 -in certificate.csr \
-signkey private.key -out certificate.crt \
-extensions v3_ca -extfile <(echo -e "[v3_ca]\nsubjectAltName=DNS:*.yourdomain.com,DNS:yourdomain.com")
# 4. Kubernetes Secret으로 저장
kubectl create secret tls doverunner-tls \
--cert=certificate.crt \
--key=private.key \
--namespace=doverunner
[mysqld]
# 기본 설정
port = 3306
bind-address = 0.0.0.0
# 성능 최적화
innodb_buffer_pool_size = 8G
innodb_log_file_size = 1G
innodb_flush_log_at_trx_commit = 2
query_cache_size = 256M
query_cache_type = 1
# 연결 설정
max_connections = 1000
max_user_connections = 500
thread_cache_size = 50
# 로그 설정
general_log = 1
general_log_file = /var/log/mysql/general.log
slow_query_log = 1
slow_query_log_file = /var/log/mysql/slow-query.log
long_query_time = 2
# 보안 설정
ssl-ca = /etc/mysql/ssl/ca.pem
ssl-cert = /etc/mysql/ssl/server-cert.pem
ssl-key = /etc/mysql/ssl/server-key.pem
require_secure_transport = ON
# 백업 설정
binlog_format = ROW
log-bin = /var/log/mysql/mysql-bin.log
binlog_expire_logs_seconds = 604800 # 7일
apiVersion: v1
kind: ConfigMap
metadata:
name: mysql-config
namespace: doverunner
data:
my.cnf: |
[mysqld]
# 위의 설정 내용 복사
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: doverunner-metrics
namespace: doverunner
spec:
selector:
matchLabels:
app: doverunner
endpoints:
- port: metrics
interval: 30s
path: /metrics
{
"dashboard": {
"title": "DoveRunner Mobile App Security Metrics",
"panels": [
{
"title": "API Requests per Second",
"type": "graph",
"targets": [
{
"expr": "rate(http_requests_total[5m])"
}
]
},
{
"title": "Sealing Jobs",
"type": "stat",
"targets": [
{
"expr": "doverunner_sealing_jobs_total"
}
]
}
]
}
}
values-dev.yaml
global:
environment: development
debug: true
resources:
limits:
cpu: "1"
memory: "2Gi"
requests:
cpu: "0.5"
memory: "1Gi"
replicas: 1
persistence:
enabled: false
values-prod.yaml
global:
environment: production
debug: false
resources:
limits:
cpu: "4"
memory: "8Gi"
requests:
cpu: "2"
memory: "4Gi"
replicas: 3
persistence:
enabled: true
size: "100Gi"
storageClass: "fast-ssd"
backup:
enabled: true
schedule: "0 2 * * *" # 매일 오전 2시
retention: "30d"
env:
- name: JAVA_OPTS
value: "-Xms4g -Xmx8g -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+UseStringDeduplication"
- name: SERVER_TOMCAT_MAX_THREADS
value: "200"
- name: SERVER_TOMCAT_MIN_SPARE_THREADS
value: "20"
spec:
template:
spec:
containers:
- name: doverunner-api
ports:
- containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 30
periodSeconds: 10
livenessProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 60
periodSeconds: 30

이러한 구성을 통해 DoveRunner Mobile App Security 온프레미스 솔루션을 요구사항에 맞게 최적화할 수 있습니다.