本文将以目前最新的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服务器

试验拓扑环境如下:

blob.png

安装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包

blob.png

[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 <maxk@qualcomm.com>
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

blob.png

接着,我们依次执行如下命令:

#跳转到解压后的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

执行结果如下图所示

blob.png

接着,我们将上图中所标注的easy-rsa-release-2.x/easy-rsa文件夹复制到Open×××的解压目录中,命令如下

#复制解压后的easy-rsa目录到Open×××解压目录下
cp -r easy-rsa /root/upload/open***-2.3.11/


blob.png

然后,我们执行命令cd /easy-rsa/2.0从而进入Open×××下easy-rsa/2.0

blob.png

这里的文件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 [me@myhost.mydomain]:
[root@server1 2.0]# ls keys/
ca.crt  ca.key  index.txt  serial
[root@server1 2.0]#


blob.png

到这里,我们的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 [me@myhost.mydomain]:

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:'me@myhost.mydomain'
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 [me@myhost.mydomain]:

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:'me@myhost.mydomain'
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所需的文件。


blob.png

编写配置文件

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.confclient.conf,并且配置文件中的每个配置选项均有详细的英文说明(配置文件中"#"或";"开头的均为注释内容)。

blob.png

现在,我们先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]#


blob.png

然后在XP客户端上安装Open×××客户端,安装的路径在C:\Program Files\Open×××\下面,并在config目录下新建keys-test目录用来存放密钥

将client.conf文件下载C:\Program Files\Open×××\config目录下并改文件后缀为client.o***

修改client.o***配置文件

blob.png

blob.png

启动×××客户端,发现×××小图标变成了绿色,并且虚拟网卡获取到了Open×××服务器分配的地址,从客户端上PING Open×××服务器的内网网口地址是通的,至此×××服务已经配置好了,现在离XP客户端打通和LAN服务器的网络还差那么一点点了

blob.png


目前从XP客户端去PINGLAN服务器是不行的。于是分别在Open×××服务器和LAN服务器上利用tcpdump抓包,发现LAN服务器收到了XP客户端发送过来的数据包,但是XP客户端没有收到回包,这说明LAN服务器在回包的时候不知道发给谁因此就丢掉了。

有两种方法可以解决这个问题,一是在LAN服务器上指定网关为Open×××的内网eth1网口地址,二是在Open×××服务器上做SNAT转发

由于第一个方法被LAN服务器造成的影响较大,因此这里选择第二种方法。

blob.png

blob.png

在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


blob.png

####################################################################################

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,密码格式如下:

blob.png

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