init: init proj
This commit is contained in:
12
gen-cert.sh
Executable file
12
gen-cert.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# 生成/更新自签名 HTTPS 证书(IP 变了就重新跑一次)
|
||||
cd "$(dirname "$0")"
|
||||
mkdir -p certs
|
||||
IP=$(ipconfig getifaddr en0 2>/dev/null || ipconfig getifaddr en1 2>/dev/null || echo 127.0.0.1)
|
||||
echo "为本机 IP = $IP 生成自签名证书..."
|
||||
openssl req -x509 -newkey rsa:2048 -nodes \
|
||||
-keyout certs/key.pem -out certs/cert.pem -days 825 \
|
||||
-subj "/CN=calx-local" \
|
||||
-addext "subjectAltName=IP:${IP},IP:127.0.0.1,DNS:localhost"
|
||||
openssl x509 -in certs/cert.pem -outform der -out certs/calx-cert.cer
|
||||
echo "完成。iOS 请访问 https://${IP}:8443/cert 下载并信任证书。"
|
||||
Reference in New Issue
Block a user