本文將以目前最新的open***-2.3.11.tar.gz爲例來介紹如何在Linux系統中安裝、配置及使用Open***
安裝Open***的實驗環境及網絡拓撲
我這裏選用了一臺Redhat6.5 64位系統的計算機作爲Open***服務器,其配置了兩塊網卡,eth1網卡是NAT模式的,eth2網卡是橋接模式的,一臺windows xp 32位系統的計算機作爲Open***客戶端,其網卡是橋接模式的,一臺Redhat6.5 64位系統的計算機作爲LAN服務器,其eth0網卡模式是NAT模式的,三臺服務器均爲VMware Workstation 11.0.0.0 上安裝的操作系統。
實驗的最終目的:Open***客戶端能夠訪問LAN服務器
試驗拓撲環境如下:
安裝Open***的前提條件
支持的操作系統平臺:
Linux (kernel 2.6+),Windows (WinXP 和更高版本)
處理器架構支持:
Intel x86, Alpha, Sparc, Amd64, and ARM
必須的驅動和程序支持:
1.TUN 和/或者 TAP 驅動,
2.PAM/PAM-Devel可插拔認證模塊
3.GCC編譯器
可選的但是推薦安裝的:
OpenSSL 加密庫
PolarSSL 加密庫
LZO 實時壓縮庫
首先上傳相關軟件包到Open***服務器上,並升級OpenSSH(此升級過程見我另一篇博文),因爲在升級OpenSSH的過程中gcc,pam-devel事先已經提前安裝好,所以相關的程序只需要安裝lzo-devel
[root@server1 upload]# ls -lt 總用量 26964 -rw-r--r-- 1 root root 56308 7月 10 16:58 lzo-2.03-3.1.el6_5.1.x86_64.rpm -rw-r--r-- 1 root root 12876 7月 10 16:42 lzo-minilzo-2.03-3.1.el6_5.1.x86_64.rpm -rw-r--r-- 1 root root 31784 7月 10 16:36 lzo-devel-2.03-3.1.el6_5.1.x86_64.rpm drwxr-xr-x 7 root root 4096 7月 10 16:03 Update_openssh_v7.2p2_20160602 drwxr-xr-x 2 root root 4096 7月 10 15:56 tmp -rw-r--r-- 1 root root 26193552 7月 10 15:54 Update_openssh_v7.2p2_20160602.zip -rw-r--r-- 1 root root 1249407 7月 10 15:53 open***-2.3.11.tar.gz -rw-r--r-- 1 root root 47071 7月 10 15:53 easy-rsa-release-2.x.zip
因爲我的服務器是不聯網的(現實情況是我平時公司用的也是在內網裏面的),所以我直接去163鏡像站點上直接下載符合我係統版本的RPM包
[root@server1 upload]# rpm -ivh lzo-minilzo-2.03-3.1.el6_5.1.x86_64.rpm Preparing... ########################################### [100%] 1:lzo-minilzo ########################################### [100%] [root@server1 upload]# rpm -ivh lzo-devel-2.03-3.1.el6_5.1.x86_64.rpm error: Failed dependencies: lzo = 2.03-3.1.el6_5.1 is needed by lzo-devel-2.3-3.1.el6_5.1.x86_64 [root@server1 upload]# rpm -qa|grep lzo lzo-minilzo-2.03-3.1.el6_5.1.x86_64 lzo-2.03-3.1.el6.x86_64 [root@server1 upload]# rpm -ivh lzo-devel-2.03-3.1.el6_5.1.x86_64.rpm error: Failed dependencies: lzo = 2.03-3.1.el6_5.1 is needed by lzo-devel-2.03-3.1.el6_5.1.x86_64 [root@server1 upload]# ls easy-rsa-release-2.x.zip lzo-minilzo-2.03-3.1.el6_5.1.x86_64.rpm Update_openssh_v7.2p2_20160602 lzo-2.03-3.1.el6_5.1.x86_64.rpm open***-2.3.11.tar.gz Update_openssh_v7.2p2_20160602.zip lzo-devel-2.03-3.1.el6_5.1.x86_64.rpm tmp [root@server1 upload]# rpm -Uvh lzo-2.03-3.1.el6_5.1.x86_64.rpm Preparing... ########################################### [100%] 1:lzo ########################################### [100%] [root@server1 upload]# rpm -ivh lzo-devel-2.03-3.1.el6_5.1.x86_64.rpm Preparing... ########################################### [100%] 1:lzo-devel ########################################### [100%]
確認內核是否支持tun/tap(tun表示虛擬的是點對點設備,tap表示虛擬的是以太網設備,這兩種設備針對網絡包實施不同的封裝)
[root@server1 upload]# modinfo tun filename: /lib/modules/2.6.32-431.el6.x86_64/kernel/drivers/net/tun.ko alias: char-major-10-200 license: GPL author: (C) 1999-2004 Max Krasnyansky <[email protected]> description: Universal TUN/TAP device driver srcversion: 490B6F6A77D645CFFCDF9D2 depends: vermagic: 2.6.32-431.el6.x86_64 SMP mod_unload modversions
加載內核模塊
[root@server1 upload]# modprobe tun [root@server1 upload]# lsmod|grep tun tun 17095 0 [root@server1 upload]#
讓模塊隨系統加載
##關於系統啓動加載模塊方法有兩種,下面截自/etc/rc.d/rc.sysinit # Load other user-defined modules for file in /etc/sysconfig/modules/*.modules ; do [ -x $file ] && $file done # Load modules (for backward compatibility with VARs) if [ -f /etc/rc.modules ]; then /etc/rc.modules fi [root@server1 upload]#echo "modprobe tun" >> /etc/rc.modules ##/etc/rc.modules配置文件還要給一個可執行權限(重要) [root@server1 ~]# ls -lt /etc/rc.modules -rw-r--r-- 1 root root 13 7月 11 05:56 /etc/rc.modules [root@server1 ~]# chmod u+x /etc/rc.modules [root@server1 ~]# ls -lt /etc/rc.modules -rwxr--r-- 1 root root 13 7月 11 05:56 /etc/rc.modules
啓用路由轉發功能
[root@server1 upload]# echo 1 > /proc/sys/net/ipv4/ip_forward [root@server1 upload]# sed -i '/net.ipv4.ip_forward/s/0/1/' /etc/sysctl.conf [root@server1 upload]# sysctl -p net.ipv4.ip_forward = 1 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 error: "net.bridge.bridge-nf-call-ip6tables" is an unknown key error: "net.bridge.bridge-nf-call-iptables" is an unknown key error: "net.bridge.bridge-nf-call-arptables" is an unknown key kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 [root@server1 upload]#
接着,我們使用tar
命令,將該壓縮文件解壓到當前目錄,完整命令爲:tar zxf open***-2.3.11.tar.gz
接着,我們依次執行如下命令:
#跳轉到解壓後的open***目錄 cd open***-2.3.11 #調用configure ./configure --prefix=/usr/local/open***2.3.11 LDFLAGS="-L/usr/local/ssl/lib" #編譯 make #安裝 make install
Open***配置
安裝Open***完畢後,接下來就應該配置Open***,以便於其能正常工作。配置Open***主要有兩個步驟:
一是生成服務器和客戶端所需的各種證書
二是編寫服務器和客戶端所需的配置文件
下載easy-rsa
想要生成各種證書和密鑰,我們還要用到easy-rsa(只有服務器端需要easy-rsa,客戶端無需安裝)。Open*** 2.3.x並沒有自帶這個東西,我們還需要去GitHub下載easy-rsa (https://github.com/Open***/easy-rsa)
#轉到easy-rsa安裝文件所在目錄 cd /root/upload/ #解壓該安裝文件 unzip -q easy-rsa-release-2.x.zip
執行結果如下圖所示
接着,我們將上圖中所標註的easy-rsa-release-2.x/easy-rsa文件夾複製到Open***的解壓目錄中,命令如下
#複製解壓後的easy-rsa目錄到Open***解壓目錄下 cp -r easy-rsa /root/upload/open***-2.3.11/
然後,我們執行命令cd /easy-rsa/2.0
從而進入Open***下的easy-rsa/2.0目錄
這裏的文件夾2.0就是我們以後生成各種證書和密鑰的根據地了
使用easy-rsa生成CA證書
在生成證書之前,我們建議你對2.0目錄中的vars文件稍作修改。vars文件存儲的是一些用戶變量設置信息,每次生成證書都會使用到其中的某些變量。如下圖所示,我們着重建議你關注紅色矩形框內的變量,並選擇性地對其進行修改(你可以不修改這些參數,但不要把這些參數留空)。
** KEY_SIZE 密鑰的長度默認是2048,我這裏改成了1024減小性能耗費
KEY_SIZE:表示密鑰的長度,一般爲1024或2048(長度越長,性能耗費越多)。 #下面是一些用戶相關信息配置 KEY_COUNTRY:所在國家 KEY_PROVINCE:所在省 KEY_CITY:所在城市 KEY_ORG:所在組織 KEY_EMAIL:郵箱地址 KEY_OU:機構單位或部門名稱
[root@server1 2.0]# grep "KEY_SIZE" vars export KEY_SIZE=1024 [root@server1 2.0]#
下面,我們就開始來生成證書了。保持當前目錄爲Open***根目錄/easy-rsa/2.0。然後依次執行下列命令
#初始化命令,用於設置後續命令所需的相關變量信息 . ./vars #清除之前創建的所有證書和密鑰 ./clean-all #生成CA證書和密鑰 ./build-ca
注意:證書的用戶信息可以根據需要自行輸入。如果不輸入、直接回車,則表示該字段使用"[]"中的默認值(也就是前面vars文件中設置的參數值);如果輸入".",則表示該字段留空。在這裏需要注意Common Name字段,這相當於證書的"用戶名",請確保每個證書的Common Name字段是唯一的。
[root@server1 2.0]# . ./vars NOTE: If you run ./clean-all, I will be doing a rm -rf on /root/upload/open***-2.3.11/easy-rsa/2.0/keys [root@server1 2.0]# ./clean-all [root@server1 2.0]# ./build-ca Generating a 2048 bit RSA private key .....................................................................................+++ ...........................................................................+++ writing new private key to '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) [US]:CN State or Province Name (full name) [California]:SH Locality Name (eg, city) [SanFrancisco]:Shanghai Organization Name (eg, company) [Fort-Funston]:eastcom Organizational Unit Name (eg, section) [MyOrganizationalUnit]:eastcom_admin Common Name (eg, your name or your server's hostname) [Fort-Funston CA]:server1 Name [EasyRSA]: Email Address [[email protected]]: [root@server1 2.0]# ls keys/ ca.crt ca.key index.txt serial [root@server1 2.0]#
到這裏,我們的CA證書和密鑰就已經生成成功了,生成的證書和密碼默認均存放在當前目錄的子文件夾keys中.
接下來,我們爲服務器和客戶端生成各自所需的證書和密鑰(所有的證書和密鑰都必須由Open***服務器上的easy-rsa生成)
我們可以執行命令./build-key-server server
來生成服務器端所需的證書和密鑰。如下圖所示,與創建CA證書一樣,我們先輸入證書的相關信息,並在最後輸入兩次"y"確認生成即可
[root@server1 2.0]# ./build-key-server server Generating a 2048 bit RSA private key .....................................................................................+++ ..+++ writing new private key to '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) [US]:CN State or Province Name (full name) [California]:SH Locality Name (eg, city) [SanFrancisco]:Shanghai Organization Name (eg, company) [Fort-Funston]:eastcom Organizational Unit Name (eg, section) [MyOrganizationalUnit]:eastcom_admin Common Name (eg, your name or your server's hostname) [server]:server Name [EasyRSA]: Email Address [[email protected]]: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:redhat An optional company name []:eastcom Using configuration from /root/upload/open***-2.3.11/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:'SH' localityName :PRINTABLE:'Shanghai' organizationName :PRINTABLE:'eastcom' organizationalUnitName:T61STRING:'eastcom_admin' commonName :PRINTABLE:'server' name :PRINTABLE:'EasyRSA' emailAddress :IA5STRING:'[email protected]' Certificate is to be certified until Jul 9 00:30:51 2026 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 [root@server1 2.0]#
生成客戶端證書
與創建服務器端證書類似,我們可以使用命令./build-key clientName來生成客戶端證書和密鑰,其中clientName爲自定義的客戶端名稱(例如:client1、client2、jim、tom)。如果需要爲多個客戶端生成證書,只需要分別執行多次即可。
[root@server1 2.0]# ./build-key client Generating a 2048 bit RSA private key ................................................+++ .....................................................................................................................+++ writing new private key to 'client.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) [US]:CN State or Province Name (full name) [California]:SH Locality Name (eg, city) [SanFrancisco]:Shanghai Organization Name (eg, company) [Fort-Funston]:eastcom Organizational Unit Name (eg, section) [MyOrganizationalUnit]:eastcom_admin Common Name (eg, your name or your server's hostname) [client]:client Name [EasyRSA]: Email Address [[email protected]]: Please enter the following 'extra' attributes to be sent with your certificate request A challenge password []:redhat An optional company name []:eastcom Using configuration from /root/upload/open***-2.3.11/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:'SH' localityName :PRINTABLE:'Shanghai' organizationName :PRINTABLE:'eastcom' organizationalUnitName:T61STRING:'eastcom_admin' commonName :PRINTABLE:'client' name :PRINTABLE:'EasyRSA' emailAddress :IA5STRING:'[email protected]' Certificate is to be certified until Jul 9 00:37:28 2026 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 [root@server1 2.0]#
生成迪菲·赫爾曼交換密鑰
此外,我們還需要爲Open***的服務器端創建迪菲·赫爾曼交換密鑰,命令爲./build-dh
(無需額外輸入,耐心等待生成完畢即可)。迪菲·赫爾曼交換密鑰是一種安全協議,用以對數據進行加密,迪菲·赫爾曼交換密鑰默認使用2048字節長度,雖然安全,但是影響數據傳輸效率,我這裏選擇使用1024大小的密鑰。
[root@server1 2.0]# ./build-dh Generating DH parameters, 1024 bit long safe prime, generator 2 This is going to take a long time ...............+..+...+....................+..............................................................+.............+................+ .....+.................................................................................................................................... ......................+...........................................................................+....................................... ........+....................................+............................................................................................ ............................................................................................+............+......................+......... ...................................+....................+.........................................++*++*++*
生成TLS-auth密鑰
這一步驟是可選操作。Open***提供了TLS-auth功能,可以用來抵禦Dos、UDP端口淹沒***。出於安全考慮,你可以啓用該功能;啓用該功能,你需要執行命令open*** --genkey --secret keys/ta.key
來生成TLS-auth所需的密鑰文件。
到這裏,我們的證書生成就告一段落了。如果你以後想要生成新的客戶端或執行其他操作,只需要先執行命令. ./vars
,然後執行相應的命令即可,例如./build-key client2
。
最後,我們來看看我們一共生成了哪些證書和密鑰。
編號①:CA證書和密鑰 編號②:客戶端client1的證書和密鑰, 編號③:迪菲·赫爾曼交換密鑰 (如果你的KEY_SIZE=1024,則該文件名稱爲dh1024.pem)。 編號④:服務器端證書和密鑰。 編號⑤:啓用tls-auth所需的文件。
編寫配置文件
Open***雖然可以分爲客戶端和服務器,不過它們的安裝程序是完全一樣的,只是通過不同的證書和配置文件來進行區分。在這裏,我們先在Open***主目錄下創建一個config目錄,並將其所需的證書和密鑰文件拷貝到該目錄中。
其中,服務器端需要用到的文件有:
ca.crt ca.key dh2048.pem (如果最初的變量KEY_SIZE設爲1024,這裏就是dh1024.pem) server.crt server.key ta.key (如果不開啓tls-auth,則無需該文件)
客戶端client1需要用到的文件有:
ca.crt client1.crt client1.key (名稱client1根據個人設置可能有所不同) ta.key (如果不開啓tls-auth,則無需該文件)
在這裏,我們以Open***服務器端爲例來演示上述操作流程。
#創建config目錄 mkdir /usr/local/open***2.3.11/config #複製證書和密鑰文件到config目錄 cp keys/ca.crt keys/ca.key keys/server.crt keys/server.key keys/dh1024.pem keys/ta.key /usr/local/open***2.3.11/config/
此外,我們還需要爲服務器和每個客戶端的config目錄分別編寫一個配置文件,服務器端的配置文件爲server.conf,客戶端的配置文件爲client.conf。
這兩個配置文件該如何編寫呢?Open***已經在sample/sample-config-files子目錄中爲我們提供了相關的示例文件server.conf和client.conf,並且配置文件中的每個配置選項均有詳細的英文說明(配置文件中"#"或";"開頭的均爲註釋內容)。
現在,我們先將server.conf文件拷貝到config目錄中,然後再對其進行修改
#轉到simple-config-files目錄 cd /root/upload/open***-2.3.11/sample/sample-config-files/ #複製server.conf到config目錄中 cp server.conf /usr/local/open***2.3.11/config/
在這裏,我們先給出server.conf的詳細配置,並註明每項配置的作用。
;local a.b.c.d #指定監聽的本機IP(因爲有些計算機具備多個IP地址),該命令是可選的,默認監聽所有IP地址。 port 1234 #指定監聽的本機端口號 proto tcp #指定採用的傳輸協議,可以選擇tcp或udp dev tun #指定創建的通信隧道類型,可選tun或tap ca ca.crt #指定CA證書的文件路徑 cert server.crt #指定服務器端的證書文件路徑 key server.key #指定服務器端的私鑰文件路徑 dh dh2048.pem #指定迪菲赫爾曼參數的文件路徑 server 172.16.0 255.255.255.0 #指定虛擬局域網佔用的IP地址段和子網掩碼,此處配置的服務器自身佔用10.0.0.1。 ifconfig-pool-persist ipp.txt #服務器自動給客戶端分配IP後,客戶端下次連接時,仍然採用上次的IP地址(第一次分配的IP保存在ipp.txt中,下一次分配其中保存的IP)。 tls-auth ta.key 0 #開啓TLS-auth,使用ta.key防禦***。服務器端的第二個參數值爲0,客戶端的爲1。 keepalive 10 120 #每10秒ping一次,連接超時時間設爲120秒。 duplicate-cn #同時允許多個相同"Common Name"證書客戶端同時登錄 comp-lzo #開啓***連接壓縮,如果服務器端開啓,客戶端也必須開啓 client-to-client #允許客戶端與客戶端相連接,默認情況下客戶端只能與服務器相連接 persist-key persist-tun #持久化選項可以儘量避免訪問在重啓時由於用戶權限降低而無法訪問的某些資源。 status open***-status.log #指定記錄Open***狀態的日誌文件路徑 verb 3 #指定日誌文件的記錄詳細級別,可選0-9,等級越高日誌內容越詳細
接着是客戶端配置文件client.conf
client #指定當前***是客戶端 dev tun #必須與服務器端的保持一致 proto udp #必須與服務器端的保持一致 remote 192.168.1.106 1194 #指定連接的遠程服務器的實際IP地址和端口號 resolv-retry infinite #斷線自動重新連接,在網絡不穩定的情況下(例如:筆記本電腦無線網絡)非常有用。 nobind #不綁定特定的本地端口號 persist-key persist-tun ca ca.crt #指定CA證書的文件路徑 cert client1.crt #指定當前客戶端的證書文件路徑 key client1.key #指定當前客戶端的私鑰文件路徑 ns-cert-type server #指定採用服務器校驗方式 tls-auth ta.key 1 #如果服務器設置了防禦DoS等***的ta.key,則必須每個客戶端開啓;如果未設置,則註釋掉這一行; comp-lzo #與服務器保持一致 verb 3 #指定日誌文件的記錄詳細級別,可選0-9,等級越高日誌內容越詳細
將客戶端需要的文件通過安全方式傳到客戶端(可以是U盤,或者SFTP等)
[root@server1 network-scripts]# cp /root/upload/open***-2.3.11/sample/sample-config-files/client.conf /home/weihu/ [root@server1 network-scripts]# cd /root/upload/open***-2.3.11/easy-rsa/2.0/keys/ [root@server1 keys]# ls 01.pem ca.crt client.crt client.key index.txt index.txt.attr.old serial server.crt server.key 02.pem ca.key client.csr dh1024.pem index.txt.attr index.txt.old serial.old server.csr ta.key [root@server1 keys]# cp ca.crt client.key client.crt ta.key /home/weihu/ [root@server1 keys]# cd /home/weihu/ [root@server1 weihu]# ls ca.crt client.conf client.crt client.key ta.key [root@server1 weihu]#
然後在XP客戶端上安裝Open***客戶端,安裝的路徑在C:\Program Files\Open***\下面,並在config目錄下新建keys-test目錄用來存放密鑰
將client.conf文件下載C:\Program Files\Open***\config目錄下並改文件後綴爲client.o***
修改client.o***配置文件
啓動***客戶端,發現***小圖標變成了綠色,並且虛擬網卡獲取到了Open***服務器分配的地址,從客戶端上PING Open***服務器的內網網口地址是通的,至此***服務已經配置好了,現在離XP客戶端打通和LAN服務器的網絡還差那麼一點點了
目前從XP客戶端去PINGLAN服務器是不行的。於是分別在Open***服務器和LAN服務器上利用tcpdump抓包,發現LAN服務器收到了XP客戶端發送過來的數據包,但是XP客戶端沒有收到回包,這說明LAN服務器在回包的時候不知道發給誰因此就丟掉了。
有兩種方法可以解決這個問題,一是在LAN服務器上指定網關爲Open***的內網eth1網口地址,二是在Open***服務器上做SNAT轉發
由於第一個方法被LAN服務器造成的影響較大,因此這裏選擇第二種方法。
在Open***服務器上做SNAT轉發,然後在XP服務器上PING LAN服務器IP,如果PING沒通,斷開***後用arp -d 清空下本機ARP緩存,再重連下***應該就可以了。
##清空filter,nat表默認規則 iptables -t nat -F iptables -t nat -X iptables -t nat -Z iptables -F iptables -X iptables -Z ##在nat表上做SNAT轉發 iptables -t nat -A POSTROUTING -s 172.16.0.0/24 -o eth1 -j MASQUERADE
####################################################################################
Open***服務器常用配置
1、基於用戶名/密碼認證登錄
服務器配置文件增加如下配置(/usr/local/open***2.3.11/config/server.conf)
auth-user-pass-verify /usr/local/open***2.3.11/config/checkpsw.sh via-env
username-as-common-name
script-security 3
客戶端配置文件增加如下配置
auth-user-pass pwd.txt
再在配置文件同目錄下新增密碼文件pwd.txt,密碼格式如下:
2、用戶名/密碼和證書同時認證
auth-user-pass-verify /usr/local/open***2.3.11/config/checkpsw.sh via-env
username-as-common-name
;client-cert-not-required ( 此行註釋掉)
script-security 3
3、相同***帳號禁止同時登錄
;duplicate-cn 保持此行在註釋狀態,如果啓用此指令,那麼相同帳號可以無限制同時登錄
##############################################################################################
相關指令講解
auth-user-pass-verify /usr/local/open***2.3.11/config/checkpsw.sh via-env 指定只用的認證腳本
username-as-common-name 使用客戶提供的UserName作爲Common Name
script-security 3 加入腳本處理,如用密碼驗證
--script-security level: Where level can be:
0 -- strictly no calling of external programs
1 -- (default) only call built-ins such as ifconfig
2 -- allow calling of built-ins and scripts
3 -- allow password to be passed to scripts via env