1
0
mirror of synced 2024-11-22 04:56:03 +03:00

Update IKEv2 setup log

- When using the IKEv2 change server address script on Docker,
  update the IKEv2 setup log with the new server address, so that
  it can be displayed in the container logs after a restart.
This commit is contained in:
hwdsl2 2022-12-01 21:25:41 -06:00
parent 8817e6f924
commit fad9e0d34d

View File

@ -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