博客
关于我
创建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 urllib2 文件上传问题
查看>>
Python urllib2.open 连接由对等错误重置
查看>>
python urllib2详解及实例
查看>>
Python url请求提示certificate verify failed unable to get local issuer certificate
查看>>
Python UTC 日期时间对象的 ISO 格式不包括 Z(祖鲁语或零偏移)
查看>>
python valueerror object2_python遇到错误记录
查看>>
python vars的作用
查看>>
Python vcrpy库:HTTP请求记录和重放
查看>>
Python virtualenv
查看>>
python vue3实现大文件分段续传(断点续传)--带暂停和继续功能
查看>>
Python WebDriver如何打印整个页面源(html)
查看>>
Python WebSocket自动化测试:构建高效接口测试框架
查看>>
Python Web开发
查看>>
Redis 配置文件杂项。
查看>>
Python web自动化测试 —— 文件上传
查看>>
Python web自动化测试 —— 文件上传!
查看>>
Python Web自动化测试开发环境搭建(附安装包与虚拟机环境)
查看>>
python win32api键盘_Python win32api.keybd_event模拟键盘输入
查看>>
python Windows显示当前鼠标坐标
查看>>
python Workbook 表格宽度
查看>>