一、基于easy_rsa 2.x制作证书:

链接:https://blog.51cto.com/wzlinux/1736459  最后附录部分。

下载密钥制作工具easy_rsa 2:

wget https://github.com/Open×××/easy-rsa/archive/release/2.x.zip

解压easy_rsa并拷贝到/etc/open***:

unzip 2.x.zip

mv easy-rsa-release-2.x/ /etc/open***/

编辑easy-rsa的vars文件,设定相关变量信息:

cd /etc/open***/easy-rsa-release-2.x/easy-rsa/2.0

vim vars

export KEY_COUNTRY="CN"

export KEY_PROVINCE="Beijing"

export KEY_CITY="Beijing"

export KEY_ORG="APICloud"

export KEY_EMAIL="ADMIN@APICloud.COM"

export KEY_OU="***.apicloud.com"

编辑完之后,保存退出。

将刚才编辑的vars文件,执行如下命令:

source vars

./clean-all

./build-ca

创建服务器的证书和密钥:

./build-key-server Open×××_Server

[root@cloud 2.0]# ./build-key-server Open×××_Server

Generating a 2048 bit RSA private key

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

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

writing new private key to 'Open×××_Server.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) [XIAOCUI]:

Organizational Unit Name (eg, section) [MyOpen×××]:

Common Name (eg, your name or your server's hostname) [Open×××_Server]:

Name [EasyRSA]:

Email Address [ADMIN@ XIAOCUI.COM]:

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

Using configuration from /etc/open***/easy-rsa-release-2.x/easy-rsa/2.0/openssl-1.0.0.cnf

Check that the request matches the signature

Signature ok

The Subject's Distinguished Name is as follows

countryName           :PRINTABLE:'CN'

stateOrProvinceName   :PRINTABLE:'BEIJING'

localityName          :PRINTABLE:'BEIJING'

organizationName      :PRINTABLE:' XIAOCUI '

organizationalUnitName:PRINTABLE:'MyOpen×××'

commonName            :T61STRING:'Open×××_Server'

name                  :PRINTABLE:'EasyRSA'

emailAddress          :IA5STRING:'ADMIN@ XIAOCUI.COM'

Certificate is to be certified until May  2 07:49:13 2025 GMT (3650 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

创建客户端的证书和密钥:

./build-key client-user-test1

[root@cloud 2.0]# ./build-key client-user-test1

Generating a 2048 bit RSA private key

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

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

writing new private key to 'client-user-cuiyuanrong.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) [XIAOCUI]:

Organizational Unit Name (eg, section) [MyOpen×××]:

Common Name (eg, your name or your server's hostname) [client-user-test1]:

Name [EasyRSA]:

Email Address [ADMIN@XIAOCUI.COM]:

Please enter the following 'extra' attributes

to be sent with your certificate request

A challenge password []:

An optional company name []:

Using configuration from /etc/open***/easy-rsa-release-2.x/easy-rsa/2.0/openssl-1.0.0.cnf

Check that the request matches the signature

Signature ok

The Subject's Distinguished Name is as follows

countryName           :PRINTABLE:'CN'

stateOrProvinceName   :PRINTABLE:'BEIJING'

localityName          :PRINTABLE:'BEIJING'

organizationName      :PRINTABLE:'XIAOCUI'

organizationalUnitName:PRINTABLE:'MyOpen×××'

commonName            :PRINTABLE:'client-user-test1'

name                  :PRINTABLE:'EasyRSA'

emailAddress          :IA5STRING:'ADMIN@XIAOCUI.COM'

Certificate is to be certified until May  2 07:53:17 2025 GMT (3650 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

创建Diffie Hellman 参数:

./build-dh

二、基于easy_rsa 3.x制作证书:

链接:http://openwrt.iteye.com/blog/2305318

最近研究如何在路由器上面实现open***的功能,其中便涉及到使用easyrsa来制作证书的问题,针对最新的open***-2.3.11源码包,easyrsa已经不包含在里面,需要单独下载,下载网址为https://github.com/Open×××/easy-rsa,下载下来是一个easy-rsa-master.zip压缩包,已上传为附件,在linux上面将其解压得到easy-rsa-master,进入easyrsa3,将vars.example复制一份命名为vars,此文件为制作证书时所使用到的配置文件,根据我的需要,我只打开了如下选项:

set_var EASYRSA_DN  "org"

set_var EASYRSA_REQ_COUNTRY "CN"

set_var EASYRSA_REQ_PROVINCE    "Guangdong"

set_var EASYRSA_REQ_CITY    "Shenzhen"

set_var EASYRSA_REQ_ORG "XXX"

set_var EASYRSA_REQ_EMAIL   "me@myhost.mydomain"

/*************************************/

如果open*** client的配置文件中使用了ns-cert-type server则要打开此选项,制作server证书时会将一些信息写入证书,如不打开此选项,则open*** client会提示server certificate verify fail

set_var EASYRSA_NS_SUPPORT  "yes"

/*************************************/

下面就可以制作证书了,每条命令执行之后都有些信息输出,如出错,会提示相关错误信息

1 ./easyrsa init-pki

初始化,会在当前目录创建PKI目录,用于存储一些中间变量及最终生成的证书

2 ./easyrsa build-ca

创建根证书,首先会提示设置密码,用于ca对之后生成的server和client证书签名时使用,然后会提示设置Country Name,State or Province Name,Locality Name,Organization Name,Organizational Unit Name,Common Name,Email Address,可以键入回车使用默认的,也可以手动更改

3 ./easyrsa gen-req server nopass

创建server端证书和private key,nopass表示不加密private key,然后会提示设置Country Name,State or Province Name,Locality Name,Organization Name,Organizational Unit Name,Common Name,Email Address,可以键入回车使用默认的,也可以手动更改

4 ./easyrsa sign server server

给server端证书做签名,首先是对一些信息的确认,可以输入yes,然后输入build-ca时设置的那个密码

5 ./easyrsa gen-dh

创建Diffie-Hellman,时间会有点长,耐心等待

6 创建client端证书,需要单独把easyrsa3文件夹拷贝出来一份,删除里面的PKI目录,然后进入到此目录

./easyrsa init-pki

初始化,会在当前目录创建PKI目录,用于存储一些中间变量及最终生成的证书

7 ./easyrsa gen-req client nopass

创建client端证书和private key,nopass表示不加密private key,然后会提示设置Country Name,State or Province Name,Locality Name,Organization Name,Organizational Unit Name,Common Name,Email Address,可以键入回车使用默认的,也可以手动更改

8 回到制作server证书时的那个easyrsa3目录,导入client端证书,准备签名

./easyrsa import-req client.req所在路径 client

client.req应该在刚才制作client端证书的easyrsa3/pki/reqs/下面

9 ./easyrsa sign client client

给client端证书做签名,首先是对一些信息的确认,可以输入yes,然后输入build-ca时设置的那个密码

注意:ca、server和client的Common Name最好不要设置为一样,我没有验证,不过网上有人说设置一样后,open***连接时会有问题

至此,server和client端证书已制作完毕

open*** server端需要的是

easyrsa3/pki/ca.crt   <制作server证书的文件夹>

easyrsa3/pki/private/server.key <制作server证书的文件夹>

easyrsa3/pki/issued/server.crt <制作server证书的文件夹>

easyrsa3/pki/dh.pem

open*** client端需要的是

easy-rsa/easyrsa3/pki/ca.crt <制作server证书的文件夹>

easy-rsa/easyrsa3/pki/issued/client.crt <制作server证书的文件夹>

easy-rsa/easyrsa3/pki/private/client.key <制作client证书的文件夹>

转载于:https://blog.51cto.com/nanfeibobo/2119557

使用easyrsa来制作证书相关推荐

  1. 使用easyrsa3来制作证书

    [size=medium][color=darkblue]最近研究如何在路由器上面实现openvpn的功能,其中便涉及到使用easyrsa来制作证书的问题,针对最新的openvpn-2.3.11源码包 ...

  2. Linux easy-rsa制作证书

    我的主页: isfantasy.com 下载配置 下载:yum install easy-rsa -y 将easy-eas拷贝到工作目录(自定义):cp -r /usr/share/easy-rsa/ ...

  3. linux java 生成证书_Java 制作证书(Windows 和Linux)

    一.Windows数字证书 1. 生成数字证书 1.1 进入[%JAVA_HOME%]路径下 1 cd D:Program FilesJavajdk1.8.0_131 1.2 生成证书.一些命令中红色 ...

  4. java 生成证书图片_java生成自定义证书图片1 - 制作证书word模板

    最近做项目遇到一个需求,生成指定数据的证书图片(比如毕业证,在空的模板中输入自定义的姓名.日期等信息),尝试了许多方法,最终完美地实现了这个需求. 以下内容为制作证书图片的第一步,制作证书word模板 ...

  5. Windows环境下OpenSSL下载安装及制作证书

    下载与安装 点击下载地址,根据自己的系统版本,下载对应的OpenSSL. 下载完成后,对安装包进行安装,比较简单. 打开OpenSSL 直接到安装目录C:\Program Files\OpenSSL- ...

  6. Java使用openssl详解(openssl安装教程、openssl制作证书、java代码实现openssl、浏览器通过https访问后端)入门

    安装openssl 通过官网的下载源码编译或者直接通过exe文件直接下一步下一步安装完成,网上教程很多! openssl制作证书 先创建3个目录 certificate.service .client ...

  7. OpenSSL 制作证书时出现的错误的解决办法

    在制作证书的过程中遇到的问题及解决办法: 出现:I am unable to access the ./demoCA/newcerts directory        ./demoCA/newcer ...

  8. grpc、https、oauth2等认证专栏实战7:使用cfssl来制作证书介绍

    已发表的技术专栏(订阅即可观看所有专栏) 0  grpc-go.protobuf.multus-cni 技术专栏 总入口 1  grpc-go 源码剖析与实战  文章目录 2  Protobuf介绍与 ...

  9. c语言的证书,c语言制作证书

    制作证书 // MakeCert.cpp : Defines the entry point for the console application. // #include "stdafx ...

最新文章

  1. Perl 模块安装遇到的问题解决办法
  2. linux下查看vnc端口_怎样查vnc端口,Linux下根据进程名怎样查端口
  3. 计算机二级c语基础知识,计算机二级C语基础知识整理.doc
  4. Envoy为什么能战胜Ngnix——线程模型分析篇
  5. Windows消息机制(MFC)
  6. boost::multiprecision模块complex128相关的测试程序
  7. 基于TCP原理,采用Socket通信技术,实现聊天室
  8. php跳过代码,PHP利用continue实现跳过本次循环中剩余代码的注意点
  9. 年前计划之jquery API 重读
  10. python与excel-Python 与 Excel 终于在一起了
  11. 你不知道的 flex 技巧
  12. Oracle数据库存储过程 ,去除给定字符串中重复的字符串
  13. 课程笔记:深度学习与人类语言处理 ——李宏毅,2020 (P5)
  14. 5G 时代真的来了,你准备好了吗?
  15. 【裂缝识别】基于matlab GUI路面裂缝识别(带面板)【含Matlab源码 009期】
  16. Idea搭建SpringCloud(三)------Ribbon实现负载均衡及其自定义算法策略
  17. OPENCV2.4.7+VS2010+海康威视摄像头
  18. nacos指定外网ip
  19. OA实施分析:OA系统选型警惕哪些陷阱
  20. Github清除历史记录的方法

热门文章

  1. 【编程练习】小强去春游
  2. Mac电脑怎样自定义Safari浏览器主页?
  3. Android开发中的日常积累
  4. TOA(tcp option adress)安装
  5. 什么是PV、UV、QPS、TPS等专业术语?
  6. c语言按姓名查询出入信息,请问c语言如何实现按姓名查找?
  7. Android图片转换
  8. 尝试从数学的角度分析三国杀国战的胜率
  9. Eclipse中Android SDK Manager无法打开
  10. 求Geohash编码周围的8个编码