- 浏览: 1608229 次
- 性别:
- 来自: 厦门
文章分类
- 全部博客 (603)
- T_java (145)
- T_script&ASP (51)
- T_C/C++ (25)
- T_PowerBuilder (11)
- T_Database (53)
- T_odoo (7)
- T_应用服务器 (50)
- T_专_条形码 (6)
- T_专_负载均衡器 (4)
- T_操作系统 (94)
- T_信息安全 (41)
- T_专_搜索引擎 (14)
- T_L_PHP (58)
- T_L_Delphi (18)
- T_L_.NET、C#、VisualStudio (25)
- T_L_Objective-C (6)
- T_移动开发 (53)
- T_网络 (109)
- T_大数据 (2)
- T_嵌入式 (2)
- T_小众技术 (24)
- T_未分类 (58)
- L_旅游印记 (1)
- L_生活随笔 (48)
- L_中国文化 (18)
- L_户外与生存 (0)
最新评论
-
csbean4004:
不知道哪传来得恶习,发帖子不好好发,故意弄错一些东西,很讨厌
让HTML5支持后置摄像头 -
withthewind:
终于找到一个可以用的了。。。
如何用VBA取得Word文档中的标题前面的序号 -
busbby:
兄弟,无法下载,说文件不完整
一个好用的Outlook ost格式文件转pst文件的工具 -
yijavakevin:
密码啊~解压密码多少?
一个二维条形码组件 -
vipbooks:
你给的那个链接根本无法下载,跳到官网看了下最新版12M,但点下 ...
十步以内完成精细web打印
How to create an intermediate Certificate Authority (CA) using openssl
(怎样用OpenSSL来签发一个中级证书)
What is an Intermediate Certificate Authority (CA) and why do I need one? An Intermediate CA is an authority that you use to create your own SSL certificates in a PKI environment. An Intermediate CA depends on a Root CA that is the origin of the chain of trust. The idea is that if your Intermediate CA gets compromised or you decide to revocate all the certificates issued by it, you can still use your Root CA without further inconvenience for your users (the users only need to have installed the certificate of the Root CA in their browsers).
As for the second question, the sort answer is that chances are that you really do not need one but for the shake of the experiment lets get our hands dirty!
First of all, I need to clarify that my interest in this topic was also risen by the fact that Verisign has switched to a two-tier hierarchy of Certificate Authorities, and this has some implications specially in the configuration of web server software:
“As of April 2006, all SSL certificates issued by VeriSign require the installation of an Intermediate CA Certificate. The SSL certificates are signed by an Intermediate CA using a two-tier hierarchy (also known as trust chain) which enhances the security of your SSL Certificate. If the proper Intermediate CA is not installed on the server, your customers will see browser errors and may choose not to proceed further and close their browser.” (boldface is mine)
This means that while the users do not need to modify anything (if their browser already has Verisigns Root CA certificate) the server owners need to ensure that the server is able to provide the so called trust chain to the users’ browser when the SSL handshake is performed.
Never mind, lets get back to it. In order to get your Intermediate CA working, first you need a Root CA (if you already have a CA, feel free to skip the next section). Remember that in order to get this working you need to have a copy of the openssl toolkit installed in your system.
1. Configure the Root CA
mkdir /var/ca
cd /var/ca/
mkdir certs crl newcerts private
echo "01" > serial
cp /dev/null index.txt
# beware that the location of the sample file is dependent on your environment
cp /usr/lib/ssl/openssl.cnf ./
You may want to modify some of the settings in the configuration file to save you some time in the future when creating the certificates: default_bits, countryName, stateOrProvinceName, 0.organizationName_default, organizationalUnitName and emailAddress.
Now you are ready to create the CA:
# generate a private key
openssl genrsa -des3 -out private/cakey.key 4096
# create a self-signed certificate valid for 5 years
openssl req -new -x509 -nodes -sha1 -days 1825 -key private/cakey.pem -out cacert.pem
# go for the default values if you adapted the settings in the openssl.cnf file or enter the values you desire
Now you have everything you need to run a successful CA.
2. Configure an Intermediate CA
The idea is simple, we will create a new CA following the same template that we used in the previous section, but this time instead of generating a self-signed certificate we will generate a certificate sign request that we will sign using the Root CA.
First we create the folder structure:
cd /var/ca/
mkdir ca2008
cd ca2008
cp ../openssl.cnf ./
mkdir certs crl newcerts private
echo "01" > serial
cp /dev/null index.txt
Then the Intermediate CA private key:
#generate the key
openssl genrsa -des3 -out private/cakey.pem 4096
#generate a signing request (valid for 1year)
openssl req -new -sha1 -key private/cakey.pem -out ca2008.csr
# go for the default values if you adapted the settings in the openssl.cnf file or enter the values you desire
Move the sign request to the Root CA directory and sign it:
mv ca2008.csr ../
cd ../
openssl ca -extensions v3_ca -days 365 -out ca2008.crt -in ca2008.csr -config openssl.cnf
mv ca2008.* ca2008/
cd ca2008/
mv ca2008.crt cacert.pem
And that was it. The next thing to do is start using your Intermediate CA to sign your new certificates. But just before that, remember that to verify a certificate signed by an Intermediate CA the web browser has to verify both the certificate against the Intermediate CA and the certificate of the Intermediate CA against a Root CA.
In order to allow the browser to do this, a certificate chain file needs to be installed in the server. A certificate chain is a plaintext file that contains all the certificates from the Authority issuing a given certificate up to the Root of the certificate tree. In this case our chain has only two levels and the chain file is created like this:-
# first the intermediate CA certificate
cat cacert.pem > chain.crt
# then the Root CA cert
cat ../cacert.pem >> chain.crt
This file is the one you need to specify in the SSLCertificateChainFile of your server.
3. Create a new server certificate
# make sure you are in the Intermediate CA folder and not in the Root CA one
cd /var/ca/ca2008/
# create the private key
openssl genrsa -des3 -out {server_name}.key 4096
# generate a certificate sign request
openssl req -new -key {server_name}.key -out {server_name}.csr
# sign the request with the Intermediate CA
openssl ca -config openssl.cnf -policy policy_anything -out {server_name}.crt -infiles {server_name}.csr
# and store the server files in the certs/ directory
mkdir certs/{server_name}
mv {server_name}.key {server_name}.csr {server_name}.crt certs/
Then you should securely copy the .key and .crt files to the server and configure it to use them.
4. Apache server configuration
Just in case you are using Apache server and for the shake of completeness, these are the settings that you need to modify (possibly in your extra/http-ssl.conf):-
SSLCertificateFile /var/ca/ca2008/certs/{server_name}.crt
SSLCertificateKeyFile /var/ca/ca2008/certs/{server_name}.key
SSLCertificateChainFile /var/ca/ca2008/chain.crt
5. References
SSL/TLS Strong Encryption: FAQ (http://httpd.apache.org/docs/2.0/ssl/ssl_faq.html)
Creating Your Own CA (http://www.onlamp.com/pub/a/onlamp/2003/02/06/linuxhacks.html)
Be your own Certificate Authority (http://www.g-loaded.eu/2005/11/10/be-your-own-ca/)
Very brief introduction to create a CA and a CERT (http://www.sendmail.org/~ca/email/other/cagreg.html)
发表评论
-
安卓动态分析工具 Inspeckage
2017-08-07 08:46 0工具介绍 一个基于Xposed 开发的应用动态分析工具 g ... -
Android逆向之旅---静态方式破解微信获取聊天记录和通讯录信息
2017-08-07 08:37 0一、猜想数据存放路径 微信现在是老少皆宜,大街小巷都在使用 ... -
破解微信数据库 并查询数据上传服务器
2017-08-07 08:29 0由于工作需求破解了微信的数据库 并获取想要的信息上传服 ... -
安卓黑科技之HOOK详解
2017-08-07 08:21 0本文带大家进入到安卓另一个世界 互联网攻防大战 Xpos ... -
安卓逆向之基于Xposed-ZjDroid脱壳
2017-08-07 08:18 0前言 之前介绍了普通常见的反编译模式 但对于使用了 360 ... -
Windown下最简安装nodejs和npm
2016-06-20 21:03 683Windown下最简安装nodejs和npm 一、下 ... -
另一个穿透内网的工具(类似ngrok)
2016-06-20 20:26 4830前段时间介绍过两种把内网端口映射到公网的工具:ngrok ... -
Docker无法拉取镜像的一个解决办法
2016-06-16 12:47 14126在阿里云ECS上安装了docker,安装完成后,运行hell ... -
基于 HTTP/2 的 WEB 内网穿透实现(转)
2016-04-22 15:50 1495基于 HTTP/2 的 WEB 内网穿透实现 HTTP ... -
搭建自己的ngrok服务(转)
2016-04-22 15:42 893搭建自己的ngrok服务 在国内开发、企业号 ... -
一个把内网端口映射到外网的工具ngrok(类似与花生壳)
2016-04-22 14:35 1407Secure tunnels to localhost ... -
申请Let's encrypt的免费SSL证书的正确姿势(转)
2016-03-30 19:16 1380申请Let's encrypt的免费SS ... -
通过 HTTP 头进行 SQL 注入(转)
2015-12-11 10:10 3255在漏洞评估和渗透测试中,确定目标应用程序的输入向量是 ... -
使用AXIOM给WebService调用增加SOAP头
2015-05-19 10:17 1153直接上代码 public static void ... -
如何为WordPress做安全防护? (转)
2014-12-18 09:38 1190最近看了infosec 出品的《Protecting Wo ... -
总结下在离开教育网后公网各种接入IPV6的方法(转)
2014-11-18 09:28 7472A.直连大法 方法1 ADSL ... -
Win7使用teredo连接IPv6的方法(转)
2014-11-18 09:27 0(1) 在 ” 开始 ”->” 运行 ” 中输入 c ... -
记录一个开源的PHP代码加密模块
2014-06-24 15:54 1057https://github.com/liexusong/ph ... -
Axis2管理控制台登录用户
2014-05-16 14:38 2126Axis2在Tomcat上装好后,可以通过其自带的管理界面进 ... -
weblogic server支持P3P协议
2013-10-16 19:34 808weblogic 支持P3P 隐私协议 来源:http:/ ...
相关推荐
2. 生成证书请求:使用`openssl req`命令创建一个证书签名请求(CSR),包含公共信息和公钥。 3. 签发证书:如果作为CA,可以使用`openssl x509`命令对CSR进行签名,生成证书。 4. 非自签名:若不是CA,可以将CSR...
在IT行业中,加密和安全通信是至关重要的环节,OpenSSL是一个强大的安全套接层(SSL)和传输层安全(TLS)协议实现工具包,同时也包含了用于创建数字证书、管理CA(证书颁发机构)以及处理公钥基础设施(PKI)的相关工具。...
在本文中,我们将深入探讨如何使用OpenSSL构建一个简单的CA(Certificate Authority,证书权威机构)模块,这对于理解和实践PKI系统的基础知识非常有帮助。 1. **CA的概念与角色** CA是PKI中的核心组件,它负责...
OpenSSL是一个强大的安全套接字层密码库,包含各种主要的密码算法、常用的密钥和证书封装管理功能以及SSL协议,并提供丰富的应用程序用于测试或其他目的。在网络安全领域,OpenSSL是构建HTTPS和其他基于SSL/TLS协议...
在Windows环境下,OpenSSL通常以静态库和动态库的形式存在,而`OpenSSL.exe`是一个命令行工具,用于执行各种SSL/TLS相关的操作,如生成证书请求(CSR)、签发和管理自签名证书、进行加密解密等。 1. **证书生命周期...
2. 创建证书链:将服务器证书、中级根证书和根证书合并成一个证书链文件,如`cat server.crt intermediate.crt root.crt > chain.pem`。 3. 修改配置文件:在Nginx配置的相应服务器块中,添加SSL相关设置,包括证书...
在实际操作中,可能会使用工具如OpenSSL来生成CSR,或者通过Web界面在CA的平台上完成申请流程。在服务器配置中,如HTTPS,证书需要正确配置到Web服务器软件(如Apache或Nginx),以启用加密通信。 了解并掌握证书...
一旦CA验证了你的信息,他们会签发一个服务器证书。下载这个证书,通常是PEM或DER格式。 3. **关于证书的格式转换** 如果证书不是Apache需要的格式,如PKCS#7或DER,可以使用OpenSSL进行转换: ``` openssl x...
总之,EJBCA提供了一个强大且灵活的平台来管理数字证书。通过理解EJBCA的工作原理和证书生命周期,我们可以有效地保护网络通信的安全。对于IT专业人士来说,掌握EJBCA的使用方法是提升网络安全能力的重要一步。
6. **证书链**:有时证书还包括了中级CA的证书,形成一个完整的信任链。 下面是一个简单的Python代码示例,使用`ssl`库解析证书: ```python import ssl context = ssl.create_default_context() with context....
6. **设置中级CA(可选)**:为了增强安全性和管理效率,可以创建一个或多个中级CA,这些CA由根CA签发,负责签发终端实体证书。 7. **配置证书策略和申请流程**:定义哪些用户或服务可以申请证书,以及申请和审批...
其次,导入证书链中的中级证书和根证书。这一步骤确保了Websphere能够识别并信任所使用的SSL证书。 - **导入命令**:使用`keytool`命令行工具来完成证书的导入工作。例如,导入根证书的命令如下: ``` keytool-...
接下来,使用MMC控制台导入这些中级CA证书到本地计算机的“中级证书颁发机构”存储中。 3. **删除EV根证书**: 如果存在过期或不适用的根证书,例如"VeriSign Class 3 Public Primary Certification Authority - ...
也就是说,直接尝试使用中级 CA 来验证客户端是无法通过的,openssl 会自动的去找中级 CA 的签发者一层层验证上去,直到找到根。 因此,在实际使用的时候,需要注意一下两点: CA 文件中必须同时存在 中级 CA 和 根 ...
如果你使用的是CA签名的证书,还需要将CA的中级证书导入到Tomcat的信任库中,以便服务器能够验证客户端证书。 对于大型企业环境,可能还会涉及到负载均衡和集群,这时候你可能需要配置多个`<Connector>`,并且需要...
可以使用`ssl.create_default_context()`来创建一个默认的验证上下文,并通过`load_verify_locations()`加载CA证书。 4. **自签名证书**:在开发和测试环境中,我们可能会使用自签名证书。这种证书没有经过权威CA的...