CentOS下安装配置 OpenVPN Server

  • 内容
  • 评论
  • 相关

OpenVPN 是一个基于 OpenSSL 库的应用层 VPN 实现。和传统 VPN 相比,它的优点是简单易用。

OpenVPN允许参与建立VPN的单点使用共享金钥,电子证书,或者用户名/密码来进行身份验证。它大量使用了OpenSSL加密库中的SSLv3/TLSv1 协议函式库。OpenVPN能在Solaris、Linux、OpenBSD、FreeBSD、NetBSD、Mac OS X与Windows 2000/XP/Vista上运行,并包含了许多安全性的功能。它并不是一个基于Web的VPN软件,也不与IPsec及其他VPN软件包兼容。

OpenVPN2.0后引入了用户名/口令组合的身份验证方式,它可以省略客户端证书,但是仍有一份服务器证书需要被用作加密。 OpenVPN所有的通信都基于一个单一的IP端口,默认且推荐使用UDP协议通讯,同时TCP也被支持。OpenVPN连接能通过大多数的代理服务器,并且能够在NAT的环境中很好地工作。服务端具有向客户端“推送”某些网络配置信息的功能,这些信息包括:IP地址、路由设置等。OpenVPN提供了两种虚拟网络接口:通用Tun/Tap驱动,通过它们,可以建立三层IP隧道,或者虚拟二层以太网,后者可以传送任何类型的二层以太网络数据。传送的数据可通过LZO算法压缩。在选择协议时候,需要注意2个加密隧道之间的网络状况,如有高延迟或者丢包较多的情况下,请选择TCP协议作为底层协议,UDP协议由于存在无连接和重传机制,导致要隧道上层的协议进行重传,效率非常低下。

一、系统软件版本

1、系统:CentOS Linux release 7.2.1611 (Core)

2、OpenVPN:openvpn-2.4.3-1.el7.x86_64

3、 Easy-Rsa:easy-rsa-2.2.2-1.el7.noarch

3、OpenSSL:openssl-1.0.1e-60.el7_3.1.x86_64

二、yum安装OpenVPN

首先从yum安装OpenVPN及证书生成工具Easy-Rsa:

yum install openvpn easy-rsa

从示例配置文件复制一份配置文件到/etc/openvpn

cp /usr/share/doc/openvpn-*/sample/sample-config-files/server.conf /etc/openvpn/server.conf
cp /usr/share/doc/openvpn-*/sample/sample-config-files/server.conf /etc/openvpn/server.conf_bak
cp /usr/share/doc/openvpn-*/sample/sample-config-files/client.conf /etc/openvpn/client.conf_bak

三、使用easy-rsa生成证书及密钥

完成了对于配置文件的修改之后,我们接下来生成keys和certificates。

yum安装完后有关的文件都在/usr/share/easy-rsa/2.0/ 这个目录中。

cd /usr/share/easy-rsa/2.0/
  1. vars脚本, 是用来创建环境变量,设置所需要要的变量的脚本
  2. clean-all脚本,是创建生成ca证书及密钥文件所需要的文件及目录
  3. build-ca脚本, 生成ca证书(交互)
  4. build-dh脚本, 生成Diffie-Hellman文件(交互)
  5. build-key-server脚本, 生成服务器端密钥(交互)
  6. build-key脚本, 生成客户端密钥(交互)
  7. pkitool脚本,直接使用vars的环境变量设置,直接生成证书(非交互)

1、初始化PKI配置

首先需要修改的是vars文件

vim vars

将以下这些值修改成你自己的值:

export KEY_SIZE=2048    //生成密钥的位数
export KEY_COUNTRY="CN"    //你所在国家码,2个字符
export KEY_PROVINCE="GD"    //你所在省份
export KEY_CITY="SHENZHEN"    //你所在城市
export KEY_ORG="CESHI"    //你所在组织
export KEY_EMAIL="admin@ceshi.com"    //你的邮箱地址
export KEY_CN=ceshi    //随意
export KEY_NAME=ceshi    //随意
export KEY_OU=CESHI    //你所在的单位

修改完成之后,执行 source ./vars, 清空目录并生成 Certificate Authority(CA):

