Open Ch-msm opened 3 years ago
mkdir -p vpn/data && cd vpn
docker pull kylemanna/openvpn
#! /bin/sh docker rm -f vpn #生成配置文件 docker run -v ${PWD}/data:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://59.172.62.186 #生成密钥文件 docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn ovpn_initpki #生成客户端证书 docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full whsir nopass #导出客户端配置 docker run -v ${PWD}/data:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient whsir > ${PWD}/data/conf/whsir.ovpn
#! /bin/sh docker rm -f vpn docker run --name vpn \ --restart=always \ -v ${PWD}/data:/etc/openvpn \ -d -p 1194:1194/udp \ --cap-add=NET_ADMIN kylemanna/openvpn
#!/bin/bash read -p "新建用户名称: " NAME docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn easyrsa build-client-full $NAME nopass docker run -v ${PWD}/data:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient $NAME > ${PWD}/data/conf/"$NAME".ovpn docker restart vpn
#!/bin/bash read -p "删除用户: " DNAME docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn easyrsa revoke $DNAME docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn easyrsa gen-crl docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn rm -f /etc/openvpn/pki/reqs/"$DNAME".req docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn rm -f /etc/openvpn/pki/private/"$DNAME".key docker run -v ${PWD}/data:/etc/openvpn --rm -it kylemanna/openvpn rm -f /etc/openvpn/pki/issued/"$DNAME".crt docker restart vpn
docker容器版安装openvpn
补充说明