diff --git a/security/acme-client/Makefile b/security/acme-client/Makefile index 972358733..dc4001662 100644 --- a/security/acme-client/Makefile +++ b/security/acme-client/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= acme-client -PLUGIN_VERSION= 1.3 +PLUGIN_VERSION= 1.4 PLUGIN_COMMENT= Let's Encrypt client PLUGIN_MAINTAINER= opnsense@moov.de diff --git a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogAction.xml b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogAction.xml index 4dcfa42b4..271bf6c24 100644 --- a/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogAction.xml +++ b/security/acme-client/src/opnsense/mvc/app/controllers/OPNsense/AcmeClient/forms/dialogAction.xml @@ -35,16 +35,4 @@ Select a pre-defined system command which should be run for this action. - - - header - - - - action.custom - - textbox - Specify a custom commands which should be run for this action. - - diff --git a/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml b/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml index 65e463196..1c2c1d313 100644 --- a/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml +++ b/security/acme-client/src/opnsense/mvc/app/models/OPNsense/AcmeClient/AcmeClient.xml @@ -504,7 +504,6 @@ Restart OPNsense Web UI Restart HAProxy (OPNsense plugin) System or Plugin Command (select below) - Custom Command (specify below) @@ -514,9 +513,6 @@ Select a command from the list. N - - N - diff --git a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php index c1fbd1767..bd2840b34 100755 --- a/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php +++ b/security/acme-client/src/opnsense/scripts/OPNsense/AcmeClient/certhelper.php @@ -1021,74 +1021,6 @@ function run_restart_actions($certlist, $modelObj) } $response = $backend->configdRun((string)$action->configd); break; - case 'custom': - // Make sure a custom command was specified. - if (empty((string)$action->custom)) { - log_error("AcmeClient: no custom command specified for restart action: " . $action->name); - $result = '1'; - continue; // Continue with next action. - } - - // Prepare to run the command. - $proc_env = array(); // env variables for proc_open() - $proc_env['PATH'] = '/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin'; - $proc_desc = array( // descriptor array for proc_open() - 0 => array("pipe", "r"), // stdin - 1 => array("pipe", "w"), // stdout - 2 => array("pipe", "w") // stderr - ); - $proc_pipes = array(); - $proc_stdout = ''; - $proc_stderr = ''; - $result = ''; // exit code (or '99' in case of timeout) - - // Timeout for custom restart actions. - if (!empty((string)$configObj->OPNsense->AcmeClient->settings->restartTimeout)) { - $timeout = (string)$configObj->OPNsense->AcmeClient->settings->restartTimeout; - } else { - $timeout = '600'; - } - $starttime = time(); - - $proc_cmd = (string)$action->custom; - $proc = proc_open($proc_cmd, $proc_desc, $proc_pipes, null, $proc_env); - - // Make sure the resource could be setup properly - if (is_resource($proc)) { - fclose($proc_pipes[0]); - - // Wait until process terminates normally - while (is_resource($proc)) { - $proc_stdout .= stream_get_contents($proc_pipes[1]); - $proc_stderr .= stream_get_contents($proc_pipes[2]); - - // Check if timeout is reached - if (($timeout !== false) and ((time() - $starttime) > $timeout)) { - // Terminate process if timeout is reached - log_error("AcmeClient: timeout running restart action: " . $action->name); - proc_terminate($proc, 9); - $result = '99'; - break; - } - - // Check if process terminated normally - $status = proc_get_status($proc); - if (!$status['running']) { - fclose($proc_pipes[1]); - fclose($proc_pipes[2]); - proc_close($proc); - $result = $status['exitcode']; - break; - } - - usleep(100000); - } - } else { - log_error("AcmeClient: unable to initiate restart action: " . $action->name); - continue; // Continue with next action. - } - $return = $result; - break; default: log_error("AcmeClient: an invalid restart action was specified: " . (string)$action->type); $return = 1;