Fix: SSL 만료로 보이던 문제 원인 분석 및 구조 개선 #175
Merged
Merged
Conversation
2ternal
approved these changes
Feb 2, 2026
Collaborator
2ternal
left a comment
There was a problem hiding this comment.
신경 못쓰고 있었는데...
부지런하시네요 수고하셨습니다!!
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.
🛰️ Issue Number
🪐 작업 내용
기존에 certbot_renew 컨테이너에서 인증서 갱신 후 nginx한테 HUP 시그널 보내려고 Docker API를 wget으로 호출하고 있었는데, certbot 이미지에 들어있는 wget이 BusyBox 버전이라 --method=POST, --unix-socket 옵션을 지원 안 해서 nginx reload가 계속 실패하고 있었습니다.
그래서 certbot 입장에서는 인증서 갱신이 잘 됐다고 나오는데, nginx는 갱신된 인증서를 reload 못해서 실제로는 SSL 만료처럼 보여 서비스가 빠그라져있었스빈다.
변경 내용
wget 대신 curl 쓰도록 바꿔서 nginx reload가 제대로 되게 했습니다.
아마curl 적용하면서 보니까 stg는 8080 포트만 열려있어서 certbot webroot 방식(80포트 필요)으로 인증서 발급/갱신이 안 된다고 하더라구요 그때는 어케했는지 모르겠지만 그래서 dns-01 방식도 고려해봤는데 저희 도메인이 내도메인.한국이라는 밤티 도메인이라 설정 복잡해지는 것 대비 이득이 별로 없어서 그냥 구조를 좀 바꿨습니다:
stg에서 인증서 발급/갱신 관련 컨테이너 제거
dev 환경에서만 인증서 발급/갱신 관리
stg nginx는 그 인증서 디렉토리 마운트해서 쓰기 👍
여러분들은 이걸 포트폴리오에 넣는지는 모르겠지만 저는 넣습니다. 그래서 인사담당관이 서비스 링크까지 들어왔는데 안되면 나가리잖아요? 그래서
실제 서빙되는 인증서 기준으로 만료 임박상황 및 서버 접속 불가 상황 생기면 Slack 알림 가게 해봤습니다.
인증서 체크(cron 하루 1회), 서버 접속 체크(cron 6시간 마다)
이제 인증서 갱신 실패하거나 nginx reload 안 되거나 서버 장애 나면 미리 알 수 있습니다.
요약
인증서 갱신은 되는데 적용이 안 되던 문제 해결
인증서 관리는 dev에서만 하고 stg는 그냥 갖다 쓰게 구조 정리
SSL 만료/서버 장애 사전 감지 체계 추가
📚 Reference
check_cert_expiry.sh(인증서 만료 체크 스크립트)
check_server_alive.sh(서버 상태 검사 스크립트)
✅ Check List