1
0
mirror of synced 2025-02-18 04:53:16 +03:00

Improve version check

- Add check for some Libreswan versions that are not available
- Include Libreswan 3.25 in multiple IPsec/XAuth clients warning
- Cleanup notes
This commit is contained in:
hwdsl2 2018-06-30 00:42:08 -05:00
parent 41ce696f08
commit 145f29b477
2 changed files with 44 additions and 36 deletions

View File

@ -47,6 +47,12 @@ if [ -z "$SWAN_VER" ]; then
exiterr "Libreswan version 'SWAN_VER' not specified." exiterr "Libreswan version 'SWAN_VER' not specified."
fi fi
case "$SWAN_VER" in
3.24|3.2[6-9])
exiterr "Libreswan version $SWAN_VER is not available."
;;
esac
ipsec_ver="$(/usr/local/sbin/ipsec --version 2>/dev/null)" ipsec_ver="$(/usr/local/sbin/ipsec --version 2>/dev/null)"
if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
exiterr "This script requires Libreswan already installed." exiterr "This script requires Libreswan already installed."
@ -89,11 +95,11 @@ Version to be installed: Libreswan $SWAN_VER
EOF EOF
if [ "$SWAN_VER" = "3.23" ]; then if [ "$SWAN_VER" = "3.23" ] || [ "$SWAN_VER" = "3.25" ]; then
cat <<'EOF' cat <<'EOF'
WARNING: Libreswan 3.23 has an issue with connecting multiple IPsec/XAuth WARNING: Libreswan 3.23 and 3.25 have an issue with connecting multiple
VPN clients from behind the same NAT (e.g. home router). IPsec/XAuth VPN clients from behind the same NAT (e.g. home router).
Do not upgrade to 3.23 if your use cases include the above. DO NOT upgrade to 3.23/3.25 if your use cases include the above.
EOF EOF
fi fi
@ -103,14 +109,14 @@ NOTE: Libreswan versions 3.19 and newer require some configuration changes.
This script will make the following changes to your /etc/ipsec.conf: This script will make the following changes to your /etc/ipsec.conf:
Replace this line: Replace this line:
auth=esp auth=esp
with the following: with the following:
phase2=esp phase2=esp
Replace this line: Replace this line:
forceencaps=yes forceencaps=yes
with the following: with the following:
encapsulation=yes encapsulation=yes
Consolidate VPN ciphers for "ike=" and "phase2alg=". Consolidate VPN ciphers for "ike=" and "phase2alg=".
Re-add "MODP1024" to the list of allowed "ike=" ciphers, Re-add "MODP1024" to the list of allowed "ike=" ciphers,
@ -203,12 +209,11 @@ echo
case "$SWAN_VER" in case "$SWAN_VER" in
3.2[3-9]) 3.2[3-9])
cat <<'EOF' cat <<'EOF'
NOTE: Users upgrading to Libreswan 3.23 or newer should edit NOTE: Users upgrading to Libreswan 3.23 or newer should edit "/etc/ipsec.conf" and replace these two lines:
"/etc/ipsec.conf" and replace these two lines: modecfgdns1=DNS_SERVER_1
modecfgdns1=DNS_SERVER_1 modecfgdns2=DNS_SERVER_2
modecfgdns2=DNS_SERVER_2
with a single line like this: with a single line like this:
modecfgdns="DNS_SERVER_1, DNS_SERVER_2" modecfgdns="DNS_SERVER_1, DNS_SERVER_2"
Then run "service ipsec restart". Then run "service ipsec restart".
EOF EOF
@ -217,12 +222,11 @@ esac
if [ "$is_downgrade_to_322" = "1" ]; then if [ "$is_downgrade_to_322" = "1" ]; then
cat <<'EOF' cat <<'EOF'
NOTE: Users downgrading to Libreswan 3.22 should edit NOTE: Users downgrading to Libreswan 3.22 should edit "/etc/ipsec.conf" and replace this line:
"/etc/ipsec.conf" and replace this line: modecfgdns="DNS_SERVER_1, DNS_SERVER_2"
modecfgdns="DNS_SERVER_1, DNS_SERVER_2"
with two lines like this: with two lines like this:
modecfgdns1=DNS_SERVER_1 modecfgdns1=DNS_SERVER_1
modecfgdns2=DNS_SERVER_2 modecfgdns2=DNS_SERVER_2
Then run "service ipsec restart". Then run "service ipsec restart".
EOF EOF

