1
0
mirror of synced 2024-11-27 15:26:08 +03:00

Compare commits

..

3 Commits

Author SHA1 Message Date
hwdsl2
571296ffb9 Update tests 2022-05-13 09:27:36 -05:00
hwdsl2
1aa2d87e01 Update IKEv2 script
- Update NSS workaround for Ubuntu 18.04 with new package versions
2022-05-13 09:27:22 -05:00
hwdsl2
62d85490de Improve VPN setup
- On Alpine Linux, update crontabs when uninstalling the VPN.
  These cron jobs are for restarting the ipsec service on failure.
  Ref: 15d8651
2022-05-13 09:26:08 -05:00
4 changed files with 22 additions and 10 deletions

View File

@ -104,9 +104,9 @@ jobs:
url1="https://mirrors.kernel.org/ubuntu/pool/main/n/nss"
url2="https://mirrors.kernel.org/ubuntu/pool/universe/n/nss"
deb1="libnss3_3.49.1-1ubuntu1.6_amd64.deb"
deb2="libnss3-dev_3.49.1-1ubuntu1.6_amd64.deb"
deb3="libnss3-tools_3.49.1-1ubuntu1.6_amd64.deb"
deb1="libnss3_3.49.1-1ubuntu1.7_amd64.deb"
deb2="libnss3-dev_3.49.1-1ubuntu1.7_amd64.deb"
deb3="libnss3-tools_3.49.1-1ubuntu1.7_amd64.deb"
$wg 1.deb "$url1/$deb1"
$wg 2.deb "$url1/$deb2"

View File

@ -151,7 +151,7 @@ confirm_or_abort() {
show_header() {
cat <<'EOF'
IKEv2 Script Copyright (c) 2020-2022 Lin Song 8 May 2022
IKEv2 Script Copyright (c) 2020-2022 Lin Song 14 May 2022
EOF
}
@ -1148,9 +1148,9 @@ apply_ubuntu1804_nss_fix() {
if [ "$os_type" = "ubuntu" ] && [ "$os_ver" = "bustersid" ] && [ "$os_arch" = "x86_64" ]; then
nss_url1="https://mirrors.kernel.org/ubuntu/pool/main/n/nss"
nss_url2="https://mirrors.kernel.org/ubuntu/pool/universe/n/nss"
nss_deb1="libnss3_3.49.1-1ubuntu1.6_amd64.deb"
nss_deb2="libnss3-dev_3.49.1-1ubuntu1.6_amd64.deb"
nss_deb3="libnss3-tools_3.49.1-1ubuntu1.6_amd64.deb"
nss_deb1="libnss3_3.49.1-1ubuntu1.7_amd64.deb"
nss_deb2="libnss3-dev_3.49.1-1ubuntu1.7_amd64.deb"
nss_deb3="libnss3-tools_3.49.1-1ubuntu1.7_amd64.deb"
if tmpdir=$(mktemp --tmpdir -d vpn.XXXXX 2>/dev/null); then
bigecho2 "Applying fix for NSS bug on Ubuntu 18.04..."
export DEBIAN_FRONTEND=noninteractive

View File

@ -291,6 +291,17 @@ EOF
fi
}
update_crontabs() {
if [ "$os_type" = "alpine" ]; then
cron_cmd="rc-service -c ipsec zap start"
if grep -qs "$cron_cmd" /etc/crontabs/root; then
bigecho "Updating crontabs..."
sed -i "/$cron_cmd/d" /etc/crontabs/root
touch /etc/crontabs/cron.update
fi
fi
}
remove_config_files() {
bigecho "Removing VPN configuration..."
/bin/rm -f /etc/ipsec.conf* /etc/ipsec.secrets* /etc/ppp/chap-secrets* /etc/ppp/options.xl2tpd* \
@ -306,6 +317,7 @@ remove_vpn() {
update_sysctl
update_rclocal
update_iptables_rules
update_crontabs
remove_config_files
}

View File

@ -501,15 +501,15 @@ start_services() {
service xl2tpd restart >/dev/null 2>&1
mkdir -p /etc/crontabs
cron_cmd="rc-service -c ipsec zap start"
if ! grep -qs "$cron_cmd" /etc/crontabs/root; then
if ! grep -qs "$cron_cmd" /etc/crontabs/root; then
cat >> /etc/crontabs/root <<EOF
* * * * * $cron_cmd
* * * * * sleep 15; $cron_cmd
* * * * * sleep 30; $cron_cmd
* * * * * sleep 45; $cron_cmd
EOF
touch /etc/crontabs/cron.update
fi
touch /etc/crontabs/cron.update
fi
}
show_vpn_info() {