-
Notifications
You must be signed in to change notification settings - Fork 4
[BE] 프로메테우스 도입 #183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] 프로메테우스 도입 #183
Changes from all commits
d407589
7982a47
8250ef1
34653d2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,10 +42,28 @@ services: | |
| max-size: '10m' | ||
| max-file: '3' | ||
|
|
||
| prometheus: | ||
| image: prom/prometheus:v3.1.0 | ||
| container_name: prometheus | ||
| volumes: | ||
| - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml | ||
| - prometheus_data:/prometheus | ||
| command: | ||
| - '--config.file=/etc/prometheus/prometheus.yml' | ||
| - '--storage.tsdb.path=/prometheus' | ||
| - '--web.console.libraries=/usr/share/prometheus/console_libraries' | ||
| - '--web.console.templates=/usr/share/prometheus/consoles' | ||
| ports: | ||
| - "9090:9090" | ||
| networks: | ||
| - monitoring-network | ||
| restart: unless-stopped | ||
|
Comment on lines
+45
to
+60
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result:
Sources: [1] [2] [3] 🌐 Web query:
💡 Result: Prometheus v2.45.0 — known CVE status1) CVEs in Prometheus server itself (upstream advisories)The Prometheus upstream repo currently lists two Prometheus-server security advisories with CVEs, but neither affects v2.45.0:
2) CVEs commonly flagged in Prometheus 2.45.0 builds/images (dependency / packaging findings)Even if Prometheus 2.45.0 isn’t directly vulnerable per upstream advisories, security scanners often report CVEs coming from bundled Go modules and/or container base images. For example, a Trivy scan report for Prometheus v2.45.0 shows CVE-2023-2253 (via Additionally, some downstream “prometheus-2.45” packages/images track multiple CVEs and advisories (package-specific), with fixed versions shown as newer package revisions (example: fixes in 3) Related (but separate) component CVE you may be seeingIf your environment also runs Alertmanager, note CVE-2023-40577 (XSS in Alertmanager; fixed in Alertmanager 0.25.1 per NVD). This is not a Prometheus-server CVE, but it often appears in monitoring stack scans. [5] What to do
Sources: [1] GitHub advisory GHSA-4v48-4q5m-8vx4 (CVE-2022-46146) • [2] GitHub advisory GHSA-vx57-7f4q-fpc7 (CVE-2021-29622) • [3] prometheus/prometheus issue Prometheus 버전을 v3.8.1(최신 안정 버전)로 업그레이드해야 합니다.
최신 안정 버전 🤖 Prompt for AI Agents |
||
|
|
||
| networks: | ||
| monitoring-network: | ||
| driver: bridge | ||
|
|
||
| volumes: | ||
| loki_data: | ||
| grafana_data: | ||
| prometheus_data: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| global: | ||
| scrape_interval: 15s | ||
|
|
||
| scrape_configs: | ||
| - job_name: 'backend-metrics' | ||
| static_configs: | ||
| - targets: ['192.168.0.7:8080'] # ticket-server, api-server instance | ||
|
|
||
| - job_name: 'queue-metrics' | ||
| static_configs: | ||
| - targets: ['192.168.0.8:8080'] # queue-server instance | ||
|
Comment on lines
+1
to
+11
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial 고정 IP 타겟은 운영 리스크가 큽니다. 호스트 IP 변경 시 스크랩이 바로 깨집니다. 운영 유연성을 위해 DNS 기반 타겟 또는 🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -56,6 +56,21 @@ services: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max-size: '10m' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| max-file: '3' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cadvisor: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| image: gcr.io/cadvisor/cadvisor:v0.47.2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| container_name: cadvisor-queue | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| restart: unless-stopped | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ports: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - '8080:8080' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| volumes: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /:/rootfs:ro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /var/run:/var/run:ro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /sys:/sys:ro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /var/lib/docker/:/var/lib/docker:ro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - /dev/disk/:/dev/disk:ro | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| networks: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| - queue-network | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+59
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Key point: cAdvisor’s built-in Web UI auth does not secure
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cadvisor: | |
| image: gcr.io/cadvisor/cadvisor:v0.47.2 | |
| container_name: cadvisor-queue | |
| restart: unless-stopped | |
| ports: | |
| - '8080:8080' | |
| volumes: | |
| - /:/rootfs:ro | |
| - /var/run:/var/run:ro | |
| - /sys:/sys:ro | |
| - /var/lib/docker/:/var/lib/docker:ro | |
| - /dev/disk/:/dev/disk:ro | |
| networks: | |
| - queue-network | |
| cadvisor: | |
| image: gcr.io/cadvisor/cadvisor:v0.47.2 | |
| container_name: cadvisor-queue | |
| restart: unless-stopped | |
| ports: | |
| - '127.0.0.1:8080:8080' | |
| volumes: | |
| - /:/rootfs:ro | |
| - /var/run:/var/run:ro | |
| - /sys:/sys:ro | |
| - /var/lib/docker/:/var/lib/docker:ro | |
| - /dev/disk/:/dev/disk:ro | |
| networks: | |
| - queue-network |
🤖 Prompt for AI Agents
In `@queue-backend/docker-compose.yml` around lines 59 - 72, The cadvisor service
exposes port 8080 publicly; restrict binding to localhost or a private interface
and/or remove public port mapping: update the cadvisor service (the cadvisor
block and its ports entry) to bind to 127.0.0.1 (e.g., change the ports mapping
from "8080:8080" to "127.0.0.1:8080:8080") or remove the ports section entirely
and instead set the CADVISOR_BIND_IP environment variable to a private IP to
limit exposure; ensure the cadvisor container remains on the internal
queue-network only if remote access is required via a secured bastion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: boostcampwm2025/web10-beastcamp
Length of output: 221
🏁 Script executed:
Repository: boostcampwm2025/web10-beastcamp
Length of output: 3166
🌐 Web query:
cAdvisor metrics endpoint security best practices authentication💡 Result:
cAdvisor
/metricsendpoint security & authentication best practicesDo not expose cAdvisor endpoints publicly (Internet-facing). cAdvisor commonly runs without authentication by default, which can leak sensitive host/container details. Enforce network-level restriction as the primary control (firewalls / security groups / private networks). [1]
Don’t rely on cAdvisor “Web UI auth” to protect
/metrics. Google explicitly notes that Web UI authentication protects only/containers, not other HTTP endpoints like/metricsand/api/...; therefore, treat/metricsas unauthenticated unless you add separate controls. [2]Put
/metricsbehind an authenticating reverse proxy (most common approach). Terminate TLS and enforce auth (mTLS, OIDC, Basic Auth, etc.) at a proxy (Nginx/Envoy/Traefik/oauth2-proxy), and only allow Prometheus/scrapers to reach it. This compensates for the limitation in (2). [2]If running cAdvisor directly, bind and expose it minimally.
0.0.0.0).Use certificate-based access controls where supported in your build. cAdvisor includes flags for certificate-based authentication via
--collector_cert/--collector_key(availability/behavior depends on build/version), but many teams still front it with a proxy for consistent authn/z. [3]Reduce sensitive data leakage in metrics.
--store_container_labels=false, then allowlist only what you need). This mitigates accidental leakage of secrets via env/labels. [4][5]Prefer Kubernetes-native secure scraping (recommended in clusters): scrape kubelet over the authenticated port.
/metrics/cadvisor. [6]10255(unauthenticated) and migrate to the secure, authenticated kubelet port10250. [8]Least privilege for scrapers. If using RBAC, grant only what Prometheus needs to read metrics endpoints (non-resource URL access such as
GET /metricsas appropriate for your setup). [6]Sources:
[1] Tenable – cAdvisor Unauthenticated Access (tenable.com)
[2] Trend Micro – Observability Exposed: Exploring Risks in Cloud-Native Metrics (cAdvisor Web UI auth does not protect
/metrics) (trendmicro.com)[3] Debian Manpages –
cadvisorflags including-collector_cert/-collector_key(hexmos.com)[4] Trend Micro – cAdvisor metrics can expose container labels; risk discussion (trendmicro.com)
[5] Debian Manpages –
-store_container_labels/ allowlisting labels behavior (manpages.debian.org)[6] Kubernetes docs – kubelet metrics endpoints including
/metrics/cadvisorand RBAC note (v1-34.docs.kubernetes.io)[7] Kubernetes docs – kubelet authentication/authorization (token webhook, authz modes) (kubernetes.io)
[8] Google Cloud – disable kubelet read-only port
10255; use secure10250(cloud.google.com)Citations:
🏁 Script executed:
Repository: boostcampwm2025/web10-beastcamp
Length of output: 102
🏁 Script executed:
Repository: boostcampwm2025/web10-beastcamp
Length of output: 111
🏁 Script executed:
Repository: boostcampwm2025/web10-beastcamp
Length of output: 1587
🏁 Script executed:
Repository: boostcampwm2025/web10-beastcamp
Length of output: 3342
cAdvisor 포트(8080) 외부 노출 보안 위험
메트릭 엔드포인트는 인증이 없어서 네트워크에 노출될 경우 보안 위험이 있습니다. 사설 인터페이스 바인딩 또는 방화벽 제한을 적용하세요.
🔒 권장 설정: IP 바인딩
운영 환경에서는
CADVISOR_BIND_IP를 사설 IP(예: 192.168.0.7)로 지정하세요.📝 Committable suggestion
🤖 Prompt for AI Agents