mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 11:20:15 +00:00
Merge pull request #1279 from DerDanilo/support_setupvars_for_wg_net_and_allowed_ips
Support setupVars for pivpnNET, subnetClass and ALLOWED_IPS via unattended setup
This commit is contained in:
commit
bf7c4593d0
3 changed files with 25 additions and 9 deletions
|
@ -24,7 +24,6 @@ piholeSetupVars="/etc/pihole/setupVars.conf"
|
||||||
dnsmasqConfig="/etc/dnsmasq.d/02-pivpn.conf"
|
dnsmasqConfig="/etc/dnsmasq.d/02-pivpn.conf"
|
||||||
|
|
||||||
dhcpcdFile="/etc/dhcpcd.conf"
|
dhcpcdFile="/etc/dhcpcd.conf"
|
||||||
subnetClass="24"
|
|
||||||
debianOvpnUserGroup="openvpn:openvpn"
|
debianOvpnUserGroup="openvpn:openvpn"
|
||||||
|
|
||||||
######## PKG Vars ########
|
######## PKG Vars ########
|
||||||
|
@ -1067,10 +1066,18 @@ installPiVPN(){
|
||||||
$SUDO mkdir -p /etc/pivpn/
|
$SUDO mkdir -p /etc/pivpn/
|
||||||
askWhichVPN
|
askWhichVPN
|
||||||
|
|
||||||
|
# Allow custom subnetClass via unattend setupVARs file. Use default if not provided.
|
||||||
|
if [ -z "$subnetClass" ]; then
|
||||||
|
subnetClass="24"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "$VPN" = "openvpn" ]; then
|
if [ "$VPN" = "openvpn" ]; then
|
||||||
|
|
||||||
pivpnDEV="tun0"
|
pivpnDEV="tun0"
|
||||||
|
# Allow custom NET via unattend setupVARs file. Use default if not provided.
|
||||||
|
if [ -z "$pivpnNET" ]; then
|
||||||
pivpnNET="10.8.0.0"
|
pivpnNET="10.8.0.0"
|
||||||
|
fi
|
||||||
vpnGw="${pivpnNET/.0.0/.0.1}"
|
vpnGw="${pivpnNET/.0.0/.0.1}"
|
||||||
|
|
||||||
askAboutCustomizing
|
askAboutCustomizing
|
||||||
|
@ -1092,17 +1099,24 @@ installPiVPN(){
|
||||||
# set the protocol here.
|
# set the protocol here.
|
||||||
pivpnPROTO="udp"
|
pivpnPROTO="udp"
|
||||||
pivpnDEV="wg0"
|
pivpnDEV="wg0"
|
||||||
|
# Allow custom NET via unattend setupVARs file. Use default if not provided.
|
||||||
|
if [ -z "$pivpnNET" ]; then
|
||||||
pivpnNET="10.6.0.0"
|
pivpnNET="10.6.0.0"
|
||||||
|
fi
|
||||||
vpnGw="${pivpnNET/.0.0/.0.1}"
|
vpnGw="${pivpnNET/.0.0/.0.1}"
|
||||||
|
# Allow custom allowed IPs via unattend setupVARs file. Use default if not provided.
|
||||||
|
if [ -z "$ALLOWED_IPS" ]; then
|
||||||
|
# Forward all traffic through PiVPN (i.e. full-tunnel), may be modified by
|
||||||
|
# the user after the installation.
|
||||||
|
ALLOWED_IPS="0.0.0.0/0, ::0/0"
|
||||||
|
fi
|
||||||
# The default MTU should be fine for most users but we allow to set a
|
# The default MTU should be fine for most users but we allow to set a
|
||||||
# custom MTU via unattend setupVARs file. Use default if not provided.
|
# custom MTU via unattend setupVARs file. Use default if not provided.
|
||||||
if [ -z "$pivpnMTU" ]; then
|
if [ -z "$pivpnMTU" ]; then
|
||||||
# Using default Wireguard MTU
|
# Using default Wireguard MTU
|
||||||
pivpnMTU="1420"
|
pivpnMTU="1420"
|
||||||
fi
|
fi
|
||||||
# Forward all traffic through PiVPN (i.e. full-tunnel), may be modified by
|
|
||||||
# the user after the installation.
|
|
||||||
ALLOWED_IPS="0.0.0.0/0, ::0/0"
|
|
||||||
CUSTOMIZE=0
|
CUSTOMIZE=0
|
||||||
|
|
||||||
installWireGuard
|
installWireGuard
|
||||||
|
|
|
@ -4,6 +4,8 @@ IPv4gw=192.168.23.1
|
||||||
dhcpReserv=0
|
dhcpReserv=0
|
||||||
install_user=pi
|
install_user=pi
|
||||||
VPN=openvpn
|
VPN=openvpn
|
||||||
|
pivpnNET=10.8.0.0
|
||||||
|
subnetClass=24
|
||||||
pivpnPROTO=udp
|
pivpnPROTO=udp
|
||||||
pivpnPORT=1194
|
pivpnPORT=1194
|
||||||
pivpnDNS1=9.9.9.9
|
pivpnDNS1=9.9.9.9
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
IPv4dev=eth0
|
IPv4dev=eth0
|
||||||
IPv4addr=192.168.23.211/24
|
|
||||||
IPv4gw=192.168.23.1
|
|
||||||
dhcpReserv=0
|
|
||||||
install_user=pi
|
install_user=pi
|
||||||
VPN=wireguard
|
VPN=wireguard
|
||||||
|
pivpnNET=10.6.0.0
|
||||||
|
subnetClass=24
|
||||||
|
ALLOWED_IPS="0.0.0.0/0, ::0/0"
|
||||||
pivpnMTU=1420
|
pivpnMTU=1420
|
||||||
pivpnPORT=51820
|
pivpnPORT=51820
|
||||||
pivpnDNS1=9.9.9.9
|
pivpnDNS1=9.9.9.9
|
||||||
|
|
Loading…
Reference in a new issue