linux-搭建CDA数字证书

CA介绍

搭建CA服务器  (网站服务的数据加密传输)

CA服务器  (172.40.55.10)

第一步:配置CA签署环境

第二步:为CA服务器生成私钥

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

第四步:发布根证书文件

第一步:配置CA签署环境

[[email protected] ~]# rpm -qf  /etc/pki/tls/openssl.cnf

openssl-1.0.1e-42.el6.x86_64

[[email protected] ~]#

vim  /etc/pki/tls/openssl.cnf

[ CA_default ]

dir = /etc/pki/CA

certs  = $dir/certs

certificate?= $dir/my-ca.crt   根证书名

private_key?= $dir/private/my-ca.key   私钥名

[ req_distinguished_name ]

countryName_default = CN   国家

stateOrProvinceName_default = beijing  省

localityName_default = beijing  城市

0.organizationName_default = tarena    单位

:wq

根据需要建立 index.txt、serial文件

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

[[email protected] CA]# touch  index.txt

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

第二步:为CA服务器生成私钥

cd   /etc/pki/CA/private/

openssl  genrsa  -des3  2048  >  my-ca.key   (123456 密码)

chmod  600  my-ca.key

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

cd   /etc/pki/CA/

openssl  req  -new  -x509  -key  private/my-ca.key  -days 365  >  my-ca.crt    (输入私钥的密码)

[[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) [tarena]:

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

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

Email Address []:[email protected]

[[email protected] CA]#

第四步:发布根证书文件

cd   /etc/pki/CA/

cp  my-ca.crt    /var/www/html/

service  httpd  restart

++++++++++++++++++++++++

网站服务器

1  生成自己私钥

2  生成证书申请文件

3  CA服务器签发证书

4  下载签发的证书

5  配置网站服务运行时,使用签发的证书

6  重启网站服务

1  生成自己私钥

cd  /etc/pki/tls/private/

openssl  genrsa  2048  >  www.key

chmod 600 www.key

2  生成证书申请文件

cd  /etc/pki/tls/private/

openssl  req  -new  -key  www.key  >  /root/www.csr

[[email protected] private]#

[[email protected] private]# openssl  req  -new  -key  www.key  >  /root/www.csr

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) [tarena]:

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

Common Name (eg, your name or your server‘s hostname) []:ca.tarenac^H.^H^C

[[email protected] private]#

[[email protected] private]# openssl  req  -new  -key  www.key  >  /root/www.csr

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) [tarena]:

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

Common Name (eg, your name or your server‘s hostname) []:ca.tedu.cn

Email Address []:[email protected]

Please enter the following ‘extra‘ attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

[[email protected] private]#

3  CA服务器签发证书  并共享签发的证书

cd  /etc/pki/CA/certs/

openssl  ca  -in  /root/www.csr  >  www.crt

[[email protected] certs]# openssl  ca  -in  /root/www.csr  >  www.crt

Using configuration from /etc/pki/tls/openssl.cnf

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

Check that the request matches the signature

Signature ok

Certificate Details:

Serial Number: 1 (0x1)

Validity

Not Before: May  7 09:20:09 2016 GMT

Not After : May  7 09:20:09 2017 GMT

Subject:

countryName               = CN

stateOrProvinceName       = beijing

organizationName          = tarena

organizationalUnitName    = mis

commonName                = ca.tedu.cn

emailAddress              = [email protected]

X509v3 extensions:

X509v3 Basic Constraints:

CA:FALSE

Netscape Comment:

OpenSSL Generated Certificate

X509v3 Subject Key Identifier:

F9:5D:62:DF:AF:9E:23:29:BE:B6:CE:DC:88:4F:E6:C7:B0:36:11:A6

X509v3 Authority Key Identifier:

keyid:5B:1D:A7:F7:B6:22:FE:6D:F2:F1:8E:CE:89:EB:EF:58:E4:CF:A0:A5

Certificate is to be certified until May  7 09:20:09 2017 GMT (365 days)

Sign the certificate? [y/n]:y

1 out of 1 certificate requests certified, commit? [y/n]y

Write out database with 1 new entries

Data Base Updated

[[email protected] certs]#

cp  www.crt   /var/www/html/

4  客户端下载签发的证书

cd  /etc/pki/tls/certs/

cp /etc/pki/CA/certs/www.crt   ./

[[email protected] certs]# ls /etc/pki/tls/private/

www.key

[[email protected] certs]#

5  配置网站服务运行时,使用签发的证书

rpm  -q  mod_ssl

yum  -y  install  mod_ssl

vim /etc/httpd/conf.d/ssl.conf

88 SSLEngine on

105 SSLCertificateFile /etc/pki/tls/certs/www.crt

112 SSLCertificateKeyFile /etc/pki/tls/private/www.key

:wq

6  重启网站服务

service httpd restart

[[email protected] conf]# ps aux  | grep  vmware-hostd

netstat  -untlap  | grep   :443

[[email protected] conf.d]# netstat -utnalp  | grep :443

tcp        0      0 :::443                      :::*                        LISTEN      8973/httpd

+++++++++++++++++++++++++++++++++++

客户机

80    http://web-ip

443  https://web-ip

[[email protected] conf]# elinks  --dump https://localhost/one.html

ELinks: 拒绝连接

[[email protected] conf]#

[[email protected] conf]#

[[email protected] conf]# elinks  --dump http://localhost/one.html

