-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: daz-3ux <[email protected]>
- Loading branch information
Showing
3 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |