구성
이 섹션에서는 사용자가 DoveRunner Mobile App Security 온프레미스 버전을 사용자 정의할 수 있는 방법을 보여줍니다. Logstash 구성, Helm 파일 구성이 소개됩니다.
Logstash 구성 변경
Section titled “Logstash 구성 변경”기본 Logstash 설정
Section titled “기본 Logstash 설정”Logstash는 로그 데이터를 수집, 변환, 전송하는 핵심 구성 요소입니다.
기본 구성 파일
Section titled “기본 구성 파일”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 }}
사용자 정의 Logstash 구성
Section titled “사용자 정의 Logstash 구성”ConfigMap을 통한 구성 관리
Section titled “ConfigMap을 통한 구성 관리”apiVersion: v1kind: ConfigMapmetadata: name: logstash-config namespace: doverunnerdata: 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}" } } } }
도메인 구성
Section titled “도메인 구성”DNS 설정
Section titled “DNS 설정”필수 DNS 레코드
Section titled “필수 DNS 레코드”; 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.
Kubernetes Ingress 구성
Section titled “Kubernetes Ingress 구성”apiVersion: networking.k8s.io/v1kind: Ingressmetadata: 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
HTTPS 지원
Section titled “HTTPS 지원”Let’s Encrypt 자동 인증서
Section titled “Let’s Encrypt 자동 인증서”Cert-Manager 설치
Section titled “Cert-Manager 설치”# 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/v1kind: ClusterIssuermetadata: name: letsencrypt-prodspec: acme: server: https://acme-v02.api.letsencrypt.org/directory email: admin@yourdomain.com privateKeySecretRef: name: letsencrypt-prod-key solvers: - http01: ingress: class: nginxEOF
자체 서명 인증서
Section titled “자체 서명 인증서”인증서 생성
Section titled “인증서 생성”# 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
데이터베이스 구성
Section titled “데이터베이스 구성”MySQL 고급 설정
Section titled “MySQL 고급 설정”사용자 정의 my.cnf
Section titled “사용자 정의 my.cnf”[mysqld]# 기본 설정port = 3306bind-address = 0.0.0.0
# 성능 최적화innodb_buffer_pool_size = 8Ginnodb_log_file_size = 1Ginnodb_flush_log_at_trx_commit = 2query_cache_size = 256Mquery_cache_type = 1
# 연결 설정max_connections = 1000max_user_connections = 500thread_cache_size = 50
# 로그 설정general_log = 1general_log_file = /var/log/mysql/general.logslow_query_log = 1slow_query_log_file = /var/log/mysql/slow-query.loglong_query_time = 2
# 보안 설정ssl-ca = /etc/mysql/ssl/ca.pemssl-cert = /etc/mysql/ssl/server-cert.pemssl-key = /etc/mysql/ssl/server-key.pemrequire_secure_transport = ON
# 백업 설정binlog_format = ROWlog-bin = /var/log/mysql/mysql-bin.logbinlog_expire_logs_seconds = 604800 # 7일
ConfigMap으로 구성 적용
Section titled “ConfigMap으로 구성 적용”apiVersion: v1kind: ConfigMapmetadata: name: mysql-config namespace: doverunnerdata: my.cnf: | [mysqld] # 위의 설정 내용 복사
모니터링 구성
Section titled “모니터링 구성”Prometheus 설정
Section titled “Prometheus 설정”ServiceMonitor 구성
Section titled “ServiceMonitor 구성”apiVersion: monitoring.coreos.com/v1kind: ServiceMonitormetadata: name: doverunner-metrics namespace: doverunnerspec: selector: matchLabels: app: doverunner endpoints: - port: metrics interval: 30s path: /metrics
Grafana 대시보드
Section titled “Grafana 대시보드”{ "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" } ] } ] }}
환경별 구성
Section titled “환경별 구성”global: environment: development debug: true
resources: limits: cpu: "1" memory: "2Gi" requests: cpu: "0.5" memory: "1Gi"
replicas: 1
persistence: enabled: false
프로덕션 환경
Section titled “프로덕션 환경”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"
JVM 최적화
Section titled “JVM 최적화”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"
네트워크 최적화
Section titled “네트워크 최적화”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 온프레미스 솔루션을 요구사항에 맞게 최적화할 수 있습니다.