博客
关于我
创建Apache的CA证书
阅读量:532 次
发布时间:2019-03-08

本文共 1224 字,大约阅读时间需要 4 分钟。

自建Apache的CA证书

(环境:Centos7)

PS:建议实验前将防火墙和SELinux都关掉。


安装Apache环境依赖

使用yum命令安装所需的依赖包:

[root@qmfz ~]# yum -y install mod_ssl openssl httpd

已加载插件:fastestmirror

镜像速度从缓存文件获取:

  • base: mirrors.aliyun.com
  • extras: mirrors.aliyun.com
  • updates: mirrors.163.com

软件包已安装并为最新版本:

  • mod_ssl-2.4.6-97.el7.centos.x86_64
  • openssl-1.0.2k-19.el7.x86_64
  • httpd-2.4.6-97.el7.centos.x86_64

无需额外处理。


创建CA证书存放目录

在 /etc/httpd 下创建CA证书存放目录 ca:

[root@qmfz ~]# cd /etc/httpd[root@qmfz httpd]# mkdir ca

创建CA证书

在 /etc/httpd/ca 目录下使用openssl生成证书:

[root@qmfz ca]# openssl req -newkey rsa:4096 -nodes -sha256 \  -keyout ca.key -x509 -days 1000 \  -out ca.crt

其中,-days 1000 可以根据实际需求调整天数。填写证书信息时,可以选择留空(使用.表示空值)。


生成服务器注册的证书

使用CA证书对服务器注册名单进行签名:

[root@qmfz ca]# openssl x509 -req -days 365 \  -in chenshuyi.top.csr -CA ca.crt -CAkey ca.key \  -CAcreateserial -out chenshuyi.top.crt

查看生成文件

查看生成的CA证书和私钥文件:

[root@qmfz ca]# ll

输出示例如下:

总用量 4drwxr-xr-x. 2 root root    4 11月 28 21:11 .drwxr-xr-x. 2 root root   17 11月 29 17:06 ..drwxr-xr-x. 2 root root   37 11月 28 21:15 ca.crtdrwxr-xr-x. 2 root root 1700 11月 28 21:11 chenshuyi.top.crtdrwxr-xr-x. 2 root root 1797 11月 28 20:32 chenshuyi.top.csrdrwxr-xr-x. 2 root root 1797 11月 28 20:32 chenshuyi.top.key

完成

到此,CA证书和服务器注册名单证书已经成功生成!

转载地址:http://eikiz.baihongyu.com/

你可能感兴趣的文章
python Workbook 表格宽度
查看>>
python 中 dict 的另一种用法
查看>>
Python 中只有一个 True 和一个 False 对象吗?
查看>>
Python 中多线程与多处理之间的区别
查看>>
Python 从入门到精通:30天速成教程到底有多狠?你能坚持下来吗?
查看>>
Python 从数据库中存储和检索密码的最安全方法
查看>>
Python语言及其应用 - 知识点遍历
查看>>
Python 优化提速的 8 个小技巧
查看>>
Python 余弦相似度与皮尔逊相关系数 计算
查看>>
python 使用execjs 报编码错误解决办法,UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xac in position 145: il
查看>>
python 使用filetype校验文件
查看>>
Python 使用flush函数将缓冲区数据立即写磁盘
查看>>
python 使用in判断不准确,in不好使
查看>>
Python 使用pandas 进行查询和统计详解
查看>>
Redis 配置文件redis.conf详细解释
查看>>
python网络爬虫(2)——scrapy框架的基础使用
查看>>
Python 使用哈希函数用于加密
查看>>
Python 依赖管理的革新——Poetry 深度解析
查看>>
python 保留精度及增加去除数字的千位分隔符(金额化数字)
查看>>
python 倒计时 9,8,7,。。。。。。0
查看>>