mkcert
用来生成自签证书的工具
示例
mkcert
是 GO 编写的,一个简单的零配置的用来生成自签证书的工具。
下面给一个简单的示例,在本地生成自签证书,并使用让 nc 使用生成的证书。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
~ ········································································································································· 10:46:25
❯ mkcert -install
The local CA is already installed in the system trust store! 👍The local CA is already installed in the Firefox and/or Chrome/Chromium trust store! 👍
~ ········································································································································· 10:46:34
❯ mkcert example.com "*.example.com" example.test localhost 127.0.0.1 ::1
Created a new certificate valid for the following names 📜 - "example.com"
- "*.example.com"
- "example.test"
- "localhost"
- "127.0.0.1"
- "::1"
Reminder: X.509 wildcards only go one level deep, so this won't match a.b.example.com ℹ️
The certificate is at "./example.com+5.pem" and the key at "./example.com+5-key.pem" ✅
It will expire on 30 January 2025 🗓
~ ········································································································································· 10:47:37
❯ ls
公共 视频 文档 音乐 aria aria2-downloads Dockerfile example.com+5.pem GOPATH minio-binaries nowip_hosts.txt tech_backend.jar
模板 图片 下载 桌面 aria2-config cv_debug.log example.com+5-key.pem go math navicat_reset src
~ ········································································································································· 10:47:55
❯ ncat -lvp 1589 --ssl-key example.com+5-key.pem --ssl-cert example.com+5.pem
Ncat: Version 7.92 ( https://nmap.org/ncat )
Ncat: Listening on :::1589
Ncat: Listening on 0.0.0.0:1589
Ncat: Connection from 127.0.0.1.
Ncat: Connection from 127.0.0.1:39156.
Ncat: Failed SSL connection from 127.0.0.1: error:00000000:lib(0):func(0):reason(0)
|
mkcert
自动生成并安装一个本地 CA 到 root stores,并且生成 locally-trusted 证书。mkcert
不会自动使用证书来配置服务器,不过,这取决于你。
……
Continue reading