Skip to content

Commit a22ffb7

Browse files
committed
feat: self-signed 인증서 생성 스크립트 추가
1 parent a2e5208 commit a22ffb7

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# 스크립트가 위치한 디렉토리로 이동
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
cd "$SCRIPT_DIR"
6+
7+
# OpenSSL 설정 파일 생성
8+
cat > openssl.conf << EOF
9+
[req]
10+
default_bits = 2048
11+
default_keyfile = localhost.key
12+
distinguished_name = req_distinguished_name
13+
req_extensions = req_ext
14+
x509_extensions = v3_ca
15+
prompt = no
16+
17+
[req_distinguished_name]
18+
C = KR
19+
ST = Seoul
20+
L = Seoul
21+
O = OctoDocs
22+
OU = Development
23+
CN = localhost
24+
25+
[req_ext]
26+
subjectAltName = @alt_names
27+
28+
[v3_ca]
29+
subjectAltName = @alt_names
30+
31+
[alt_names]
32+
DNS.1 = localhost
33+
DNS.2 = *.localhost
34+
DNS.3 = octodocs.local
35+
DNS.4 = *.octodocs.local
36+
IP.1 = 127.0.0.1
37+
EOF
38+
39+
# 인증서 생성
40+
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout localhost.key -out localhost.crt -config openssl.conf
41+
42+
chmod 644 localhost.crt
43+
chmod 644 localhost.key
44+
45+
# 설정 파일 정리
46+
rm openssl.conf
47+
48+
echo "SSL certificate generated successfully!"
49+
echo "Certificate: $SCRIPT_DIR/localhost.crt"
50+
echo "Private key: $SCRIPT_DIR/localhost.key"

0 commit comments

Comments
 (0)