]> git.ipfire.org Git - network.git/commitdiff
IPsec: regenerate a swanctl config on connection startup if no config is found
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Thu, 8 Mar 2018 09:09:02 +0000 (09:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 9 Mar 2018 20:26:16 +0000 (20:26 +0000)
This is an easy way to forcing a regenration if we do not want to change any setting.

Fixes: #11627
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/functions/functions.ipsec

index 6f14c8eaeb96283e6ee1d94c244fde5b9796d5ce..d8206e01a46f9a2262eda8d01a1198137a1cb7a9 100644 (file)
@@ -526,6 +526,12 @@ ipsec_connection_up() {
                return ${EXIT_ERROR}
        fi
 
+       if ! [ -f "${NETWORK_IPSEC_SWANCTL_CONNECTIONS_DIR}/${connection}.conf" ]; then
+               log DEBUG "Could not find a swanctl config, generating swanctl config"
+               ipsec_connection_to_strongswan "${connection}"
+               ipsec_strongswan_load
+       fi
+
        cmd swanctl --initiate --child "${connection}"
 }