Skip to content

Commit

Permalink
docs: complete https doc
Browse files Browse the repository at this point in the history
Signed-off-by: daz-3ux <[email protected]>
  • Loading branch information
Daz-3ux committed Oct 9, 2023
1 parent 2b398e9 commit c9be4dd
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ca: ## generate CA file
# 3. generate root certificate
@openssl x509 -req -in $(OUTPUT_DIR)/cert/ca.csr -signkey $(OUTPUT_DIR)/cert/ca.key -out $(OUTPUT_DIR)/cert/ca.crt
# 4. generate server private key
@openssl genrsa -out $(OUTPUT_DIR)/cert/server.key 1024
@openssl genrsa -out $(OUTPUT_DIR)/cert/server.key 4096
# 5. generate server public key
@openssl rsa -in $(OUTPUT_DIR)/cert/server.key -pubout -out $(OUTPUT_DIR)/cert/server.pem
# 6. generate CSR for server to request signing from CA
Expand Down
26 changes: 25 additions & 1 deletion docs/devel/zh-CN/conversions/https.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,28 @@
2. 配置 `tls` 证书文件和 `HTTPS` 服务监听端口
-`configs/dazBlog.yaml` 中进行配置
3. `tls` 证书文件, 并启动 `HTTPS` 服务器
-`internal/dazBlog/dazBlog` 中进行配置
-`internal/dazBlog/dazBlog` 中进行配置

## 实现流程
### Makefile
```shell
# 签发根证书和私钥
# 1. 生成根证书私钥
@openssl genrsa -out $(OUTPUT_DIR)/cert/ca.key 4096
# 2. 生成根证书请求文件
@openssl req -new -key $(OUTPUT_DIR)/cert/ca.key -out $(OUTPUT_DIR)/cert/ca.csr \
-subj "/C=CN/ST=Shannxi/L=Xi'an/O=devops/OU=XiyouLUG/CN=127.0.0.1/[email protected]"
# 3. 生成根证书
# 生成服务端证书
@openssl x509 -req -in $(OUTPUT_DIR)/cert/ca.csr -signkey $(OUTPUT_DIR)/cert/ca.key -out $(OUTPUT_DIR)/cert/ca.crt
# 1. 生成服务端私钥
@openssl genrsa -out $(OUTPUT_DIR)/cert/server.key 4096
# 2. 生产服务端公钥
@openssl rsa -in $(OUTPUT_DIR)/cert/server.key -pubout -out $(OUTPUT_DIR)/cert/server.pem
# 3. 生成服务端向 CA 申请签名的 CSR 文件
@openssl req -new -key $(OUTPUT_DIR)/cert/server.key -out $(OUTPUT_DIR)/cert/server.csr \
-subj "/C=CN/ST=Guangdong/L=Shenzhen/O=serverdevops/OU=serverit/CN=127.0.0.1/[email protected]"
# 4. 生成服务端带有 CA 签名的证书
@openssl x509 -req -CA $(OUTPUT_DIR)/cert/ca.crt -CAkey $(OUTPUT_DIR)/cert/ca.key \
-CAcreateserial -in $(OUTPUT_DIR)/cert/server.csr -out $(OUTPUT_DIR)/cert/server.crt
```
2 changes: 1 addition & 1 deletion scripts/boilerplate.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2023 daz-3ux(杨鹏达) <[email protected]>. All rights reserved.
Use of this source code is governed by a MIT style
license that can be found in the LICENSE file. The original repo for
license that can be found in the LICENSE file. The original repo for
this file is https://github.com/Daz-3ux/dBlog.

0 comments on commit c9be4dd

Please sign in to comment.