View File

@ -38,6 +38,12 @@ if [ -z "$SWAN_VER" ]; then
exiterr "Libreswan version 'SWAN_VER' not specified." exiterr "Libreswan version 'SWAN_VER' not specified."
fi fi
case "$SWAN_VER" in
3.24|3.2[6-9])
exiterr "Libreswan version $SWAN_VER is not available."
;;
esac
ipsec_ver="$(/usr/local/sbin/ipsec --version 2>/dev/null)" ipsec_ver="$(/usr/local/sbin/ipsec --version 2>/dev/null)"
if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then
exiterr "This script requires Libreswan already installed." exiterr "This script requires Libreswan already installed."
@ -80,11 +86,11 @@ Version to be installed: Libreswan $SWAN_VER
EOF EOF
if [ "$SWAN_VER" = "3.23" ]; then if [ "$SWAN_VER" = "3.23" ] || [ "$SWAN_VER" = "3.25" ]; then
cat <<'EOF' cat <<'EOF'
WARNING: Libreswan 3.23 has an issue with connecting multiple IPsec/XAuth WARNING: Libreswan 3.23 and 3.25 have an issue with connecting multiple
VPN clients from behind the same NAT (e.g. home router). IPsec/XAuth VPN clients from behind the same NAT (e.g. home router).
Do not upgrade to 3.23 if your use cases include the above. DO NOT upgrade to 3.23/3.25 if your use cases include the above.
EOF EOF
fi fi
@ -94,14 +100,14 @@ NOTE: Libreswan versions 3.19 and newer require some configuration changes.
This script will make the following changes to your /etc/ipsec.conf: This script will make the following changes to your /etc/ipsec.conf:
Replace this line: Replace this line:
auth=esp auth=esp
with the following: with the following:
phase2=esp phase2=esp
Replace this line: Replace this line:
forceencaps=yes forceencaps=yes
with the following: with the following:
encapsulation=yes encapsulation=yes
Consolidate VPN ciphers for "ike=" and "phase2alg=". Consolidate VPN ciphers for "ike=" and "phase2alg=".
Re-add "MODP1024" to the list of allowed "ike=" ciphers, Re-add "MODP1024" to the list of allowed "ike=" ciphers,
@ -204,12 +210,11 @@ echo
case "$SWAN_VER" in case "$SWAN_VER" in
3.2[3-9]) 3.2[3-9])
cat <<'EOF' cat <<'EOF'
NOTE: Users upgrading to Libreswan 3.23 or newer should edit NOTE: Users upgrading to Libreswan 3.23 or newer should edit "/etc/ipsec.conf" and replace these two lines:
"/etc/ipsec.conf" and replace these two lines: modecfgdns1=DNS_SERVER_1
modecfgdns1=DNS_SERVER_1 modecfgdns2=DNS_SERVER_2
modecfgdns2=DNS_SERVER_2
with a single line like this: with a single line like this:
modecfgdns="DNS_SERVER_1, DNS_SERVER_2" modecfgdns="DNS_SERVER_1, DNS_SERVER_2"
Then run "service ipsec restart". Then run "service ipsec restart".
EOF EOF
@ -218,12 +223,11 @@ esac
if [ "$is_downgrade_to_322" = "1" ]; then if [ "$is_downgrade_to_322" = "1" ]; then
cat <<'EOF' cat <<'EOF'
NOTE: Users downgrading to Libreswan 3.22 should edit NOTE: Users downgrading to Libreswan 3.22 should edit "/etc/ipsec.conf" and replace this line:
"/etc/ipsec.conf" and replace this line: modecfgdns="DNS_SERVER_1, DNS_SERVER_2"
modecfgdns="DNS_SERVER_1, DNS_SERVER_2"
with two lines like this: with two lines like this:
modecfgdns1=DNS_SERVER_1 modecfgdns1=DNS_SERVER_1
modecfgdns2=DNS_SERVER_2 modecfgdns2=DNS_SERVER_2
Then run "service ipsec restart". Then run "service ipsec restart".
EOF EOF