diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7fd7e20..975981a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -322,6 +322,32 @@ jobs: ipsec status | grep -q xauth-psk ipsec status | grep -q ikev2-cp + if [ "$1" = "centos" ] || [ "$1" = "amazon" ]; then + sed -i '/pluto/d' /var/log/secure + pkill -HUP rsyslog + else + sed -i '/pluto/d' /var/log/auth.log + pkill -HUP rsyslog + fi + + sed -i 's/^SWAN_VER=.*/SWAN_VER=4.3/' vpnupgrade.sh + sh vpnupgrade.sh </dev/null) - swan_ver=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux //' -e 's/Libreswan //' -e 's/ (netkey).*//') + swan_ver=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan //' -e 's/ (netkey).*//' -e 's/^U//' -e 's/\/K.*//') if ( ! grep -qs "hwdsl2 VPN script" /etc/sysctl.conf && ! grep -qs "hwdsl2" /opt/src/run.sh ) \ || ! printf '%s' "$ipsec_ver" | grep -q "Libreswan" \ || [ ! -f /etc/ppp/chap-secrets ] || [ ! -f /etc/ipsec.d/passwd ]; then diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index eb71d26..192cf57 100755 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -14,7 +14,7 @@ # know how you have improved it! # Specify which Libreswan version to install. See: https://libreswan.org -SWAN_VER=4.2 +SWAN_VER=4.3 ### DO NOT edit below this line ### @@ -60,22 +60,21 @@ if [ "$(id -u)" != 0 ]; then fi case $SWAN_VER in - 3.32|4.[12]) - /bin/true + 3.32|4.[123]) + true ;; *) cat 1>&2 </dev/null) -ipsec_ver_short=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan/Libreswan/' -e 's/ (netkey).*//') -swan_ver_old=$(printf '%s' "$ipsec_ver_short" | sed -e 's/Libreswan //') +swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan //' -e 's/ (netkey).*//' -e 's/^U//' -e 's/\/K.*//') if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then cat 1>&2 <<'EOF' Error: This script requires Libreswan already installed. @@ -84,7 +83,7 @@ EOF exit 1 fi -swan_ver_cur=4.2 +swan_ver_cur=4.3 swan_ver_url="https://dl.ls20.com/v1/$os_type/$os_ver/swanverupg?arch=$os_arch&ver1=$swan_ver_old&ver2=$SWAN_VER" swan_ver_latest=$(wget -t 3 -T 15 -qO- "$swan_ver_url") if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$' \ @@ -132,7 +131,7 @@ Welcome! This script will build and install Libreswan on your server. Additional packages required for compilation will also be installed. It is intended for upgrading servers to a newer Libreswan version. -Current version: $ipsec_ver_short +Current version: Libreswan $swan_ver_old Version to install: Libreswan $SWAN_VER EOF @@ -145,7 +144,7 @@ Note: This script will make the following changes to your VPN configuration: EOF -if [ "$SWAN_VER" != "4.2" ]; then +if [ "$SWAN_VER" != "4.3" ]; then cat <<'EOF' WARNING: Older versions of Libreswan could contain known security vulnerabilities. See https://libreswan.org/security/ for more information. diff --git a/extras/vpnupgrade_amzn.sh b/extras/vpnupgrade_amzn.sh index 6c1a8ff..4c45bcc 100755 --- a/extras/vpnupgrade_amzn.sh +++ b/extras/vpnupgrade_amzn.sh @@ -14,7 +14,7 @@ # know how you have improved it! # Specify which Libreswan version to install. See: https://libreswan.org -SWAN_VER=4.2 +SWAN_VER=4.3 ### DO NOT edit below this line ### @@ -39,22 +39,21 @@ if [ "$(id -u)" != 0 ]; then fi case $SWAN_VER in - 3.32|4.[12]) - /bin/true + 3.32|4.[123]) + true ;; *) cat 1>&2 </dev/null) -ipsec_ver_short=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan/Libreswan/' -e 's/ (netkey).*//') -swan_ver_old=$(printf '%s' "$ipsec_ver_short" | sed -e 's/Libreswan //') +swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan //' -e 's/ (netkey).*//' -e 's/^U//' -e 's/\/K.*//') if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then cat 1>&2 <<'EOF' Error: This script requires Libreswan already installed. @@ -63,7 +62,7 @@ EOF exit 1 fi -swan_ver_cur=4.2 +swan_ver_cur=4.3 swan_ver_url="https://dl.ls20.com/v1/amzn/2/swanverupg?arch=$os_arch&ver1=$swan_ver_old&ver2=$SWAN_VER" swan_ver_latest=$(wget -t 3 -T 15 -qO- "$swan_ver_url") if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$' \ @@ -111,7 +110,7 @@ Welcome! This script will build and install Libreswan on your server. Additional packages required for compilation will also be installed. It is intended for upgrading servers to a newer Libreswan version. -Current version: $ipsec_ver_short +Current version: Libreswan $swan_ver_old Version to install: Libreswan $SWAN_VER EOF @@ -124,7 +123,7 @@ Note: This script will make the following changes to your VPN configuration: EOF -if [ "$SWAN_VER" != "4.2" ]; then +if [ "$SWAN_VER" != "4.3" ]; then cat <<'EOF' WARNING: Older versions of Libreswan could contain known security vulnerabilities. See https://libreswan.org/security/ for more information. diff --git a/extras/vpnupgrade_centos.sh b/extras/vpnupgrade_centos.sh index 9bfd26c..29453e2 100755 --- a/extras/vpnupgrade_centos.sh +++ b/extras/vpnupgrade_centos.sh @@ -14,7 +14,7 @@ # know how you have improved it! # Specify which Libreswan version to install. See: https://libreswan.org -SWAN_VER=4.2 +SWAN_VER=4.3 ### DO NOT edit below this line ### @@ -51,22 +51,21 @@ if [ "$(id -u)" != 0 ]; then fi case $SWAN_VER in - 3.32|4.[12]) - /bin/true + 3.32|4.[123]) + true ;; *) cat 1>&2 </dev/null) -ipsec_ver_short=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan/Libreswan/' -e 's/ (netkey).*//') -swan_ver_old=$(printf '%s' "$ipsec_ver_short" | sed -e 's/Libreswan //') +swan_ver_old=$(printf '%s' "$ipsec_ver" | sed -e 's/Linux Libreswan //' -e 's/ (netkey).*//' -e 's/^U//' -e 's/\/K.*//') if ! printf '%s' "$ipsec_ver" | grep -q "Libreswan"; then cat 1>&2 <<'EOF' Error: This script requires Libreswan already installed. @@ -75,7 +74,7 @@ EOF exit 1 fi -swan_ver_cur=4.2 +swan_ver_cur=4.3 swan_ver_url="https://dl.ls20.com/v1/$os_type/$os_ver/swanverupg?arch=$os_arch&ver1=$swan_ver_old&ver2=$SWAN_VER" swan_ver_latest=$(wget -t 3 -T 15 -qO- "$swan_ver_url") if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$' \ @@ -123,7 +122,7 @@ Welcome! This script will build and install Libreswan on your server. Additional packages required for compilation will also be installed. It is intended for upgrading servers to a newer Libreswan version. -Current version: $ipsec_ver_short +Current version: Libreswan $swan_ver_old Version to install: Libreswan $SWAN_VER EOF @@ -136,7 +135,7 @@ Note: This script will make the following changes to your VPN configuration: EOF -if [ "$SWAN_VER" != "4.2" ]; then +if [ "$SWAN_VER" != "4.3" ]; then cat <<'EOF' WARNING: Older versions of Libreswan could contain known security vulnerabilities. See https://libreswan.org/security/ for more information. diff --git a/vpnsetup.sh b/vpnsetup.sh index 885e5bf..110282c 100755 --- a/vpnsetup.sh +++ b/vpnsetup.sh @@ -197,7 +197,7 @@ bigecho "Installing Fail2Ban to protect SSH..." bigecho "Downloading Libreswan..." -SWAN_VER=4.2 +SWAN_VER=4.3 swan_file="libreswan-$SWAN_VER.tar.gz" swan_url1="https://github.com/libreswan/libreswan/archive/v$SWAN_VER.tar.gz" swan_url2="https://download.libreswan.org/$swan_file" @@ -519,7 +519,7 @@ service xl2tpd restart 2>/dev/null swan_ver_url="https://dl.ls20.com/v1/$os_type/$os_ver/swanver?arch=$os_arch&ver=$SWAN_VER" swan_ver_latest=$(wget -t 3 -T 15 -qO- "$swan_ver_url") if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$' \ - && [ "$SWAN_VER" != "$swan_ver_latest" ] \ + && [ -n "$SWAN_VER" ] && [ "$SWAN_VER" != "$swan_ver_latest" ] \ && printf '%s\n%s' "$SWAN_VER" "$swan_ver_latest" | sort -C -V; then cat </dev/null swan_ver_url="https://dl.ls20.com/v1/amzn/2/swanver?arch=$os_arch&ver=$SWAN_VER" swan_ver_latest=$(wget -t 3 -T 15 -qO- "$swan_ver_url") if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$' \ - && [ "$SWAN_VER" != "$swan_ver_latest" ] \ + && [ -n "$SWAN_VER" ] && [ "$SWAN_VER" != "$swan_ver_latest" ] \ && printf '%s\n%s' "$SWAN_VER" "$swan_ver_latest" | sort -C -V; then cat </dev/null swan_ver_url="https://dl.ls20.com/v1/$os_type/$os_ver/swanver?arch=$os_arch&ver=$SWAN_VER" swan_ver_latest=$(wget -t 3 -T 15 -qO- "$swan_ver_url") if printf '%s' "$swan_ver_latest" | grep -Eq '^([3-9]|[1-9][0-9])\.([0-9]|[1-9][0-9])$' \ - && [ "$SWAN_VER" != "$swan_ver_latest" ] \ + && [ -n "$SWAN_VER" ] && [ "$SWAN_VER" != "$swan_ver_latest" ] \ && printf '%s\n%s' "$SWAN_VER" "$swan_ver_latest" | sort -C -V; then cat <