Skip to content

Instantly share code, notes, and snippets.

@sursir
Created June 12, 2019 09:26
Show Gist options
  • Save sursir/e439cd71e7c7d110b0cddcfe04f82be3 to your computer and use it in GitHub Desktop.
Save sursir/e439cd71e7c7d110b0cddcfe04f82be3 to your computer and use it in GitHub Desktop.
https 443 server ssl cret crt caroot
# root 密钥
openssl genrsa -des3 -out rootCA.key 2048
# root 证书
openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 2048 -out rootCA.pem
# 添加信任 root 证书
# 组织:生成密钥并且申请函
openssl req -new -sha256 -nodes -out pikachu.csr -newkey rsa:2048 -keyout pikachu.key -config pikachu.csr.cnf
# root 承认组织 生成证书给组织
openssl x509 -req -in pikachu.csr -CA rootCA.pem -CAkey rootCA.key -CAcreateserial -out pikachu.crt -days 2048 -sha256 -extfile pikachu.v3.ext
# 组织: 拿上自己的密钥与被颁发的证书配置WEB服务器
listen 443 ssl;
ssl_certificate /Users/sunny/.crt/pikachu.crt;
ssl_certificate_key /Users/sunny/.crt/pikachu.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
[req]
default_bits = 2048
prompt = no
default_md = sha256
distinguished_name = dn
[dn]
C=CN
ST=Sunny
L=Yang
O=Yang
OU=Yang
[email protected]
CN = pikachu.com
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = mobile.pikachu.com
DNS.2 = pikachu.local
DNS.3 = pikachu.com
# DNS 为识别域名 [重要]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment