搭建CA

搭建自己的CA

openssl的配置文件:

[root@centos ~]#vim /etc/pki/tls/openssl.cnf

第一步:

第一步:先去 /etc/pki/CA 下(CA文件都在这个下)8上面没有那些文件的需要自己建立8上连这个CA都得自己建

[root@centos CA]#mkdir certs
[root@centos CA]#mkdir crl
[root@centos CA]#mkdir newcerts
[root@centos CA]#mkdir private
[root@centos CA]#ll
total 0
drwxr-xr-x 2 root root 6 Feb  4 18:06 certs
drwxr-xr-x 2 root root 6 Feb  4 18:06 crl
drwxr-xr-x 2 root root 6 Feb  4 18:06 newcerts
drwxr-xr-x 2 root root 6 Feb  4 18:06 private
#生成证书索引数据库文件
touch /etc/pki/CA/index.txt
#指定第一个颁发证书的序列号
echo 01 > /etc/pki/CA/serial

第二步:

第二步:创建CA的私钥(在private_key下)

[root@centos CA]#openssl genrsa -out private/cakey.pem 1024
Generating RSA private key, 1024 bit long modulus (2 primes)
....................+++++
................................+++++
e is 65537 (0x010001)
[root@centos CA]#cat private/cakey.pem 
-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCYoBKHWb6MIHqktLzR2Hy0dZ1oY7n4sf7OnK8Q8dBR7I12pAXZ
9Q5ywvhVEUWiaoXrYu1ZjX9NJc9DP4hOe2CccxLfQ7aFCV5wfDpn8OVcAMzyO6Nf

第三步:

第三步:生成CA自签证书(需要私钥文件)

openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 3650 -out   /etc/pki/CA/cacert.pem

查看证书可以用这种方式查看

[root@centos CA]#openssl x509 -in cacert.pem -noout -text
发布了10 篇原创文章 · 获赞 0 · 访问量 183

猜你喜欢

转载自blog.csdn.net/weixin_46025401/article/details/104255316
CA
今日推荐