User Tools

Site Tools


docs:guide-user:services:vpn:openvpn:automated_pc

Automated script on PC

Creating private key on an embedded device requires a lot of time. You can speed up things creating certificates on your PC.

Install OpenVPN on your PC (it is required to create build the certificate) and then run this script. It will ask you a password to encrypt the private key of client.ovpn. Then you only have to transfer server.conf on your router in /etc/openvpn path and run /etc/init.d/openvpn restart.

URL="https://openwrt.org/_export/code/docs/guide-user/services/vpn/openvpn"
cat << EOF > ovpn.sh
OVPN_DIR="openvpn"
OVPN_PKI="\${OVPN_DIR}/pki"
OVPN_PORT="1194"
OVPN_PROTO="udp"
OVPN_POOL="192.168.8.0 255.255.255.0"
OVPN_DNS="\${OVPN_POOL%.* *}.1"
OVPN_DOMAIN="lan"
FETCHIP_URL="http://v4.ipv6-test.com/api/myip.php"
OVPN_SERV="\$(curl "\${FETCHIP_URL}")"
EASYRSA_URL="https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.6/EasyRSA-unix-v3.0.6.tgz"
if [ ! -f "EasyRSA.tgz" ]
then
wget -O EasyRSA.tgz "\${EASYRSA_URL}"
tar -z -x -f EasyRSA.tgz
fi
alias easyrsa="EasyRSA-v3.0.6/easyrsa"
$(curl "${URL}/server?codeblock=1")
$(curl "${URL}/server?codeblock=3" \
| sed -e "/^\/etc\/init\.d\//d")
ls \${OVPN_DIR}/*.conf
EOF
sh ovpn.sh
This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/guide-user/services/vpn/openvpn/automated_pc.txt · Last modified: 2020/11/09 05:46 by vgaetera