source ./vars

2、创建生成ca证书及密钥文件所需要的文件及目录并创建证书

./clean-all
./build-ca

执行完成之后在/usr/share/easy-rsa/2.0/keys目录中产生了CA正式的相关文件。

3、接下来为服务器生成证书及密钥

./build-key-server server

4、再生成Diffie Hellman key exchange文件,这里生成的长度由之前的KEY_SIZE决定:

./build-dh

执行完成会产生dh2048.pem (如果你的KEY_SIZE =1024,这里产生的文件是dh1024.pem)

5、生成TLS-auth密钥,OpenVPN提供了TLS-auth功能,可以用来抵御Dos、UDP端口淹没攻击。

openvpn --genkey --secret keys/ta.key

6、生成证书吊销链文件防止日后有人丢失证书被非法用户接入VPN

./make-crl vpncrl.pem

7、生成客户端证书及密钥

./build-key client

8、生成证书吊销链文件防止日后有人丢失证书被非法用户接入VPN

./make-crl vpncrl.pem
Using configuration from /etc/openvpn/openssl.cnf

8、将7个所需文件复制到OpenVPN配置目录中去:

mkdir /etc/openvpn/keys/
cp  ca.crt server.crt server.key dh2048.pem ta.key client.crt client.key vpncrl.pem /etc/openvpn/keys

四、配置OpenVPN

打开 /etc/openvpn/server.conf 编辑:

vim /etc/openvpn/server.conf

根据需求调整相应的配置项:

#################################################
# Sample OpenVPN 2.0 config file for #
# multi-client server. #
# #
# This file is for the server side #
# of a many-clients <-> one-server #
# OpenVPN configuration. #
# #
# OpenVPN also supports #
# single-machine <-> single-machine #
# configurations (See the Examples page #
# on the web site for more info). #
# #
# This config should work on Windows #
# or Linux/BSD systems. Remember on #
# Windows to quote pathnames and use #
# double backslashes, e.g.: #
# "C:\\Program Files\\OpenVPN\\config\\foo.key" #
# #
# Comments are preceded with '#' or ';' #
#################################################

# Which local IP address should OpenVPN
# listen on? (optional)
;local a.b.c.d    //设置服务器监听地址,默认全部

# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one. You will need to
# open up this port on your firewall.
port 1194     //设置服务器监听端口,默认1194

# TCP or UDP server?
;proto tcp    //设置连接协议,TCP/UDP二选一
proto udp

# "dev tun" will create a routed IP tunnel,
# "dev tap" will create an ethernet tunnel.
# Use "dev tap0" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use "dev-node" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap    //创建的通信隧道类型,可选tun或tap
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one. On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap    //Windows下TAP适配器名称,默认可不启用

# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key). Each client
# and the server must have their own cert and
# key file. The server and all clients will
# use the same ca file.
#
# See the "easy-rsa" directory for a series
# of scripts for generating RSA certificates
# and private keys. Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see "pkcs12" directive in man page).
ca ca.crt    //指定CA证书的文件路径
cert server.crt    //指定服务器端的证书文件路径
key server.key # This file should be kept secret    //指定服务器端的私钥文件路径

# Diffie hellman parameters.
# Generate your own with:
# openssl dhparam -out dh2048.pem 2048
dh dh2048.pem    //指定迪菲赫尔曼参数的文件路径

# Network topology
# Should be subnet (addressing via IP)
# unless Windows clients v2.0.9 and lower have to
# be supported (then net30, i.e. a /30 per client)
# Defaults to net30 (not recommended)
;topology subnet

# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 10.8.0.0 255.255.255.0    //指定虚拟局域网占用的IP地址段和子网掩码,此处配置的服务器自身占用10.0.0.1。

# Maintain a record of client <-> virtual IP address
# associations in this file. If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt    //服务器自动给客户端分配IP后,客户端下次连接时,仍然采用上次的IP地址(第一次分配的IP保存在ipp.txt中,下一次分配其中保存的IP)。

# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface. Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume 10.8.0.4/255.255.255.0. Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients. Leave this line commented
# out unless you are ethernet bridging.
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100    //设置桥接模式下的IP地址

# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses. You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge    //设置服务器模式

# Push routes to the client to allow it
# to reach other private subnets behind
# the server. Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (10.8.0.0/255.255.255.0)
# back to the OpenVPN server.
;push "route 192.168.10.0 255.255.255.0"    //设置需要推送到客户端的路由表
;push "route 192.168.20.0 255.255.255.0"
;push “route remote_host 255.255.255.255 net_gateway”    //设置VPN服务器本身要通过客户端原来的网关访问(取消redirect-gateway def1 bypass-dhcp选项后这项必须开启,否则无法访问OpenVPN服务器)

# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory "ccd" for client-specific
# configuration files (see man page for more info).

# EXAMPLE: Suppose the client
# having the certificate common name "Thelonious"
# also has a small subnet behind his connecting
# machine, such as 192.168.40.128/255.255.255.248.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
# Then create a file ccd/Thelonious with this line:
# iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN. This example will only work
# if you are routing, not bridging, i.e. you are
# using "dev tun" and "server" directives.

# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
# Then add this line to ccd/Thelonious:
# ifconfig-push 10.9.0.1 10.9.0.2

# Suppose that you want to enable different
# firewall access policies for different groups
# of clients. There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
# group, and firewall the TUN/TAP interface
# for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
# modify the firewall in response to access
# from different clients. See man
# page for more info on learn-address script.
;learn-address ./script

# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push "redirect-gateway def1 bypass-dhcp"    //设置默认客户端默认网关

# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses. CAVEAT:
# http://openvpn.net/faq.html#dhcpcaveats
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push "dhcp-option DNS 208.67.222.222"    //设置客户端DNS
;push "dhcp-option DNS 208.67.220.220"

# Uncomment this directive to allow different
# clients to be able to "see" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client     //设置客户端是否可以访问客户端

# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names. This is recommended
# only for testing purposes. For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE "COMMON NAME",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn    //如果客户端都使用相同的证书和密钥连接VPN,一定要打开这个选项,否则每个证书只允许一个人连接VPN

# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120    //每10秒ping一次,连接超时时间设为120秒。

# For extra security beyond that provided
# by SSL/TLS, create an "HMAC firewall"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
# openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
tls-auth ta.key 0 # This file is secret    //开启TLS-auth,使用ta.key防御攻击。服务器端的第二个参数值为0,客户端的为1。

# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
# Note that 2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC    //指定数据对称加密算法

# Enable compression on the VPN link and push the
# option to the client (2.4+ only, for earlier
# versions see below)
;compress lz4-v2
;push "compress lz4-v2"

# For compression compatible with older clients use comp-lzo
# If you enable it here, you must also
# enable it in the client config file.
;comp-lzo    //开启VPN连接压缩,如果服务器端开启,客户端也必须开启

# The maximum number of concurrently connected
# clients we want to allow.
;max-clients 100

# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
;user nobody    //设置运行账户及组
;group nobody

# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key    //持久化选项可以尽量避免访问在重启时由于用户权限降低而无法访问的某些资源。
persist-tun

# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log    //设置启动日志

# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the "\Program Files\OpenVPN\log" directory).
# Use log or log-append to override this default.
# "log" will truncate the log file on OpenVPN startup,
# while "log-append" will append to it. Use one
# or the other (but not both).
;log openvpn.log    //设置运行日志
;log-append openvpn.log

# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3    //设置日志记录级别(0-9)

# Silence repeating messages. At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20    //设置重复消息

# Notify the client that when the server restarts so it
# can automatically reconnect.
explicit-exit-notify 1    //设置断线重连功能

crl-verify /etc/openvpn/keys/vpncrl.pem //用于注销已删除用户的key

# 使用Linux系统账户登录VPN
;plugin /usr/lib64/openvpn/plugins/openvpn-plugin-auth-pam.so login # login为指定使用linux本身认证
;client-cert-not-required #取消证书认证
;username-as-common-name #使用客户提供的UserName作为Common Name

