Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/network | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
diff --git a/src/network b/src/network index adc9ac3..893c411 100644 --- a/src/network +++ b/src/network @@ -1403,6 +1403,9 @@ cli_vpn() { security-policies) cli_vpn_security_policies $@ ;; + ipsec) + cli_vpn_ipsec $@ + ;; *) error "Unrecognized argument: ${action}" exit ${EXIT_ERROR} @@ -1410,6 +1413,63 @@ cli_vpn() { esac }
+cli_vpn_ipsec() { + local action=${1} + shift 1 + + case "${action}" in + connection) + cli_vpn_ipsec_connection $@ + ;; + *) + error "Unrecognized argument: ${action}" + exit ${EXIT_ERROR} + ;; + esac +} + +cli_vpn_ipsec_connection() { + if vpn_ipsec_connection_exists ${1}; then + local connection=${1} + local key=${2} + shift 2 + + case "${key}" in + authentication|local|mode|peer|remote) + vpn_ipsec_connection_${key} ${connection} $@ + ;; + inactivity-timeout) + vpn_ipsec_connection_inactivity_timeout ${connection} $@ + ;; + security-policy) + vpn_ipsec_connection_security_policy ${connection} $@ + ;; + *) + error "Unrecognized argument: ${key}" + exit ${EXIT_ERROR} + ;; + esac + else + local action=${1} + shift + + case "${action}" in + new) + vpn_ipsec_connection_new $@ + ;; + destroy) + vpn_ipsec_connection_destroy $@ + ;; + ""|*) + if [ -n "${action}" ]; then + error "Unrecognized argument: '${action}'" + fi + exit ${EXIT_ERROR} + ;; + esac + fi +} + cli_vpn_security_policies() {
local action