https://hub.docker.com/r/hyr326/openvpn-manager
https://hub.docker.com/r/alekslitvinenk/openvpn
https://hub.docker.com/r/edgd1er/nordvpn-proxy
https://openvpn.net/index.php/open-source/downloads.html
https://hub.docker.com/r/robonuka/openvpn
docker run -d --name vpn --restart=always -p 89:80 -p 1194:1194/udp --cap-add NET_ADMIN --cap-add=SYS_MODULE -v /data/site/docker/env/tools/openvpn/data/:/data/ -v /data/site/docker/env/tools/openvpn/etc/:/etc/openvpn/ -v /lib/modules:/lib/modules --sysctl="net.ipv4.conf.all.src_valid_mark=1" --sysctl="net.ipv4.ip_forward=1" --sysctl="net.ipv6.conf.all.disable_ipv6=1" --sysctl="net.ipv6.conf.default.disable_ipv6=1" -v /etc/localtime:/etc/localtime:ro -e OVPN_ADDR=$(curl -s https://api.ipify.org) hyr326/openvpn-manager:sqlite
http://g.htmltoo.com:89
docker commit -m="update" -a="htmltoo.com" nginx hub.htmltoo.com:5000/tools:vpn
docker push hub.htmltoo.com:5000/tools:vpn
-> http://g.htmltoo.com:89/index.php?installation
vi /data/docker/nginx/openvpn/etc/server.conf
## GENERAL ##
# TCP or UDP, port 1194, tunneling
mode server
proto udp
port 1194
dev tun
## KEY, CERTS AND NETWORK CONFIGURATION ##
# Identity
ca /etc/openvpn/ca.crt
# Public key
cert /etc/openvpn/server.crt
# Private key
key /etc/openvpn/server.key
# Symmetric encryption
dh /etc/openvpn/dh.pem
# Improve security (DDOS, port flooding...)
# 0 for the server, 1 for the client
tls-auth /etc/openvpn/ta.key 0
# Encryption protocol
cipher AES-256-CBC
# Network
# Subnetwork, the server will be the 10.8.0.1 and clients will take the other ips
server 10.254.254.0 255.255.255.0
# 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
# Redirect all IP network traffic originating on client machines to pass through the OpenVPN server
push "redirect-gateway def1 bypass-dhcp"
# Alternatives DNS (FDN)
#push "dhcp-option DNS 80.67.169.12"
#push "dhcp-option DNS 80.67.169.40"
# (aliDNS)
push "dhcp-option DNS 223.5.5.5"
push "dhcp-option DNS 223.6.6.6"
# (Google)
# push "dhcp-option DNS 8.8.8.8"
# push "dhcp-option DNS 8.8.4.4"
# Ping every 10 seconds and if after 120 seconds the client doesn't respond we disconnect
keepalive 10 120
# Regenerate key each 5 hours (disconnect the client)
reneg-sec 18000
## SECURITY ##
# Downgrade privileges of the daemon
user nobody
group nogroup
# Persist keys (because we are nobody, so we couldn't read them again)
persist-key
# Don't close and re open TUN/TAP device
persist-tun
# Enable compression
comp-lzo
# 允许一个账号多终端在线
duplicate-cn
## LOG ##
# Verbosity
# 3/4 for a normal utilisation
verb 3
# Max 20 messages of the same category
mute 20
# Log gile where we put the clients status
status /etc/openvpn/openvpn-status.log
# Log file
log-append /etc/openvpn/openvpn-server.log
# Configuration directory of the clients
client-config-dir /etc/openvpn/ccd
## PASS ##
# Allow running external scripts with password in ENV variables
script-security 3
# Notify the client that when the server restarts so it
# can automatically reconnect.
explicit-exit-notify 1
# Use the authenticated username as the common name, rather than the common name from the client cert
username-as-common-name
# Client certificate is not required
verify-client-cert none
# Use the connection script when a user wants to login
auth-user-pass-verify /etc/openvpn/scripts/login.sh via-env
# Maximum of clients
max-clients 100
# Run this scripts when the client connects/disconnects
client-connect /etc/openvpn/scripts/connect.sh
client-disconnect /etc/openvpn/scripts/disconnect.sh
# ---注意UDP,TCP协议的差异
proto tcp
# can automatically reconnect.
#explicit-exit-notify 1
-默认使用UDP。如果是生产环境的话,建议使用TCP协议
proto tcp
-openvpn有两种运行模式一种是tap模式-桥接模式,一种是tun模式-路由模式。
dev tun
;dev tap
-VPN 网段, 定义openvpn在使用tun路由模式时,分配给client端分配的IP地址段。
server 10.8.0.0 255.255.255.0
-定义openvpn在使用tap桥接模式时,分配给客户端的IP地址段。
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
-开放服务端所在局域网, 向客户端推送的路由信息,
-假如客户端的IP地址为10.8.0.2,要访问192.168.120.0网段的话,使用这条命令就可以了。
push "route 192.168.120.0 255.255.255.0"
-重定向客户端的网关
push “redirect-gateway def1 bypass-dhcp”
-实现客户端互联, 比如有两个客户端, VIP地址分别为10.8.0.6和10.8.0.10
client-to-client
-配置局域网VPN网关转发, 指定客户端IP地址
在ccd目录下创建以客户端命名的文件。
比如要设置客户端gateway100为10.8.0.100这个IP地址,
/etc/openvpn/ccd/gateway100文件中包含如下行即可:
iroute 192.168.100.0 255.255.255.0
比如要设置客户端gateway200为10.8.0.200这个IP地址,
/etc/openvpn/ccd/gateway100文件中包含如下行即可:
ifconfig-push 10.8.0.200 255.255.255.0
# window
https://file.htmltoo.com/tools/soft/src/webmaster/
==================