# 使用脚本验证用户名密码登录VPN
;script-security 3 #OpenVPN使用外部程序和脚本的策略级控制
;auth-user-pass-verify /usr/local/openvpn/etc/checkpsw.sh via-env  #设置脚本
;client-cert-not-required #取消证书认证
;username-as-common-name #使用客户提供的UserName作为Common Name

附checkpsw.sh脚本代码

#!/bin/sh 
########################################################### 
# checkpsw.sh (C) 2004 Mathias Sundman <mathias@openvpn.se> 
# 
# This script will authenticate OpenVPN users against 
# a plain text file. The passfile should simply contain 
# one row per user with the username first followed by 
# one or more space(s) or tab(s) and then the password. 
 
PASSFILE="/etc/openvpn/psw-file" 
LOG_FILE="/var/log/openvpn-password.log" 
TIME_STAMP=`date "+%Y-%m-%d %T"` 
 
########################################################### 
 
if [ ! -r "${PASSFILE}" ]; then 
 echo "${TIME_STAMP}: Could not open password file \"${PASSFILE}\" for reading." >> 
 
${LOG_FILE} 
 exit 1 
fi 
 
CORRECT_PASSWORD=`awk '!/^;/&&!/^#/&&$1=="'${username}'"{print $2;exit}' ${PASSFILE}` 
 
if [ "${CORRECT_PASSWORD}" = "" ]; then 
 echo "${TIME_STAMP}: User does not exist: username=\"${username}\", password= 
 
\"${password}\"." >> ${LOG_FILE} 
 exit 1 
fi 
 
if [ "${password}" = "${CORRECT_PASSWORD}" ]; then 
 echo "${TIME_STAMP}: Successful authentication: username=\"${username}\"." >> ${LOG_FILE} 
 exit 0 
fi 
 
echo "${TIME_STAMP}: Incorrect password: username=\"${username}\", password= 
 
\"${password}\"." >> ${LOG_FILE} 
exit 1

准备用户名和密码认证文件,用户名和密码用空格隔开,同时确保openvpn启动用户可读取该文件

vim psw-file
vpnuser 123456 
chmod 775 psw-file 
chown nobody.nobody psw-file

五、调整系统设置并启动OpenVPN Server

1、防火墙配置

在CentOS 7中,iptables防火墙已经被firewalld所取代,需要使用如下方法:

首先启动firewalld

systemctl status firewalld.service

查看有哪些服务已经在列表中允许通过:

firewall-cmd --list-services
dhcpv6-client http https ssh

可以看到已经有了dhcpv6-client, http, https, ssh四项,接下来添加openvpn:

firewall-cmd --permanent --zone=pupublic --add-service openvpn
success

检查一下:

firewall-cmd --list-services
dhcpv6-client http https openvpn ssh

最后添加masquerade:

firewall-cmd --add-masquerade
success
firewall-cmd --permanent --add-masquerade
success

以下命令用于确认masquerade是否添加成功:

firewall-cmd --query-masquerade
yes

2、允许IP转发

在sysctl中开启IP转发

vim /etc/sysctl.conf

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

4.3 启动OpenVPN服务

启动OpenVPN服务器并添加自动启动项:

systemctl start openvpn@server.service
systemctl enable openvpn@server.service

至此服务端搭建完成。

五、OpenVPN客户端配置

1、客户端配置文件

取回之前生成的位于/etc/openvpn/keys中的4个文件:

ca.crt client.crt client.key ta.key

在你的客户端创建文件client.ovpn, 将这4个文件与其放在同一目录中,配置client.ovpn内容如下:

##############################################
# Sample client-side OpenVPN 2.0 config file #
# for connecting to multi-client server. #
# #
# This configuration can be used by multiple #
# clients, however each client should have #
# its own cert and key files. #
# #
# On Windows, you might want to rename this #
# file so it has a .ovpn extension #
##############################################

# Specify that we are a client and that we
# will be pulling certain config file directives
# from the server.
client    //指定当前VPN是客户端

# Use the same setting as you are using on
# the server.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap    //与服务器端的保持一致
dev tun

# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel
# if you have more than one. On XP SP2,
# you may need to disable the firewall
# for the TAP adapter.
;dev-node MyTap  //Windows下TAP适配器名称,默认可不启用

