sh https://blog.kylemanna.com/sharing/gogo-inflight-wireless-with-openvpn/

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh https://blog.kylemanna.com/sharing/gogo-inflight-wireless-with-openvpn/相关的知识,希望对你有一定的参考价值。

#!/bin/bash
#
# Blog post @ https://blog.kylemanna.com/sharing/gogo-inflight-wireless-with-openvpn/
#

# Bail on errors
set -e

SERVER_IP=$(host myip.opendns.com. resolver1.opendns.com | awk '/has address/ { print $4 }')

OVPN_DATA="ovpn-data"

echo "[*] Generating server config for $SERVER_IP"
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_genconfig -u udp://$SERVER_IP:3128
echo "[+] Generated server config for $SERVER_IP"

echo "[*] Initialzing PKI (insecurely) for the truely lazy"
docker run -v $OVPN_DATA:/etc/openvpn --rm -e "EASYRSA_BATCH=1" kylemanna/openvpn ovpn_initpki nopass
echo "[+] Initialized PKI magic"

echo "[*] OpenVPN server starting up"
docker run -v $OVPN_DATA:/etc/openvpn -d -p 3128:1194/udp --cap-add=NET_ADMIN kylemanna/openvpn
echo "[+] OpenVPN server up and running"

CLIENT=client1
echo "[*] Generating client certificate for $CLIENT"
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn easyrsa build-client-full $CLIENT nopass
docker run -v $OVPN_DATA:/etc/openvpn --rm kylemanna/openvpn ovpn_getclient $CLIENT > $CLIENT.ovpn
echo "[*] Client certificate ready at $CLIENT.ovpn"

cat <<EOF
 _______________________________________
< Server up and running, happy surfing  >
 ---------------------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\ 
                ||----w |
                ||     ||
EOF
echo "[?] Copy $CLIENT.ovpn to your client"
echo "[x] Exiting"

以上是关于sh https://blog.kylemanna.com/sharing/gogo-inflight-wireless-with-openvpn/的主要内容,如果未能解决你的问题,请参考以下文章

如何使我的命令行在具有扩展名(.sh)和名称如“weird.sh.sh.sh”的文件上工作

sh sh_template.sh

sh sh.sh

Linux下面如何运行 SH文件

配置告警系统主脚本main.sh mon.sh load.sh 502.sh disk.sh

shell 脚本各种执行方式(source ./*.sh, . ./*.sh, ./*.sh)的区别