Conversation
- docker-compose 서비스(prometheus, grafana) 설정 - metric 수집 endpoint에 대한 basic auth 설정
Owner
Author
📊 Test Coverage Report
|
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
⭐ Related issue
📌 Tasks
📢 To Reviewers
Actuator 정보를 그대로 노출시키면 보안적 이슈가 발생할 수 있어, metrix endpoint에 대해 Basic Auth 검증 적용
prometheus에서 metrix 수집 시 basic auth를 설정하기 위한 프로퍼티(username, password)를 숨기기 위해 envsubst를 활용하려 했지만, prom/prometheus 이미지는 Prometheus 실행에 필요한 핵심 바이너리만 포함된 매우 경량화된 형태로 envsubst 설치가 안됨
따라서 alpine 이미지를 통해 리눅스 환경에서 직접 prometheus와 envsubst를 설치하여 적용.
Bearer Auth 검증을 하는 기존 API에 대한 jwtFilterChain 앞에 Metrix API의 Basic Auth를 검증하기 위한 actuatorFilterChain 추가됨.
아래 코드처럼 http.securityMatcher() 깔끔하게 처리하면 좋겠지만, 기존 API의 /api/** 처럼 prefix가 존재하지 않기 떄문에 우선 metrix api도 jwtFilterChain을 타게 설정되어 있음.
대신 JwtAuthenticationFilter에서 metrix api endpoint를 검증. 여기서 if문으로 검증하지 않으면 jwt 추출 시도하여 에러 발생
추후 더 좋은 방법 생각나면 개선하는 걸로.
📃 Reference
micrometer 활용하면 api에 대한 시간 및 횟수 등을 metrix에 추가할 수 있음