diff --git a/src/certificate/create-rootca.md b/src/certificate/create-rootca.md new file mode 100644 index 0000000..32ff4d0 --- /dev/null +++ b/src/certificate/create-rootca.md @@ -0,0 +1,104 @@ +# 고객사 설치용 RootCA/Intermediate 인증서 생성 + +## 0) 폴더 구조(권장) + +```bash +pki/ + root/ + intermediate/ +``` + +--- + +## 1) Root CA 만들기 (1회, 오프라인 보관 권장) + +### 1-1) Root 개인키 생성 (암호화 권장) + +```bash +mkdir -p pki/root +cd pki/root + +openssl genrsa -aes256 -out rootca-kdn.key 4096 +``` +(Enter PEM pass phrase: 백세민1!) + +### 1-2) Root 인증서(자기서명) 생성 + +```bash +openssl req -x509 -new -nodes -key rootca-kdn.key -sha256 -days 3650 -subj "/C=KR/O=BSM-LAB/CN=BSM-LAB KDN Root CA" -out rootca-kdn.crt +``` +(Enter pass phrase for rootca-kdn.key: 백세민1!) + +> RootCA `rootca.key` 파일은 bsm-lab 고객관리 서버에 저장 + +--- + +## 2) Intermediate CA 만들기 (고객사별로 1개씩 권장) + +### 2-1) Intermediate 개인키 생성 + +```bash +mkdir -p ../intermediate +cd ../intermediate + +openssl genrsa -aes256 -out intermediate.key 4096 +``` + +### 2-2) Intermediate CSR 생성 + +```bash +openssl req -new \ + -key intermediate.key \ + -subj "/C=KR/O=BSM-LAB/CN=BSM-LAB Customer Intermediate CA" \ + -out intermediate.csr +``` + +### 2-3) Root로 Intermediate 인증서 서명 + +여기서 `v3_intermediate_ca` 확장(Constraints/KeyUsage)을 꼭 넣는 게 좋습니다. 간단히 쓸 수 있는 `root-ext.cnf` 파일을 하나 만듭니다. + +**(root-ext.cnf)** + +```ini +[ v3_intermediate_ca ] +basicConstraints = critical, CA:true, pathlen:0 +keyUsage = critical, keyCertSign, cRLSign +subjectKeyIdentifier = hash +authorityKeyIdentifier = keyid:always,issuer +``` + +이제 Root로 서명: + +```bash +# root 폴더로 돌아가 Root 키/인증서로 서명 +cd ../root + +openssl x509 -req -in ../intermediate/intermediate.csr \ + -CA rootca.crt -CAkey rootca.key -CAcreateserial \ + -out ../intermediate/intermediate.crt \ + -days 1825 -sha256 \ + -extfile root-ext.cnf -extensions v3_intermediate_ca +``` + +### 2-4) CA 체인 파일 만들기 + +```bash +cat ../intermediate/intermediate.crt rootca.crt > ../intermediate/ca-chain.crt +``` + +이 `ca-chain.crt`가 “고객사 설치용 CA 체인”으로 자주 쓰입니다(신뢰 저장소에 넣기 좋음). + +--- + +## 3) 다음 단계(참고): leaf(에이전트/웹서버) 발급은 Intermediate로 + +CA 체인이 준비되면, leaf는 보통 이런 흐름입니다. + +1. (에이전트/웹서버) 개인키 생성 +2. CSR 생성(CN/SAN 포함) +3. **Intermediate로 서명**해서 leaf cert 발급 +4. `leaf cert + private key`는 keystore(p12), `ca-chain`은 truststore에 + +--- + +원하시면, 위걸 “고객사 A/B별로 자동으로 디렉토리 생성해서 CA 체인 뽑는 스크립트(Windows PowerShell / Linux bash)”로 만들어드릴게요. 그리고 이어서 **leaf 인증서 발급 시 SAN(호스트/IP) 넣는 방법**까지 같이 붙이면 실제 배포에 바로 쓸 수 있습니다. diff --git a/src/certificate/tls-scenario.md b/src/certificate/tls-scenario.md new file mode 100644 index 0000000..3c81ec4 --- /dev/null +++ b/src/certificate/tls-scenario.md @@ -0,0 +1,17 @@ +# DFXConsole + DFXAgent 사용시 +1. 준비 + - DFXConsole 설치 서버에 RootCA/Intermeidate 인증서 생성 (CA Chain) +--- + +# DFXAgent 사용시 +1. 준비 + - 고객사 설치용 RootCA/Intermediate 인증서 생성 + - DFXAgent 설치 서버에 CA Chain 인증서 truststore 등록 + - DFXAgent 설치 서버에 CA Chain 인증서를 사용하여 개인키 발행 + - DFXAgent용 leaf 인증서를 keystore 등록 + - DFXAgent settings.json SSL 설정 확인(SSL 적용을 위한 프로그램 수정 필요) +2. DFXAgent 실행 + - 상대 DFXAgent의 https://.../command (Command Type: GET_DATA_ENCRYPT_KEY 신설) 를 통하여 ARIA-GCM 키 획득 + - Postman 등의 https request 동작은 ALIVE 체크와 같이 ARIA-GCM 키 획득 전에는 동작 안함 + - DFXAgent가 https로 request를 하기 위한 프로그램 수정 필요 + - ARIA-GCM 키로 데이터를 암호화하여 상대 DFXAgent로 전송 \ No newline at end of file