Linux 部署CA数字证书服务

CA数字证书服务

CA Certificate Authority 数字证书授权中心

被通信双方信任的,独立的第三方机构

负责证书颁发,验证,撤销等管理

PKI公钥基础设施

一套标准的密钥管理平台

通过公钥加密,数字证书技术确保信息安全

PKI体系的基础组成

权威认证机构(CA)

数字证书库,密钥备份及恢复系统

证书作废系统,应用接口

OpenSSL加密/解密工具

对称加密:

— enc 算法 -e -in 输入文件 -out 输出文件 #加密

— enc 算法 -d -in 输入文件 -out 输出文件 #解密

[[email protected] ~]# which openssl

/usr/bin/openssl

[[email protected] ~]# rpm -qf /usr/bin/openssl

openssl-1.0.1e-42.el7_1.9.x86_64

[[email protected] ~]# vim f1.txt

[[email protected] ~]# openssl enc -des3 -e -in f1.txt -out f1.txt.enc

enter des-ede3-cbc encryption password:

Verifying - enter des-ede3-cbc encryption password:

[[email protected] ~]# ls f1*

f1.txt  f1.txt.enc

[[email protected] ~]# rm -rf f1.txt

[[email protected] ~]# openssl enc -des3 -d -in f1.txt.enc  -out f1.txt

enter des-ede3-cbc decryption password:

[[email protected] ~]# ls f1*

f1.txt  f1.txt.enc

部署CA服务器

第一步:配置CA签署环境

[[email protected] ~]# ls /etc/pki/CA/ #工作目录

certs  crl  newcerts  private

[[email protected] ~]# ls /etc/pki/CA/certs/ #存储签发的数字证书

[[email protected] ~]# touch /etc/pki/CA/index.txt #存储发放出去的数字证书信息

[[email protected] ~]# chmod 600 /etc/pki/CA/index.txt

[[email protected] ~]# touch /etc/pki/CA/serial #证书编号文件

[[email protected] ~]# chmod 600 /etc/pki/CA/serial

[[email protected] CA]# echo 01 > serial

[[email protected] CA]# cat serial

01

[[email protected] ~]# vim /etc/pki/tls/openssl.cnf #调整配置

42 dir             = /etc/pki/CA   #CA签署工作目录

43 certs           = $dir/certs   #用户证书存放路径

44 crl_dir         = $dir/crl

45 database        = $dir/index.txt #存储发放出去的数字证书信息

50 certificate     = $dir/my-ca.crt   #CA根证书文件名

51 serial          = $dir/serial #证书编号文件

55 private_key     = $dir/private/my-ca.key #CA私钥文件名

130 countryName_default             = CN

135 stateOrProvinceName_default     = beijing

138 localityName_default            = beijing

141 0.organizationName_default      = Xuenqlve

148 organizationalUnitName_default  = ope

84 [ policy_match ] #匹配策略

85 countryName             = match

86 stateOrProvinceName     = match

87 organizationName        = match

88 organizationalUnitName  = optional

89 commonName              = supplied

90 emailAddress            = optional

match 必须匹配

optional 可选

supplied 忽略

第二步:为CA生成私钥

[[email protected] ~]# cd /etc/pki/CA/private/

[[email protected] private]# openssl genrsa -des3 2048 > my-ca.key

Generating RSA private key, 2048 bit long modulus

.....................................................................+++

..+++

e is 65537 (0x10001)

Enter pass phrase: #设私钥口令

Verifying - Enter pass phrase: #重复私钥口令

[[email protected] private]# ls

my-ca.key

[[email protected] private]# chmod 600 my-ca.key

第三步:为CA服务器创建根证书

-new 新文件

-x509 证书的版式

./private/my-ca.key  私钥文件名

-day 365 有效日期

[[email protected] private]# cd ..

[[email protected] CA]# openssl req -new -x509 -key ./private/my-ca.key -days 365 > my-ca.crt

Enter pass phrase for ./private/my-ca.key:

You are about to be asked to enter information that will be incorporated

into your certificate request.

What you are about to enter is what is called a Distinguished Name or a DN.

There are quite a few fields but you can leave some blank

For some fields there will be a default value,

If you enter '.', the field will be left blank.

-----

Country Name (2 letter code) [CN]:

State or Province Name (full name) [beijing]:

Locality Name (eg, city) [beijing]:

Organization Name (eg, company) [Xuenqlve]:

Organizational Unit Name (eg, section) [ope]:

Common Name (eg, your name or your server's hostname) []:Xuenqlve.ca.com

Email Address []:[email protected]

第四步:发布根证书

可以通过Web,FTP等方式进行发布

[[email protected] ~]# yum -y install httpd

[[email protected] ~]# systemctl stop firewalld

[[email protected] ~]# setenforce 0

[[email protected] ~]# systemctl restart httpd

[[email protected] ~]# systemctl enable httpd.service

[[email protected] ~]# mkdir /var/www/html/ca

[[email protected] ~]# cp /etc/pki/CA/my-ca.crt /var/www/html/ca/

客户端下载应用

[[email protected] ~]# wget http://192.168.4.2/ca/my-ca.crt

--2018-01-04 20:27:49--  http://192.168.4.2/ca/my-ca.crt

正在连接 192.168.4.2:80... 已连接。

已发出 HTTP 请求,正在等待回应... 200 OK

长度:1399 (1.4K)

正在保存至: “my-ca.crt”

100%[======================================>] 1,399       --.-K/s 用时 0s

2018-01-04 20:27:49 (141 MB/s) - 已保存 “my-ca.crt” [1399/1399])

