From d5c3387d99d200e21f6cad390796ee0a0065e9a8 Mon Sep 17 00:00:00 2001 From: Vincent MONNIER <80886295+vmonnier@users.noreply.github.com> Date: Fri, 3 Apr 2026 16:47:53 +0200 Subject: [PATCH 1/3] Add FortiSase hook for endpoint configuration --- adapters/rest_generic/rest_generic_command.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/adapters/rest_generic/rest_generic_command.php b/adapters/rest_generic/rest_generic_command.php index 5e17479b..4811b230 100644 --- a/adapters/rest_generic/rest_generic_command.php +++ b/adapters/rest_generic/rest_generic_command.php @@ -64,6 +64,20 @@ function eval_IMPORT() { foreach ( $parser_list as $op_eval => $sub_parsers ) { $running_conf = sendexpectone ( __FILE__ . ':' . __LINE__, $sms_sd_ctx, $op_eval, "" ); + + /**************** BEGIN Hook form FortiSase ***************************/ + $post_import=(string)$sub_parsers[0]->post_template; + /* if the post template of the MS contains "ADD_ENDPOINT" + change the json to add a new root element, with a new ENDPOINT + element that contains (not aonly) the call endpoint/URI + */ + if ( strpos($post_import, "ADD_ENDPOINT") !== false ){ + $running_conf["ENDPOINT"]=$op_eval; + $running_conf = array( "ROOT" => $running_conf ); + } + debug_dump($running_conf, "RUNNING CONF\n"); + /**************** END Hook form FortiSase ***************************/ + foreach ( $sub_parsers as $parser ) { $parser->parse ( $running_conf, $objects ); } From 33540df8b9e78df3f2bc36ce47fe27d5d9b73c62 Mon Sep 17 00:00:00 2001 From: Vincent MONNIER <80886295+vmonnier@users.noreply.github.com> Date: Tue, 7 Apr 2026 08:37:48 +0200 Subject: [PATCH 2/3] Update adapters/rest_generic/rest_generic_command.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- adapters/rest_generic/rest_generic_command.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/adapters/rest_generic/rest_generic_command.php b/adapters/rest_generic/rest_generic_command.php index 4811b230..f464691a 100644 --- a/adapters/rest_generic/rest_generic_command.php +++ b/adapters/rest_generic/rest_generic_command.php @@ -65,18 +65,18 @@ function eval_IMPORT() { $running_conf = sendexpectone ( __FILE__ . ':' . __LINE__, $sms_sd_ctx, $op_eval, "" ); - /**************** BEGIN Hook form FortiSase ***************************/ + /**************** BEGIN Hook for FortiSase ***************************/ $post_import=(string)$sub_parsers[0]->post_template; - /* if the post template of the MS contains "ADD_ENDPOINT" - change the json to add a new root element, with a new ENDPOINT - element that contains (not aonly) the call endpoint/URI + /* if the post template of the MS contains "ADD_ENDPOINT" + change the json to add a new root element, with a new ENDPOINT + element that contains not only the call endpoint/URI */ if ( strpos($post_import, "ADD_ENDPOINT") !== false ){ $running_conf["ENDPOINT"]=$op_eval; $running_conf = array( "ROOT" => $running_conf ); } debug_dump($running_conf, "RUNNING CONF\n"); - /**************** END Hook form FortiSase ***************************/ + /**************** END Hook for FortiSase ***************************/ foreach ( $sub_parsers as $parser ) { $parser->parse ( $running_conf, $objects ); From 1ef251f107599bd4cbdde36b757fb321d2d7abfa Mon Sep 17 00:00:00 2001 From: Vincent MONNIER <80886295+vmonnier@users.noreply.github.com> Date: Tue, 7 Apr 2026 08:38:10 +0200 Subject: [PATCH 3/3] Update adapters/rest_generic/rest_generic_command.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- adapters/rest_generic/rest_generic_command.php | 1 - 1 file changed, 1 deletion(-) diff --git a/adapters/rest_generic/rest_generic_command.php b/adapters/rest_generic/rest_generic_command.php index f464691a..7b23722c 100644 --- a/adapters/rest_generic/rest_generic_command.php +++ b/adapters/rest_generic/rest_generic_command.php @@ -75,7 +75,6 @@ function eval_IMPORT() { $running_conf["ENDPOINT"]=$op_eval; $running_conf = array( "ROOT" => $running_conf ); } - debug_dump($running_conf, "RUNNING CONF\n"); /**************** END Hook for FortiSase ***************************/ foreach ( $sub_parsers as $parser ) {