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}"
}
assert [ $# -eq 1 ]
local peer=${1}
- # TODO Accept also FQDNs
+ # IP addresses are accepted
if ip_is_valid ${peer}; then
return ${EXIT_TRUE}
- else
- return ${EXIT_FALSE}
fi
+
+ # FQDNs are okay, too
+ if fqdn_is_valid "${peer}"; then
+ return ${EXIT_TRUE}
+ fi
+
+ # We cannot use anything else
+ return ${EXIT_FALSE}
}
# This function checks if a VPN IPsec connection name is valid
# List all ipsec connections
ipsec_list_connections() {
- local connection
- for connection in ${NETWORK_IPSEC_CONNS_DIR}/*; do
- [ -d ${connection} ] || continue
- basename ${connection}
- done
+ list_directory "${NETWORK_IPSEC_CONNS_DIR}"
}
ipsec_connection_to_strongswan() {