[[email protected] ~]# firefox

进入火狐浏览器 点击浏览器右侧打开菜单--> 点击首选项

然后点击高级--->点击证书--->点击查看证书

点击证书机构--->点击导入

在计算机上找到刚刚下载的 my-ca.crt 证书 ---> 点击打开

勾选信任--->点击确定

然后就可以看见我们自己搭建的证书信息了

原文地址:http://blog.51cto.com/13558754/2057718

时间: 2024-08-29 03:38:32

Linux 部署CA数字证书服务的相关文章

CA数字证书部署

CA数字证书 CA,Certificate Authority 数字证书授权中心 -被通信双方信任的,独立的第三方机构 -负责证书颁发,验证,撤销等管理 部署CA服务器 自定义机构名称与CA服务器主机名 机构名称:xiaoren CA服务器主机名 www.xiaoren.cn 第一步:部署CA证书签署环境 # vim /etc/pki/tls/openssl.cnf    //配置文件 42行 dir              /etc/pki/CA/        //CA签署工作目录 43行

部署PKI与证书服务给网页加“s”

          部署PKI与证书服务 一.什么是PKI PKI(公钥基础设施),是通过使用公钥技术和数字签名来确保信息安全,并负责验证数字证书持有者身份的一种技术. 本次实验的目的是使用PKI协议中的SSL为了给网页地址"http"后边加"S".浏览网页的时候更安全,不必担心其发送的信息被非法的第三方截获. 二.证书颁发机构 证书颁发机构也称为数字证书认证中心(Certficate  Authority,CA),是PKI应用中权威的.可信任的.公正的第三方机构,

Deploying OpenFire for IM (instant message) service (TCP/IP service) with database MySQL , client Spark on linux部署OpenFire IM 消息中间件服务

Are you a hacker? How to build another QQ/Wechat/whatsapp/skype/imessage? Let's go through this!!!! Materials: A linux/unix/windows/mac computer/server, and do some basic things! Are you feeling high? Okay, let's ride the rocket! Get materials: 1. A

域环境部署PKI与证书服务

在 Windows server 2016操作系统中,证书服务不是Windows默认服务,需要在系统安装完成后手动添加证书服务,在其具体操作步骤如下.(1)打开"服务器管理器"窗口,单击"添加角色功能"(2)在"开始之前"窗口中,单击"下一步"按钮(3)在"选择安装类型"窗口中,选择"基于角色或基于功能的安装"单选按钮,单击"下一步"按钮(4)在"选择目标服

Windows server 2016 部署 PKI 和证书服务

在Windows server 2016操作系统中,想要安装证书服务需要满足的条件有:1.有固定的IP地址:2.域环境(不是必须,只是域环境安装完证书服务之后不需要自己手动添加证书服务)3.尽量使用两台服务器(dc1.dc2).在Windows server 2016操作系统中,证书服务不是Windows 默认服务,需要在系统安装完成后手动添加证书服务,DC1具体操作步骤如下:1.打开"服务器管理器"单击"添加角色和功能"2.在"开始之前"窗口中

数字签名,数字证书,CA认证等概念理解

本文将介绍数字签名,数字证书以及CA相关知识. 加密相关知识可见我的上一篇博文:http://watchmen.blog.51cto.com/6091957/1923426 本文参考文献引用链接: 1.https://www.zhihu.com/question/25912483 2.https://blog.jorisvisscher.com/2015/07/22/create-a-simple-https-server-with-openssl-s_server/ 3.https://zh.

浅谈https\ssl\数字证书

全球可信的SSL数字证书申请:http://www.shuzizhengshu.com 在互联网安全通信方式上,目前用的最多的就是https配合ssl和数字证书来保证传输和认证安全了.本文追本溯源围绕这个模式谈一谈. 名词解释 首先解释一下上面的几个名词: https:在http(超文本传输协议)基础上提出的一种安全的http协议,因此可以称为安全的超文本传输协议.http协议直接放置在TCP协议之上,而https提出在http和TCP中间加上一层加密层.从发送端看,这一层负责把http的内容加

[转]浅谈https\ssl\数字证书

浅谈https\ssl\数字证书 http://www.cnblogs.com/P_Chou/archive/2010/12/27/https-ssl-certification.html 全球可信的SSL数字证书申请:http://www.shuzizhengshu.com 在互联网安全通信方式上,目前用的最多的就是https配合ssl和数字证书来保证传输和认证安全了.本文追本溯源围绕这个模式谈一谈. 名词解释 首先解释一下上面的几个名词: https:在http(超文本传输协议)基础上提出的

数字证书在WEB应用中登录

1数字证书登录认证的优点 作为企业信息系统的第一道大门,身份认证是确保企业信息资源只能被合法用户所访问的重要保障. 传统的口令认证方式虽然简单,但是由于其易受到窃听.重放等攻击的安全缺陷,使其已无法满足当前复杂网络环境下的安全认证需求. 传统账号+口令登录的弊端: 1.         口令易被猜测.由于有的用户为了方便记忆,使用非常简单的口令,比如"1234"."abcd"等这些非常容易被猜测的口令. 2.         口令易被窃听.大家都知道,WEB应用在互