# Are we connecting to a TCP or
# UDP server? Use the same setting as
# on the server.
;proto tcp    //与服务器端的保持一致
proto udp

# The hostname/IP and port of the server.
# You can have multiple remote entries
# to load balance between the servers.
remote my-server-1 1194    //指定连接的远程服务器的地址和端口号,端口号与服务器端的保持一致
;remote my-server-2 1194

# Choose a random host from the remote
# list for load-balancing. Otherwise
# try hosts in the order specified.
;remote-random

# Keep trying indefinitely to resolve the
# host name of the OpenVPN server. Very useful
# on machines which are not permanently connected
# to the internet such as laptops.
resolv-retry infinite    //断线自动重新连接

# Most clients don't need to bind to
# a specific local port number.
nobind    //不绑定特定的本地端口号

# Downgrade privileges after initialization (non-Windows only)
;user nobody
;group nobody

# Try to preserve some state across restarts.
persist-key    //与服务器端的保持一致
persist-tun    //与服务器端的保持一致

# If you are connecting through an
# HTTP proxy to reach the actual OpenVPN
# server, put the proxy server/IP and
# port number here. See the man page
# if your proxy server requires
# authentication.
;http-proxy-retry # retry on connection failures    //指定HTTP代理
;http-proxy [proxy server] [proxy port #] 

# Wireless networks often produce a lot
# of duplicate packets. Set this flag
# to silence duplicate packet warnings.
;mute-replay-warnings

# SSL/TLS parms.
# See the server config file for more
# description. It's best to use
# a separate .crt/.key file pair
# for each client. A single ca
# file can be used for all clients.
ca ca.crt    //指定CA证书的文件路径
cert client.crt    //指定客户端的证书文件路径
key client.key    //指定客户端的私钥文件路径

# Verify server certificate by checking that the
# certicate has the correct key usage set.
# This is an important precaution to protect against
# a potential attack discussed here:
# http://openvpn.net/howto.html#mitm
#
# To use this feature, you will need to generate
# your server certificates with the keyUsage set to
# digitalSignature, keyEncipherment
# and the extendedKeyUsage to
# serverAuth
# EasyRSA can do this for you.
remote-cert-tls server    //指定采用服务器校验方式

# If a tls-auth key is used on the server
# then every client must also have the key.
tls-auth ta.key 1    如果服务器设置了防御DoS等攻击的ta.key,则必须每个客户端开启;如果未设置,则注释掉这一行;

# Select a cryptographic cipher.
# If the cipher option is used on the server
# then you must also specify it here.
# Note that 2.4 client/server will automatically
# negotiate AES-256-GCM in TLS mode.
# See also the ncp-cipher option in the manpage
cipher AES-256-CBC    //指定数据对称加密算法

# Enable compression on the VPN link.
# Don't enable this unless it is also
# enabled in the server config file.
#comp-lzo    //开启VPN连接压缩,与服务器端的保持一致

# Set log file verbosity.
verb 3    //设置日志记录级别(0-9)

# Silence repeating messages
;mute 20    //设置重复消息

# 如服务器上设置了linux系统账户或用户名密码认证则开启
auth-user-pass    //启用用户名密码登陆认证方式

也可将证书集成到客户端配置文件中,易于使用及传输

ca ca.crt  改为:;ca ca.crt
cert client.crt  改为:;cert client.crt
key client.key  改为:;key client.key
tls-auth ta.key 1  改为:;tls-auth ta.key 1

在最后面添加以下内容:
<ca>
ca.crt文件内容
</ca>

key-direction 1
<tls-auth>
ta.key文件内容
</tls-auth>
<cert>
client.crt文件内容
</cert>
<key>
client.key文件内容
</key>

将client.ovpn文件拷贝到程序目录config下。

右键以管理员身份运行openvpn客户端软件(不以管理员运行可以出现连接后也不能访问的情况)稍后在桌面右下角灰色小图标处右击选择connect即可

2、Android

直接使用OpenVPN官方的OpenVPN Connect即可,选择import导入配置文件。

3、Mac OS X

使用第三方的Tunnelblick连接,注意根据你的操作系统版本选择合适的版本。

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注