自签名证书Linux的导入
2022/4/11 7:12:56
本文主要是介绍自签名证书Linux的导入,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
自签名证书Linux的导入
系统层级:
Debain系
sudo mkdir /usr/local/share/ca-certificates/extra sudo cp selfCA.pem /usr/local/share/ca-certificates/extra/xxx.cert.crt sudo update-ca-certificates
Fedora系
sudo cp selfCA.pem/etc/pki/ca-trust/source/anchors sudo update-ca-trust
在这些步骤之后,新的 CA 可用于 curl 和 get 等系统实用程序。 但大多数网络浏览器不会管这些,例如 Mozilla Firefox 或 Google Chrome。
浏览器:
通常证书储存在用户目录,名为“cert8.db”和“cert9.db”(适用于较新版本)。 您可以使用“certutil”工具修改库文件。 要安装 certutil,请执行以下 apt 命令:
sudo apt install libnss3-tools
网上找到的写的bash文件可以更改库
#!/bin/bash ### Script installs root.cert.pem to certificate trust store of applications using NSS ### (e.g. Firefox, Thunderbird, Chromium) ### Mozilla uses cert8, Chromium and Chrome use cert9 ### ### Requirement: apt install libnss3-tools ### ### ### CA file to install (CUSTOMIZE!) ### # File name path certfile="/home/me/selfCA.pem" certname="My Root CA" ### ### For cert8 (legacy - DBM) ### for certDB in $(find ~/ -name "cert8.db") do certdir=$(dirname ${certDB}); certutil -A -n "${certname}" -t "TCu,Cu,Tu" -i ${certfile} -d dbm:${certdir} done ### ### For cert9 (SQL) ### for certDB in $(find ~/ -name "cert9.db") do certdir=$(dirname ${certDB}); certutil -A -n "${certname}" -t "TCu,Cu,Tu" -i ${certfile} -d sql:${certdir} done
执行后可能会提示
Notice: Trust flag u is set automatically if the private key is present.
属于正常
之后浏览器就可以看到正常的证书了。
这篇关于自签名证书Linux的导入的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-03-30[译]漫画SELinux概念
- 2024-03-29linux 移动文件
- 2024-03-28linux .so file
- 2024-03-28Linux 磁盘管理
- 2024-03-28Linux学习笔记(十三)磁盘管理(一):磁盘分区
- 2024-03-26linux 创建 文件
- 2024-03-25使用SecureCRT对Linux vim进行颜色设置
- 2024-03-202019-2020-12 20199317 《Linux内核原理与分析》 第十二周作业
- 2024-03-20Linux运维的第二周总结
- 2024-03-13how to count number of directories in linux