Improve subnet check
- Improve check for custom VPN subnets. Ref: 95d9fc4
This commit is contained in:
parent
1dd7835107
commit
a0f2345c3b
@ -147,10 +147,12 @@ check_client_name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_subnets() {
|
check_subnets() {
|
||||||
if [ -n "$VPN_L2TP_NET" ] || [ -n "$VPN_L2TP_LOCAL" ] || [ -n "$VPN_L2TP_POOL" ] \
|
if [ -s /etc/ipsec.conf ] && grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
||||||
|| [ -n "$VPN_XAUTH_NET" ] || [ -n "$VPN_XAUTH_POOL" ]; then
|
L2TP_NET=${VPN_L2TP_NET:-'192.168.42.0/24'}
|
||||||
if grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
XAUTH_NET=${VPN_XAUTH_NET:-'192.168.43.0/24'}
|
||||||
echo "Error: You may only specify custom subnets during initial VPN install." >&2
|
if ! grep -q "$L2TP_NET" /etc/ipsec.conf \
|
||||||
|
|| ! grep -q "$XAUTH_NET" /etc/ipsec.conf; then
|
||||||
|
echo "Error: The custom VPN subnets specified do not match initial install." >&2
|
||||||
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -129,10 +129,12 @@ check_client_name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_subnets() {
|
check_subnets() {
|
||||||
if [ -n "$VPN_L2TP_NET" ] || [ -n "$VPN_L2TP_LOCAL" ] || [ -n "$VPN_L2TP_POOL" ] \
|
if [ -s /etc/ipsec.conf ] && grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
||||||
|| [ -n "$VPN_XAUTH_NET" ] || [ -n "$VPN_XAUTH_POOL" ]; then
|
L2TP_NET=${VPN_L2TP_NET:-'192.168.42.0/24'}
|
||||||
if grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
XAUTH_NET=${VPN_XAUTH_NET:-'192.168.43.0/24'}
|
||||||
echo "Error: You may only specify custom subnets during initial VPN install." >&2
|
if ! grep -q "$L2TP_NET" /etc/ipsec.conf \
|
||||||
|
|| ! grep -q "$XAUTH_NET" /etc/ipsec.conf; then
|
||||||
|
echo "Error: The custom VPN subnets specified do not match initial install." >&2
|
||||||
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -168,10 +168,12 @@ check_client_name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_subnets() {
|
check_subnets() {
|
||||||
if [ -n "$VPN_L2TP_NET" ] || [ -n "$VPN_L2TP_LOCAL" ] || [ -n "$VPN_L2TP_POOL" ] \
|
if [ -s /etc/ipsec.conf ] && grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
||||||
|| [ -n "$VPN_XAUTH_NET" ] || [ -n "$VPN_XAUTH_POOL" ]; then
|
L2TP_NET=${VPN_L2TP_NET:-'192.168.42.0/24'}
|
||||||
if grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
XAUTH_NET=${VPN_XAUTH_NET:-'192.168.43.0/24'}
|
||||||
echo "Error: You may only specify custom subnets during initial VPN install." >&2
|
if ! grep -q "$L2TP_NET" /etc/ipsec.conf \
|
||||||
|
|| ! grep -q "$XAUTH_NET" /etc/ipsec.conf; then
|
||||||
|
echo "Error: The custom VPN subnets specified do not match initial install." >&2
|
||||||
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -166,10 +166,12 @@ check_client_name() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
check_subnets() {
|
check_subnets() {
|
||||||
if [ -n "$VPN_L2TP_NET" ] || [ -n "$VPN_L2TP_LOCAL" ] || [ -n "$VPN_L2TP_POOL" ] \
|
if [ -s /etc/ipsec.conf ] && grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
||||||
|| [ -n "$VPN_XAUTH_NET" ] || [ -n "$VPN_XAUTH_POOL" ]; then
|
L2TP_NET=${VPN_L2TP_NET:-'192.168.42.0/24'}
|
||||||
if grep -qs "hwdsl2 VPN script" /etc/sysctl.conf; then
|
XAUTH_NET=${VPN_XAUTH_NET:-'192.168.43.0/24'}
|
||||||
echo "Error: You may only specify custom subnets during initial VPN install." >&2
|
if ! grep -q "$L2TP_NET" /etc/ipsec.conf \
|
||||||
|
|| ! grep -q "$XAUTH_NET" /etc/ipsec.conf; then
|
||||||
|
echo "Error: The custom VPN subnets specified do not match initial install." >&2
|
||||||
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
echo " See Advanced usage -> Customize VPN subnets for more information." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user