博客
关于我
创建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 基础 - Day 5 Learning Note - 模块 之 标准库:time (1)
查看>>
Python 基础一
查看>>
python 基础操作知识整理总结
查看>>
Python 基础知识点整理与分享,期盼你的交流!
查看>>
python 基础第七篇
查看>>
Python编程:Tkinter图形界面设计(1)
查看>>
Python 基础语法:None
查看>>
Python 基础语法:基本数据类型(一)
查看>>
python编程读取写入excel_Python读取txt内容写入xls格式excel中的方法
查看>>
Python 基础语法:基本数据类型(字典)
查看>>
Python 基础语法:基本数据类型(字符串)
查看>>
Python 基础语法:基本数据类型(集合)
查看>>
Python编程的终极十大工具
查看>>
python 堆排序
查看>>
python编程方式之一-函数式编程
查看>>
python 复习计划
查看>>
Python 多处理 apply_async 永远不会在 Windows 7 上返回结果
查看>>
Python 多处理 Numpy 随机
查看>>
Python 多处理 >= 125 列表永远不会完成
查看>>
Python 多处理:在第一个子错误时中止映射
查看>>