posts - 710,  comments - 81,  views - 260万
< 2025年3月 >
23 24 25 26 27 28 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 31 1 2 3 4 5

一、下载安装mkcert,截止至2020-5-9,最新版本为1.4.1
1、windows系统:直接下载解压即可。
下载:https://download.csdn.net/download/alinathz/12402537

2、linux系统:
在CentOS和Fedora中安装mkcert类似于Ubuntu/Debian安装,只需要先安装nss-tools工具:

1
sudo yum install nss-tools
安装完成后,下载二进制包,截止至2020-5-9,最新版本为1.4.1:

1
wget -O mkcert https://github.com/FiloSottile/mkcert/releases/download/v1.4.1/mkcert-v1.4.1-linux-amd64

下载文件后,使文件可执行并将二进制文件放在/usr/loa/bin下:


1
2
chmod +x  mkcert
sudo mv mkcert /usr/local/bin

二、mkcert的使用方法
1、安装CA根证书到本地


1
mkcert -install


2、生成证书

1
2
3
4
mkcert 127.0.0.1 localhost              //后面还可以继续空格添加其他域名或IP地址,默认是pem格式
mkcert -pkcs12 192.168.10.123           //生成p12格式的正式iis可以用,默认密码为:“changeit”
mkcert -client 192.168.10.123           //客户端证书,默认是pem格式
mkcert -pkcs12 -client 192.168.10.123   //生成p12格式客户端证书,win用户可以直接导入,默认密码为:“changeit”

更多的使用方法,可以用以下命令查看

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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
mkcert -help
 
Usage of mkcert:
 
        $ mkcert -install
        Install the local CA in the system trust store.
 
        $ mkcert example.org
        Generate "example.org.pem" and "example.org-key.pem".
 
        $ mkcert example.com myapp.dev localhost 127.0.0.1 ::1
        Generate "example.com+4.pem" and "example.com+4-key.pem".
 
        $ mkcert "*.example.it"
        Generate "_wildcard.example.it.pem" and "_wildcard.example.it-key.pem".
 
        $ mkcert -uninstall
        Uninstall the local CA (but do not delete it).
 
Advanced options:
 
        -cert-file FILE, -key-file FILE, -p12-file FILE
            Customize the output paths.
 
        -client
            Generate a certificate for client authentication.
 
        -ecdsa
            Generate a certificate with an ECDSA key.
 
        -pkcs12
            Generate a ".p12" PKCS #12 file, also know as a ".pfx" file,
            containing certificate and key for legacy applications.
 
        -csr CSR
            Generate a certificate based on the supplied CSR. Conflicts with
            all other flags and arguments except -install and -cert-file.
 
        -CAROOT
            Print the CA certificate and key storage location.
 
        $CAROOT (environment variable)
            Set the CA certificate and key storage location. (This allows
            maintaining multiple local CAs in parallel.)
 
        $TRUST_STORES (environment variable)
            A comma-separated list of trust stores to install the local
            root CA into. Options are: "system", "java" and "nss" (includes
            Firefox). Autodetected by default.

三、其他
mkcert不一定要在服务器上安装生成,只要把生成的证书导入或部署到web服务器上就可以了,然后把生成出来的client证书安装到各客户端电脑上即可。

以IIS为例:将生成出来的192.168.10.123.p12文件,copy到服务器上,打开IIS管理器,在【服务器证书】里,直接导入即可。再把192.168.10.123-client.p12下发给个客户端电脑,直接双击安装即可。

注意,p12格式证书的默认密码为:changeit

如果需要更改这个默认密码,我能想到的就是生成pem格式,然后在https://www.chinassl.net/ssltools/convert-ssl.html里转换格式,顺便把密码改了!

如果这篇文章对你有帮助,麻烦点下下面的【点赞】,哈哈~~~~完毕!!

 转载自:https://blog.csdn.net/gary_yan/article/details/77973711
posted on   itprobie-菜鸟程序员  阅读(796)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:基于图像分类模型对图像进行分类
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 25岁的心里话
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示