From 8c859e7c43fc9dd99bc1ef27f1646c45bd961593 Mon Sep 17 00:00:00 2001 From: hwdsl2 Date: Mon, 28 Dec 2020 00:45:59 -0600 Subject: [PATCH] Update tests - Add tests for Amazon Linux 2 - Other minor improvements --- .github/workflows/main.yml | 66 ++++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61839c7..e1f7aa2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -41,7 +41,7 @@ jobs: if: github.repository_owner == 'hwdsl2' strategy: matrix: - os_version: ["centos:8", "centos:7", "ubuntu:16.04"] + os_version: ["centos:8", "centos:7", "amazonlinux:2", "ubuntu:16.04"] fail-fast: false env: OS_VERSION: ${{ matrix.os_version }} @@ -69,11 +69,15 @@ jobs: exit 1 } - if [ "$1" = "centos" ]; then + if [ "$1" = "centos" ] || [ "$1" = "amazon" ]; then yum -y update yum -y -q install wget rsyslog systemctl start rsyslog - wget -t 3 -T 30 -nv -O vpnsetup.sh https://git.io/vpnsetup-centos + if [ "$1" = "centos" ]; then + wget -t 3 -T 30 -nv -O vpnsetup.sh https://git.io/vpnsetup-centos + else + wget -t 3 -T 30 -nv -O vpnsetup.sh https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn/master/vpnsetup_amzn.sh + fi else export DEBIAN_FRONTEND=noninteractive apt-get -yq update @@ -84,7 +88,7 @@ jobs: fi sh vpnsetup.sh - if [ "$1" = "centos" ]; then + if [ "$1" = "centos" ] || [ "$1" = "amazon" ]; then systemctl start ipsec systemctl start xl2tpd sleep 5 @@ -101,17 +105,16 @@ jobs: iptables -nL | grep -q '192\.168\.42\.0/24' iptables -nL -t nat iptables -nL -t nat | grep -q '192\.168\.43\.0/24' - if [ "$1" = "centos" ]; then + if [ "$1" = "centos" ] || [ "$1" = "amazon" ]; then grep pluto /var/log/secure - 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 xl2tpd /var/log/messages else grep pluto /var/log/auth.log - 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 xl2tpd /var/log/syslog fi + ipsec status + ipsec status | grep -q l2tp-psk + ipsec status | grep -q xauth-psk cat /var/log/fail2ban.log grep -E "Jail '(sshd?|ssh-iptables)' started" /var/log/fail2ban.log @@ -119,7 +122,7 @@ jobs: VPN_USER='your_vpn_username' \ VPN_PASSWORD='your_vpn_password' \ sh vpnsetup.sh - if [ "$1" = "centos" ]; then + if [ "$1" = "centos" ] || [ "$1" = "amazon" ]; then systemctl restart ipsec fi @@ -143,16 +146,16 @@ jobs: ls -ld /etc/ipsec.d/ikev2vpnca*.cer ls -ld /etc/ipsec.d/vpnclient*.p12 - if [ "$1" = "centos" ]; then + if [ "$1" = "centos" ] || [ "$1" = "amazon" ]; then systemctl restart ipsec sleep 10 grep pluto /var/log/secure | tail -n 20 - grep pluto /var/log/secure | grep -q 'added IKEv2 connection "ikev2-cp"' else sleep 10 grep pluto /var/log/auth.log | tail -n 20 - grep pluto /var/log/auth.log | grep -q 'added IKEv2 connection "ikev2-cp"' fi + ipsec status + ipsec status | grep -q ikev2-cp bash ikev2.sh <