diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5751a64..20578b7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -181,15 +181,15 @@ jobs: systemctl restart ipsec sleep 10 grep pluto /var/log/secure - grep pluto /var/log/secure | grep -q 'added connection description "l2tp-psk"' - grep pluto /var/log/secure | grep -q 'added connection description "xauth-psk"' - grep pluto /var/log/secure | grep -q 'added connection description "ikev2-cp"' + grep pluto /var/log/secure | grep -q 'added IKEv1 connection "l2tp-psk"' + grep pluto /var/log/secure | grep -q 'added IKEv1 connection "xauth-psk"' + grep pluto /var/log/secure | grep -q 'added IKEv2 connection "ikev2-cp"' else sleep 10 grep pluto /var/log/auth.log - grep pluto /var/log/auth.log | grep -q 'added connection description "l2tp-psk"' - grep pluto /var/log/auth.log | grep -q 'added connection description "xauth-psk"' - grep pluto /var/log/auth.log | grep -q 'added connection description "ikev2-cp"' + grep pluto /var/log/auth.log | grep -q 'added IKEv1 connection "l2tp-psk"' + grep pluto /var/log/auth.log | grep -q 'added IKEv1 connection "xauth-psk"' + grep pluto /var/log/auth.log | grep -q 'added IKEv2 connection "ikev2-cp"' fi ls -ld vpnsetup.sh @@ -373,14 +373,14 @@ jobs: sleep 10 if [ "$OS_NAME" = "centos" ]; then grep pluto /var/log/secure - grep pluto /var/log/secure | grep -q 'added connection description "l2tp-psk"' - grep pluto /var/log/secure | grep -q 'added connection description "xauth-psk"' - grep pluto /var/log/secure | grep -q 'added connection description "ikev2-cp"' + grep pluto /var/log/secure | grep -q 'added IKEv1 connection "l2tp-psk"' + grep pluto /var/log/secure | grep -q 'added IKEv1 connection "xauth-psk"' + grep pluto /var/log/secure | grep -q 'added IKEv2 connection "ikev2-cp"' else grep pluto /var/log/auth.log - grep pluto /var/log/auth.log | grep -q 'added connection description "l2tp-psk"' - grep pluto /var/log/auth.log | grep -q 'added connection description "xauth-psk"' - grep pluto /var/log/auth.log | grep -q 'added connection description "ikev2-cp"' + grep pluto /var/log/auth.log | grep -q 'added IKEv1 connection "l2tp-psk"' + grep pluto /var/log/auth.log | grep -q 'added IKEv1 connection "xauth-psk"' + grep pluto /var/log/auth.log | grep -q 'added IKEv2 connection "ikev2-cp"' fi ls -ld vpnsetup.sh diff --git a/extras/vpnupgrade.sh b/extras/vpnupgrade.sh index 63136cf..9d041cf 100644 --- a/extras/vpnupgrade.sh +++ b/extras/vpnupgrade.sh @@ -11,7 +11,7 @@ # know how you have improved it! # Specify which Libreswan version to install. See: https://libreswan.org -SWAN_VER=3.32 +SWAN_VER=4.1 ### DO NOT edit below this line ### @@ -46,14 +46,14 @@ if [ "$(id -u)" != 0 ]; then fi case "$SWAN_VER" in - 3.19|3.2[01235679]|3.3[12]) + 3.19|3.2[01235679]|3.3[12]|4.1) /bin/true ;; *) cat 1>&2 < Makefile.inc.local <<'EOF' -WERROR_CFLAGS = -w -USE_DNSSEC = false -USE_DH31 = false -USE_NSS_AVA_COPY = true -USE_NSS_IPSEC_PROFILE = false -USE_GLIBC_KERN_FLIP_HEADERS = true +WERROR_CFLAGS=-w +USE_DNSSEC=false +USE_DH31=false +USE_NSS_AVA_COPY=true +USE_NSS_IPSEC_PROFILE=false +USE_GLIBC_KERN_FLIP_HEADERS=true EOF -if [ "$SWAN_VER" = "3.31" ] || [ "$SWAN_VER" = "3.32" ]; then - echo "USE_DH2 = true" >> Makefile.inc.local +if [ "$SWAN_VER" = "3.31" ] || [ "$SWAN_VER" = "3.32" ] || [ "$SWAN_VER" = "4.1" ]; then + echo "USE_DH2=true" >> Makefile.inc.local if ! grep -qs IFLA_XFRM_LINK /usr/include/linux/if_link.h; then - echo "USE_XFRM_INTERFACE_IFLA_HEADER = true" >> Makefile.inc.local + echo "USE_XFRM_INTERFACE_IFLA_HEADER=true" >> Makefile.inc.local fi fi +if [ "$SWAN_VER" = "4.1" ]; then + echo "USE_NSS_KDF=false" >> Makefile.inc.local + echo "FINALNSSDIR=/etc/ipsec.d" >> Makefile.inc.local +fi if [ "$(packaging/utils/lswan_detect.sh init)" = "systemd" ]; then apt-get -yq install libsystemd-dev || exiterr2 fi @@ -258,6 +262,8 @@ fi sed -i".old-$(date +%F-%T)" \ -e "s/^[[:space:]]\+auth=esp\$/ phase2=esp/g" \ -e "s/^[[:space:]]\+forceencaps=yes\$/ encapsulation=yes/g" \ + -e "s/^[[:space:]]\+sha2_truncbug=/ sha2-truncbug=/g" \ + -e "s/^[[:space:]]\+ike-frag=/ fragmentation=/g" \ -e "s/^[[:space:]]\+ike=.\+\$/$IKE_NEW/g" \ -e "s/^[[:space:]]\+phase2alg=.\+\$/$PHASE2_NEW/g" /etc/ipsec.conf @@ -273,7 +279,8 @@ elif [ "$dns_state" = "4" ]; then sed -i "s/modecfgdns=.*/modecfgdns1=$DNS_SRV1/" /etc/ipsec.conf fi -if [ "$SWAN_VER" = "3.29" ] || [ "$SWAN_VER" = "3.31" ] || [ "$SWAN_VER" = "3.32" ]; then +if [ "$SWAN_VER" = "3.29" ] || [ "$SWAN_VER" = "3.31" ] \ + || [ "$SWAN_VER" = "3.32" ] || [ "$SWAN_VER" = "4.1" ]; then sed -i "/ikev2=never/d" /etc/ipsec.conf sed -i "/conn shared/a \ ikev2=never" /etc/ipsec.conf fi diff --git a/extras/vpnupgrade_centos.sh b/extras/vpnupgrade_centos.sh index d8075a8..d837aa9 100644 --- a/extras/vpnupgrade_centos.sh +++ b/extras/vpnupgrade_centos.sh @@ -11,7 +11,7 @@ # know how you have improved it! # Specify which Libreswan version to install. See: https://libreswan.org -SWAN_VER=3.32 +SWAN_VER=4.1 ### DO NOT edit below this line ### @@ -37,14 +37,14 @@ if [ "$(id -u)" != 0 ]; then fi case "$SWAN_VER" in - 3.19|3.2[01235679]|3.3[12]) + 3.19|3.2[01235679]|3.3[12]|4.1) /bin/true ;; *) cat 1>&2 < Makefile.inc.local <<'EOF' -WERROR_CFLAGS = -w -USE_DNSSEC = false -USE_DH31 = false -USE_NSS_AVA_COPY = true -USE_NSS_IPSEC_PROFILE = false -USE_GLIBC_KERN_FLIP_HEADERS = true +WERROR_CFLAGS=-w +USE_DNSSEC=false +USE_DH31=false +USE_NSS_AVA_COPY=true +USE_NSS_IPSEC_PROFILE=false +USE_GLIBC_KERN_FLIP_HEADERS=true EOF -if [ "$SWAN_VER" = "3.31" ] || [ "$SWAN_VER" = "3.32" ]; then - echo "USE_DH2 = true" >> Makefile.inc.local +if [ "$SWAN_VER" = "3.31" ] || [ "$SWAN_VER" = "3.32" ] || [ "$SWAN_VER" = "4.1" ]; then + echo "USE_DH2=true" >> Makefile.inc.local if ! grep -qs IFLA_XFRM_LINK /usr/include/linux/if_link.h; then - echo "USE_XFRM_INTERFACE_IFLA_HEADER = true" >> Makefile.inc.local + echo "USE_XFRM_INTERFACE_IFLA_HEADER=true" >> Makefile.inc.local fi fi +if [ "$SWAN_VER" = "4.1" ]; then + echo "USE_NSS_KDF=false" >> Makefile.inc.local + echo "FINALNSSDIR=/etc/ipsec.d" >> Makefile.inc.local +fi NPROCS=$(grep -c ^processor /proc/cpuinfo) [ -z "$NPROCS" ] && NPROCS=1 make "-j$((NPROCS+1))" -s base && make -s install-base @@ -250,9 +254,9 @@ if ! /usr/local/sbin/ipsec --version 2>/dev/null | grep -qF "$SWAN_VER"; then fi # Restore SELinux contexts -restorecon /etc/ipsec.d/*db >/dev/null 2>&1 -restorecon /usr/local/sbin -Rv >/dev/null 2>&1 -restorecon /usr/local/libexec/ipsec -Rv >/dev/null 2>&1 +restorecon /etc/ipsec.d/*db 2>/dev/null +restorecon /usr/local/sbin -Rv 2>/dev/null +restorecon /usr/local/libexec/ipsec -Rv 2>/dev/null # Update ipsec.conf IKE_NEW=" ike=aes256-sha2,aes128-sha2,aes256-sha1,aes128-sha1,aes256-sha2;modp1024,aes128-sha1;modp1024" @@ -261,6 +265,8 @@ PHASE2_NEW=" phase2alg=aes_gcm-null,aes128-sha1,aes256-sha1,aes256-sha2_512,aes sed -i".old-$(date +%F-%T)" \ -e "s/^[[:space:]]\+auth=esp\$/ phase2=esp/g" \ -e "s/^[[:space:]]\+forceencaps=yes\$/ encapsulation=yes/g" \ + -e "s/^[[:space:]]\+sha2_truncbug=/ sha2-truncbug=/g" \ + -e "s/^[[:space:]]\+ike-frag=/ fragmentation=/g" \ -e "s/^[[:space:]]\+ike=.\+\$/$IKE_NEW/g" \ -e "s/^[[:space:]]\+phase2alg=.\+\$/$PHASE2_NEW/g" /etc/ipsec.conf @@ -276,7 +282,8 @@ elif [ "$dns_state" = "4" ]; then sed -i "s/modecfgdns=.*/modecfgdns1=$DNS_SRV1/" /etc/ipsec.conf fi -if [ "$SWAN_VER" = "3.29" ] || [ "$SWAN_VER" = "3.31" ] || [ "$SWAN_VER" = "3.32" ]; then +if [ "$SWAN_VER" = "3.29" ] || [ "$SWAN_VER" = "3.31" ] \ + || [ "$SWAN_VER" = "3.32" ] || [ "$SWAN_VER" = "4.1" ]; then sed -i "/ikev2=never/d" /etc/ipsec.conf sed -i "/conn shared/a \ ikev2=never" /etc/ipsec.conf fi