mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-18 19:00:15 +00:00
Adding Missing CI Scripts
Added CI Scripts to use with Travis ci/cd
This commit is contained in:
parent
26c0cf50cf
commit
4b63a854cb
4 changed files with 83 additions and 0 deletions
16
ciscripts/ci_openvpn.conf
Normal file
16
ciscripts/ci_openvpn.conf
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
IPv4dev=INTERFACE
|
||||||
|
IPv4addr=IPADDRESS
|
||||||
|
IPv4gw=GATEWAY
|
||||||
|
dhcpReserv=0
|
||||||
|
install_user=pi
|
||||||
|
VPN=openvpn
|
||||||
|
pivpnPROTO=udp
|
||||||
|
pivpnPORT=1194
|
||||||
|
pivpnDNS1=9.9.9.9
|
||||||
|
pivpnDNS2=149.112.112.112
|
||||||
|
pivpnHOST=pivpn.test
|
||||||
|
pivpnENCRYPT=256
|
||||||
|
pivpnSEARCHDOMAIN=pivpn.test
|
||||||
|
TWO_POINT_FOUR=2POINT4
|
||||||
|
USE_PREDEFINED_DH_PARAM=1
|
||||||
|
UNATTUPG=1
|
11
ciscripts/ci_wireguard.conf
Normal file
11
ciscripts/ci_wireguard.conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
IPv4dev=INTERFACE
|
||||||
|
IPv4addr=IPADDRESS
|
||||||
|
IPv4gw=GATEWAY
|
||||||
|
dhcpReserv=0
|
||||||
|
install_user=pi
|
||||||
|
VPN=wireguard
|
||||||
|
pivpnPORT=51820
|
||||||
|
pivpnDNS1=9.9.9.9
|
||||||
|
pivpnDNS2=149.112.112.112
|
||||||
|
pivpnHOST=pivpn.test
|
||||||
|
UNATTUPG=1
|
47
ciscripts/startup.sh
Normal file
47
ciscripts/startup.sh
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
interface=$(ip -o link | awk '{print $2}' | cut -d':' -f1 | cut -d'@' -f1 | grep -v -w 'lo' | head -1)
|
||||||
|
ipaddress=$(ip addr show "$interface" | grep -o -E "([0-9]{1,3}[\.]){3}[0-9]{1,3}/[0-9]{2}")
|
||||||
|
gateway=$(ip route show | awk '/default/ {print $3}')
|
||||||
|
hostname="pivpn.test"
|
||||||
|
|
||||||
|
common(){
|
||||||
|
sed -i "s/INTERFACE/$interface/g" "$vpnconfig"
|
||||||
|
sed -i "s|IPADDRESS|$ipaddress|g" "$vpnconfig"
|
||||||
|
sed -i "s/GATEWAY/$gateway/g" "$vpnconfig"
|
||||||
|
}
|
||||||
|
|
||||||
|
openvpn(){
|
||||||
|
vpnconfig="ciscripts/ci_openvpn.conf"
|
||||||
|
twofour=1
|
||||||
|
common
|
||||||
|
sed -i "s/2POINT4/$twofour/g" "$vpnconfig"
|
||||||
|
cat $vpnconfig
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
wireguard(){
|
||||||
|
vpnconfig="ciscripts/ci_wireguard.conf"
|
||||||
|
common
|
||||||
|
cat $vpnconfig
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -lt 1 ]; then
|
||||||
|
echo "specifiy a VPN protocol to prepare"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
chmod +x auto_install/install.sh
|
||||||
|
sudo hostnamectl set-hostname $hostname
|
||||||
|
cat /etc/os-release
|
||||||
|
while true; do
|
||||||
|
case "$1" in
|
||||||
|
-o | --openvpn ) openvpn
|
||||||
|
;;
|
||||||
|
-w | --wireguard ) wireguard
|
||||||
|
;;
|
||||||
|
* ) echo "unknown vpn protocol"; exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
9
ciscripts/test.sh
Normal file
9
ciscripts/test.sh
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
systemctl status openvpn
|
||||||
|
pivpn add -n foo
|
||||||
|
pivpn -qr foo
|
||||||
|
pivpn -bk
|
||||||
|
pivpn -l
|
||||||
|
pivpn -c
|
||||||
|
pivpn -r foo -y
|
Loading…
Reference in a new issue