Compare commits
2 Commits
8817e6f924
...
fec1b7c7a2
Author | SHA1 | Date | |
---|---|---|---|
|
fec1b7c7a2 | ||
|
fad9e0d34d |
@ -248,6 +248,13 @@ update_ikev2_conf() {
|
||||
sed -i "/conn ikev2-cp/a \ leftcert=$server_addr" /etc/ipsec.d/ikev2.conf
|
||||
}
|
||||
|
||||
update_ikev2_log() {
|
||||
ikev2_log="/etc/ipsec.d/ikev2setup.log"
|
||||
if [ -s "$ikev2_log" ]; then
|
||||
sed -i "/VPN server address:/s/$server_addr_old/$server_addr/" "$ikev2_log"
|
||||
fi
|
||||
}
|
||||
|
||||
restart_ipsec_service() {
|
||||
bigecho "Restarting IPsec service..."
|
||||
mkdir -p /run/pluto
|
||||
@ -278,6 +285,7 @@ ikev2changeaddr() {
|
||||
|
||||
create_server_cert
|
||||
update_ikev2_conf
|
||||
update_ikev2_log
|
||||
if [ "$os_type" = "alpine" ]; then
|
||||
ipsec auto --replace ikev2-cp >/dev/null
|
||||
else
|
||||
|
@ -157,7 +157,7 @@ confirm_or_abort() {
|
||||
show_header() {
|
||||
cat <<'EOF'
|
||||
|
||||
IKEv2 Script Copyright (c) 2020-2022 Lin Song 30 Oct 2022
|
||||
IKEv2 Script Copyright (c) 2020-2022 Lin Song 1 Dec 2022
|
||||
|
||||
EOF
|
||||
}
|
||||
@ -1247,6 +1247,20 @@ restart_ipsec_service() {
|
||||
fi
|
||||
}
|
||||
|
||||
check_ikev2_connection() {
|
||||
if grep -qs 'mobike=yes' "$IKEV2_CONF"; then
|
||||
(sleep 3
|
||||
if ! ipsec status | grep -q ikev2-cp; then
|
||||
sed -i '/mobike=yes/s/yes/no/' "$IKEV2_CONF"
|
||||
if [ "$os_type" = "alpine" ]; then
|
||||
ipsec auto --add ikev2-cp >/dev/null
|
||||
else
|
||||
restart_ipsec_service >/dev/null
|
||||
fi
|
||||
fi) >/dev/null 2>&1 &
|
||||
fi
|
||||
}
|
||||
|
||||
create_crl() {
|
||||
bigecho "Revoking client certificate..."
|
||||
if ! crlutil -L -d "$CERT_DB" -n "$CA_NAME" >/dev/null 2>&1; then
|
||||
@ -1717,6 +1731,7 @@ ikev2setup() {
|
||||
else
|
||||
restart_ipsec_service
|
||||
fi
|
||||
check_ikev2_connection
|
||||
print_setup_complete
|
||||
print_client_info
|
||||
if [ "$in_container" = 0 ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user