bibimbap/certs/README.md

40 lines
1.7 KiB
Markdown

# certs/ — 회사 TLS 인터셉션 프록시 CA (선택)
이 디렉토리는 **TLS 를 가로채는 회사 프록시**(예: Cloudflare Zero Trust/Gateway, Zscaler 등)
환경에서 Docker 빌드가 Maven 의존성을 받을 때 필요한 루트 CA 인증서를 둔다.
## 왜 필요한가
`spring-boot 3.5.14-SNAPSHOT` 빌드는 `https://repo.spring.io/snapshot` 에서 의존성을 받는다.
회사 프록시가 TLS 를 가로채면 호스트(macOS 키체인)는 프록시 CA 를 신뢰하지만,
**빌드 컨테이너의 JDK truststore(cacerts)에는 그 CA 가 없어** 다음 에러로 빌드가 깨진다:
```
PKIX path building failed: unable to find valid certification path to requested target
Non-resolvable import POM: org.springframework.boot:spring-boot-dependencies:pom:3.5.14-SNAPSHOT
```
`Dockerfile` 빌드 스테이지는 이 디렉토리의 `*.crt` / `*.pem` 을 컨테이너 cacerts 로 주입한다.
파일이 없으면(프록시 없는 환경) 그냥 건너뛴다.
## 추출 방법 (macOS)
현재 호스트가 보는 프록시 CA 를 그대로 추출:
```bash
# 1) 어떤 CA 가 인터셉트하는지 확인
echo | openssl s_client -connect repo.spring.io:443 -servername repo.spring.io 2>/dev/null \
| openssl x509 -noout -issuer
# 2) 그 CA 를 키체인에서 PEM 으로 추출 (issuer CN 일부를 -c 에 사용)
security find-certificate -a -c "Gateway CA - Cloudflare Managed" -p \
~/Library/Keychains/login.keychain-db /Library/Keychains/System.keychain \
> certs/corporate-proxy-ca.crt
```
추출한 `*.crt` 는 환경특화 정보라 **git 추적하지 않는다**(`.gitignore` 처리됨).
## 프록시가 없는 환경
이 디렉토리를 비워두면 된다. Docker 빌드는 CA 주입 단계를 건너뛰고 정상 진행한다.