Open*** 是一個基於 OpenSSL 庫的應用層 *** 實現。和傳統 *** 相比,它的優點是簡單易用。Open***允許參與建立***的單點使用共享金鑰,電子證書,或者用戶名/密碼來進行身份驗證。它大量使用了OpenSSL加密庫中的SSLv3/TLSv1 協議函式庫。Open***能在Solaris、Linux、OpenBSD、FreeBSD、NetBSD、Mac OS X與Windows 2000/XP/Vista上運行,幷包含了許多安全性的功能。它並不是一個基於Web的***軟件,也不與IPsec及其他***軟件包兼容
一:安裝準備
1:檢查是否已經安裝openssl
[root@zcdoit ~]# rpm -qa | grep openssl openssl098e-0.9.8e-17.el6.centos.2.x86_64 openssl-devel-1.0.1e-57.el6.x86_64 openssl-1.0.1e-57.el6.x86_64 #如果沒有安裝則 # yum install -y openssl
二:安裝
1:安裝LZO實時壓縮工具
wget http://www.oberhumer.com/opensource/lzo/download/lzo-2.09.tar.gz tar zxvf lzo-2.09.tar.gz cd lzo-2.09 ./configure make && make install
2:安裝Open***
#國內被牆了,需要掛代理 wget http://swupdate.open***.org/community/releases/open***-2.3.6.tar.gz tar zxvf open***-2.3.6.tar.gz cd open***-2.3.6 ./configure --prefix=/usr/local/open*** --with-lzo-headers=/usr/local/include --with-lzo-lib=/usr/local/lib make && make install
3:安裝密鑰製作工具
[root@zcdoit ~]#yum install easy-rsa #2.36版本不自帶密鑰製作工具,需單獨安裝
三:密鑰製作
#創建/etc/open***目錄,用於存放密鑰 [root@zcdoit ~]mkdir /etc/open*** [root@zcdoit ~]cp /usr/share/easy-rsa -r /etc/open***/
1:生成ca證書
#爲了生成方便先修改vars文件 [root@zcdoit ~]cd /etc/open***/easy-rsa/2.0 [root@zcdoit ~]vim vars #自簽證書,按照自己情況來修改就行,保存退出 export KEY_COUNTRY="US" #國家 export KEY_PROVINCE="CA" #省份 export KEY_CITY="SanFrancisco" #城市 export KEY_ORG="Fort-Funston" #組織 export KEY_EMAIL="[email protected]" #郵箱 export KEY_OU="MyOrganizationalUnit" #部門 #讓配置生效 [root@zcdoit ~]# pwd /etc/open***/easy-rsa/2.0 [root@zcdoit ~]source ./vars NOTE: If you run ./clean-all, I will be doing a rm -rf on /etc/open***/easy-rsa/2.0/keys [root@zcdoit ~] ./clean-all #清除所有的證書相關keys [root@zcdoit ~] ./build-ca #創建新的 ca證書, ca.crt ca.key。 #在生成過程中,只需按回車即可。 [root@zcdoit ~]ll keys/ #生成證書如下: total 12 -rw-r--r-- 1 root root 1700 Oct 10 11:58 ca.crt -rw------- 1 root root 1704 Oct 10 11:58 ca.key -rw-r--r-- 1 root root 0 Oct 10 11:57 index.txt -rw-r--r-- 1 root root 3 Oct 10 11:57 serial
2:生成服務端證書與key文件
[root@zcdoit ~]# ./build-key-server server # ./build-key-server <證書名稱>,根據需要命名 #在生成過程中,只需按回車即可。當選擇[Y/N]時,請輸入"Y"。 [root@zcdoit ~]ll keys/ #生成證書如下: total 48 -rw-r--r-- 1 root root 5436 Oct 10 12:01 01.pem -rw-r--r-- 1 root root 1700 Oct 10 11:58 ca.crt -rw------- 1 root root 1704 Oct 10 11:58 ca.key -rw-r--r-- 1 root root 126 Oct 10 12:01 index.txt -rw-r--r-- 1 root root 21 Oct 10 12:01 index.txt.attr -rw-r--r-- 1 root root 0 Oct 10 11:57 index.txt.old -rw-r--r-- 1 root root 3 Oct 10 12:01 serial -rw-r--r-- 1 root root 3 Oct 10 11:57 serial.old -rw-r--r-- 1 root root 5436 Oct 10 12:01 server.crt -rw-r--r-- 1 root root 1070 Oct 10 12:01 server.csr -rw------- 1 root root 1704 Oct 10 12:01 server.key
3:生成客戶端證書:
[root@zcdoit ~]# ./build-key client # ./build-key <證書名稱>,根據需要命名,一人一證書 #在生成過程中,只需按回車即可。當選擇[Y/N]時,請輸入"Y"。 #也可以使用build-key-pass命令生成客戶端證書, #build-key-pass命令與build-key,區別是build-key-pass加上了密碼保護(客戶端撥號時需要密碼) [root@localhost 2.0]# ll keys/ total 84 -rw-r--r-- 1 root root 5436 Oct 10 12:01 01.pem -rw-r--r-- 1 root root 5318 Oct 10 12:06 02.pem -rw-r--r-- 1 root root 1700 Oct 10 11:58 ca.crt -rw------- 1 root root 1704 Oct 10 11:58 ca.key -rw-r--r-- 1 root root 5318 Oct 10 12:06 client.crt -rw-r--r-- 1 root root 1070 Oct 10 12:06 client.csr -rw------- 1 root root 1704 Oct 10 12:06 client.key -rw-r--r-- 1 root root 252 Oct 10 12:06 index.txt -rw-r--r-- 1 root root 21 Oct 10 12:06 index.txt.attr -rw-r--r-- 1 root root 21 Oct 10 12:01 index.txt.attr.old -rw-r--r-- 1 root root 126 Oct 10 12:01 index.txt.old -rw-r--r-- 1 root root 3 Oct 10 12:06 serial -rw-r--r-- 1 root root 3 Oct 10 12:01 serial.old -rw-r--r-- 1 root root 5436 Oct 10 12:01 server.crt -rw-r--r-- 1 root root 1070 Oct 10 12:01 server.csr -rw------- 1 root root 1704 Oct 10 12:01 server.key
4:生成DH文件
[root@zcdoit ~]# ./build-dh Generating DH parameters, 2048 bit long safe prime, generator 2 This is going to take a long time .....+.......................+........ [root@zcdoit ~]## ll keys/dh* -rw-r--r-- 1 root root 424 Oct 10 12:02 dh2048.pem
5:服務端配置文件修改
#將例子下的server.conf文件複製到/etc/open***中
[root@zcdoit ~]#cp /root/open***-2.3.6/sample/sample-config-files/server.conf /etc/open***/