Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/network | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/src/network b/src/network index 16c8f60..88c90b1 100644 --- a/src/network +++ b/src/network @@ -1409,6 +1409,24 @@ cli_vpn() { security-policies) cli_vpn_security_policies $@ ;; + ipsec) + cli_vpn_ipsec $@ + ;; + *) + error "Unrecognized argument: ${action}" + exit ${EXIT_ERROR} + ;; + esac +} + +cli_vpn_ipsec() { + local action=${1} + shift 1 + + case "${action}" in + connection) + cli_vpn_ipsec_connection $@ + ;; *) error "Unrecognized argument: ${action}" exit ${EXIT_ERROR} @@ -1416,6 +1434,43 @@ cli_vpn() { esac }
+cli_vpn_ipsec_connection() { + if ipsec_connection_exists ${1}; then + local connection=${1} + local key=${2} + key=${key//-/_} + shift 2 + + case "${key}" in + authentication|inactivity-timout|local|mode|peer|remote|security-policy) + ipsec_connection_${key} ${connection} $@ + ;; + *) + error "Unrecognized argument: ${key}" + exit ${EXIT_ERROR} + ;; + esac + else + local action=${1} + shift + + case "${action}" in + new) + ipsec_connection_new $@ + ;; + destroy) + ipsec_connection_destroy $@ + ;; + ""|*) + if [ -n "${action}" ]; then + error "Unrecognized argument: '${action}'" + fi + exit ${EXIT_ERROR} + ;; + esac + fi +} + cli_vpn_security_policies() {
local action