hello a student

[[email protected] conf]#

++++++++++++++++++++++++++++++++++++

网站客户端的配置(访问http自动跳转https)

https://172.40.55.10/one.html

vim httpd.conf

<IfModule ssl_module>

SSLRandomSeed  startup  builtin

SSLRandomSeed  connect  builtin

</IfModule>

RewriteEngine  on

RewriteCond  %{SERVER_PORT}  !^443$

RewriteRule  (.*)  https://%{SERVER_NAME}/$1  [R]

:wq

service  httpd restat

http://ca.tedu.cn/one.html

时间: 2024-08-26 13:42:18

linux-搭建CDA数字证书的相关文章

Linux 部署CA数字证书服务

CA数字证书服务 CA Certificate Authority 数字证书授权中心 被通信双方信任的,独立的第三方机构 负责证书颁发,验证,撤销等管理 PKI公钥基础设施 一套标准的密钥管理平台 通过公钥加密,数字证书技术确保信息安全 PKI体系的基础组成 权威认证机构(CA) 数字证书库,密钥备份及恢复系统 证书作废系统,应用接口 OpenSSL加密/解密工具 对称加密: - enc 算法 -e -in 输入文件 -out 输出文件 #加密 - enc 算法 -d -in 输入文件 -out

设置通过数字证书方式登录远程连接Linux服务器,禁止root账户远程密码方式远程连接服务器

//前几步是做过实验的,会的盆友可以直接跳过看后面部分 一.首先开启SSH数字证书方式登录的策略 修改配置文件/etc/ssh/sshd_config,下列三项为图中的样子,去掉注释启用配置,开启数字证书登录方式 RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys 二.设置公私钥 过程比较简单,之前是做过实验写过博客的(https://www.cnblogs.com/hai-

nginx搭建https单向证书

一)默认情况下ssl模块并未被安装,如果使用该模块则需要在编译nginx的时指定--with-http_ssl_module参数. wget http://nginx.org/download/nginx-1.3.16.tar.gz tar -xf nginx-1.3.16.tar.gz -C /usr/local/ cd /usr/local/nginx-1.3.16/ ./configure --prefix=/usr/local/nginx --user=nginx --group=ngi

linux 搭建https 服务器 (apache)

一.  安装准备 1.    安装Openssl 要使Apache支持SSL,需要首先安装Openssl支持.这里使用的是openssl-0.9.8k.tar.gz 下载Openssl:http://www.openssl.org/source/ tar -zxf openssl-0.9.8k.tar.gz    //解压安装包 cd openssl-0.9.8k                 //进入已经解压的安装包 ./config                          //配

linux搭建web服务器

linux httpd 假设服务器地址为192.168.80.20/24 1.   将准备安装的httpd软件包共享给everyone , (1)在linux上mount.cifs  //真机IP地址/共享文件夹名   /media / ls  /meidia/ 查看 tar    xjvf   httpd-2.4.10.tar.bz2    -C  /usr/src       解压至/usr/src下 下面两个插件是httpd2.4以后的版本所需要的 http://ftp.jaist.ac.

Linux下生成openssl证书

SSL 安全证书可以自己生成,也可以通过第三方的 CA ( Certification Authority )认证中心付费申请颁发. SSL 安全证书包括: 1.CA 证书,也叫根证书或中间级证书.单向认证的 https , CA 证书是可选的.主要目的是使证书构成一个证书链,以达到浏览器信任证书的目的.如果使用了 CA 证书,服务器证书和客户证书都使用 CA 证书来签名.如果不安装 CA 证书,浏览器默认认为是不安全的. 2.服务器证书.必选.通过服务器私钥,生成证书请求文件 CSR ,再通过

linux 搭建CA服务器 http+ssl mail+ssl 扫描与抓包

搭建CA服务器 CA服务是给服务器发放数字证书,被通信双方信任,独立的第三方机构 国内常见的CA机构 中国金融认证中心(CFCA) 中国电信安全认证中心(CTCA) 北京数字证书认证中心(BJCA) PKI公钥基础设施 一套标准的密钥管理平台 通过公钥加密,数字证书技术确保信息安全 PKI体系的基本组成 权威认证机构(CA) 数字证书库,密钥备份及恢复系统 证书作废系统,应用接口 ----------------------------------------------OpenSSL加密工具

数字证书中keytool命令使用说明

这个命令一般在JDK\jre\lib\security\目录下操作 keytool常用命令 -alias       产生别名 -keystore    指定密钥库的名称(就像数据库一样的证书库,可以有很多个证书,cacerts这个文件是jre自带的,              你也可以使用其它文件名字,如果没有这个文件名字,它会创建这样一个) -storepass   指定密钥库的密码 -keypass     指定别名条目的密码 -list        显示密钥库中的证书信息 -v    

基于ejbca community 6.3.1.1构建独立ca系统管理数字证书

"数字证书"这个名词相信很多人听过,但并不了解,"ejbca"可能很多人都没有听过 数字证书(Certificate),就是互联网通信过程中标志通信各方身份的一个文件,可以理解为"网络身份证",主要目的是验证身份 ejbca,是一个CA(Certificate Authority)系统软件,CA是数字证书认证中心的简称,主要功能是管理数字证书,包括证书的颁发.销毁.更新等,ejbca实现了CA规范,因此可以用来管理数字证书 接下来,笔者将按照ej