[iyunv@DSN named]# cat blog.com.zone
$TTL 86400
@ IN SOA ns1.blog.com. admin.blog.com. (
2015050101
3D
7H
4D
1D)
IN NS ns1
ns1 IN A 192.168.0.92
www IN A 172.16.190.25
[iyunv@DNS named]# cat phpadmin.com.zone
$TTL 86400
@ IN SOA ns1.phpadmin.com. admin.phpadmin.com. (
2015050101
3D
7H
4D
1D)
IN NS ns1
ns1 IN A 192.168.0.92
www IN A 172.16.190.25
5)启动bind服务
service named start
五、CA服务器配置
1)创建辅助文件
1
2
[iyunv@CA CA]# touch index.txt
[iyunv@CA CA]# echo 01 > serial
2)创建CA私钥
1
2
3
4
5
6
7
[iyunv@CA CA]# (umask 077;openssl genrsa-out private/cakey.pem 2048)
Generating RSA private key, 2048 bit longmodulus
......................+++
..................................................................................+++
e is 65537 (0x10001)
[iyunv@CA CA]# ll private/cakey.pem
-rw------- 1 root root 1679 May 1 20:53 private/cakey.pem
3)创建CA根证书
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[iyunv@CA CA]# openssl req -new -x509 -keyprivate/cakey.pem -out cacert.pem -days3360
You are about to be asked to enterinformation that will be incorporated
into your certificate request.
What you are about to enter is what iscalled a Distinguished Name or a DN.
There are quite a few fields but you canleave some blank
For some fields there will be a defaultvalue,
If you enter '.', the field will be leftblank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BJ
Locality Name (eg, city) [Default City]:BJ
Organization Name (eg, company) [DefaultCompany Ltd]:WuDay
Organizational Unit Name (eg, section)[]:Ops
Common Name (eg, your name or your server'shostname) []:ca.com
Email Address []:admin@ca.com
[iyunv@CA CA]# ll cacert.pem
-rw-r--r-- 1 root root 1350 May 1 20:57 cacert.pem
[iyunv@Web-Server ssl]# openssl req -new-key httpd.key -out httpd.csr -days 3360
You are about to be asked to enterinformation that will be incorporated
into your certificate request.
What you are about to enter is what iscalled a Distinguished Name or a DN.
There are quite a few fields but you canleave some blank
For some fields there will be a defaultvalue,
If you enter '.', the field will be leftblank.
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:BJ
Locality Name (eg, city) [Default City]:BJ
Organization Name (eg, company) [DefaultCompany Ltd]:WuDay
Organizational Unit Name (eg, section)[]:Ops
Common Name (eg, your name or your server'shostname) []:www.phpadmin.com
Email Address []:admin@phpadmin.com
Please enter the following 'extra'attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
4)把证书申请发送给CA服务器
1
2
3
4
5
6
7
[iyunv@Web-Server ssl]# scp httpd.csrroot@192.168.0.197:/tmp
The authenticity of host '192.168.0.197(192.168.0.197)' can't be established.
RSA key fingerprint is2e:bb:a7:50:d4:26:f7:5d:82:46:ad:9f:97:31:4f:82.
Are you sure you want to continueconnecting (yes/no)? yes
Warning: Permanently added '192.168.0.197'(RSA) to the list of known hosts. root@192.168.0.197's password:
httpd.csr 100% 1041 1.0KB/s 00:00
[iyunv@CA CA]# openssl ca -in /tmp/httpd.csr -out /tmp/httpd.crt
Using configuration from/etc/pki/tls/openssl.cnf
Check that the request matches thesignature
Signature ok
Certificate Details:
Serial Number: 1 (0x1)
Validity
Not Before: May 1 14:29:08 2015GMT
Not After : Apr 30 14:29:08 2016 GMT
Subject:
countryName = CN
stateOrProvinceName = BJ
organizationName = WuDay
organizationalUnitName = Ops
commonName = www.phpadmin.com
emailAddress =admin@phpadmin.com
X509v3 extensions:
X509v3 Basic Constraints:
CA:FALSE
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Key Identifier:
D2:9E:1D:5E:9B:FF:9B:F9:21:62:9A:78:CE:57:63:04:14:56:63:0F
X509v3 Authority Key Identifier:
keyid:93:E3:5C:A2:2C:66:DE:BF:53:02:64:64:09:6D:95:D1:4F:92:BF:56
Certificate is to be certified until Apr 3014:29:08 2016 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