From 305e4648aa91929bd747e755b163e15c28fd550b Mon Sep 17 00:00:00 2001 From: ljm42 Date: Thu, 1 Feb 2024 15:49:17 -0700 Subject: [PATCH 1/4] logger - ensure params are escaped --- emhttp/login.php | 1 + .../include/DockerClient.php | 2 +- .../dynamix.plugin.manager/scripts/language | 15 +++---- .../dynamix.plugin.manager/scripts/plugin | 43 +++++++++---------- emhttp/plugins/dynamix/include/.login.php | 10 ++--- .../plugins/dynamix/include/.set-password.php | 2 +- .../plugins/dynamix/include/PageBuilder.php | 3 +- .../dynamix/include/SysDriversInit.php | 3 +- emhttp/plugins/dynamix/include/Wrappers.php | 4 ++ .../plugins/dynamix/include/local_prepend.php | 2 +- emhttp/plugins/dynamix/include/publish.php | 7 ++- emhttp/plugins/dynamix/scripts/netconfig | 5 ++- 12 files changed, 52 insertions(+), 45 deletions(-) diff --git a/emhttp/login.php b/emhttp/login.php index 9c6bd96f9..9752dc3f7 100644 --- a/emhttp/login.php +++ b/emhttp/login.php @@ -1,6 +1,7 @@ SHA256) { - logger("checking: $name - SHA256"); + my_logger('plugin-manager',"checking: $name - SHA256"); if (hash_file('sha256', $name) != $file->SHA256) { unlink($name); } } elseif ($file->MD5) { - logger("checking: $name - MD5"); + my_logger('plugin-manager',"checking: $name - MD5"); if (md5_file($name) != $file->MD5) { unlink($name); } @@ -396,12 +393,12 @@ function plugin($method, $plugin_file, &$error) { // If file already exists, do not overwrite // if (file_exists($name)) { - logger("skipping: $name already exists"); + my_logger('plugin-manager',"skipping: $name already exists"); } elseif ($file->LOCAL) { // Create the file // // for local file, just copy it - logger("creating: $name - copying LOCAL file $file->LOCAL"); + my_logger('plugin-manager',"creating: $name - copying LOCAL file $file->LOCAL"); if (!copy($file->LOCAL, $name)) { $error = "unable to copy LOCAL file: $name"; @unlink($name); @@ -409,10 +406,10 @@ function plugin($method, $plugin_file, &$error) { } } elseif ($file->INLINE) { // for inline file, create with inline contents - logger("creating: $name - from INLINE content"); + my_logger('plugin-manager',"creating: $name - from INLINE content"); $contents = trim($file->INLINE).PHP_EOL; if ($file->attributes()->Type == 'base64') { - logger("decoding: $name as base64"); + my_logger('plugin-manager',"decoding: $name as base64"); $contents = base64_decode($contents); if ($contents === false) { $error = "unable to decode inline base64: $name"; @@ -426,20 +423,20 @@ function plugin($method, $plugin_file, &$error) { } } elseif ($file->URL) { // for download file, download and maybe verify the file MD5 - logger("creating: $name - downloading from URL $file->URL"); + my_logger('plugin-manager',"creating: $name - downloading from URL $file->URL"); if ( (download($file->URL, $name, $error) === false) && (download(filter_url($file->URL), $name, $error) === false) ) { @unlink($name); return false; } if ($file->SHA256) { - logger("checking: $name - SHA256"); + my_logger('plugin-manager',"checking: $name - SHA256"); if (hash_file('sha256', $name) != $file->SHA256) { $error = "bad file SHA256: $name"; unlink($name); return false; } } elseif ($file->MD5) { - logger("checking: $name - MD5"); + my_logger('plugin-manager',"checking: $name - MD5"); if (md5_file($name) != $file->MD5) { $error = "bad file MD5: $name"; unlink($name); @@ -452,7 +449,7 @@ function plugin($method, $plugin_file, &$error) { if ($file->attributes()->Mode) { // if file has 'Mode' attribute, apply it $mode = $file->attributes()->Mode; - logger("setting: $name - mode to $mode"); + my_logger('plugin-manager',"setting: $name - mode to $mode"); if (!chmod($name, octdec($mode))) { $error = "chmod failure: $name"; return false; @@ -464,13 +461,13 @@ function plugin($method, $plugin_file, &$error) { if ($file->attributes()->Run) { $command = $file->attributes()->Run; if ($name) { - logger("running: $command $name"); + my_logger('plugin-manager',"running: $command $name"); $retval = run("$command $name"); } elseif ($file->LOCAL) { - logger("running: $command $file->LOCAL"); + my_logger('plugin-manager',"running: $command $file->LOCAL"); $retval = run("$command $file->LOCAL"); } elseif ($file->INLINE) { - logger("running: 'anonymous'"); + my_logger('plugin-manager',"running: 'anonymous'"); $name = '/tmp/inline.sh'; file_put_contents($name, $file->INLINE); $retval = run("$command $name"); @@ -718,10 +715,10 @@ if ($method == 'install') { if ($target != $plugin_file) copy($plugin_file, $target); symlink($target, $symlink); write("plugin: $plugin installed\n"); - logger("$plugin installed"); + my_logger('plugin-manager',"$plugin installed"); } else { write("script: $plugin executed\n"); - logger("script: $plugin executed"); + my_logger('plugin-manager',"script: $plugin executed"); } // run hook scripts for post processing post_hooks(); @@ -835,7 +832,7 @@ if ($method == 'update') { copy($plugin_file, $target); symlink($target, $symlink); write("plugin: $plugin updated\n"); - logger("$plugin updated"); + my_logger('plugin-manager',"$plugin updated"); // run hook scripts for post processing post_hooks(); done(0); @@ -867,7 +864,7 @@ if ($method == 'remove') { // remove the plugin file move($installed_plugin_file, "$boot-removed"); write("plugin: $plugin removed\n"); - logger("$plugin removed"); + my_logger('plugin-manager',"$plugin removed"); exec("/usr/local/sbin/update_cron"); // run hook scripts for post processing post_hooks(); diff --git a/emhttp/plugins/dynamix/include/.login.php b/emhttp/plugins/dynamix/include/.login.php index 58e03f789..aac485100 100644 --- a/emhttp/plugins/dynamix/include/.login.php +++ b/emhttp/plugins/dynamix/include/.login.php @@ -119,12 +119,12 @@ function verifyTwoFactorToken(string $username, string $token): bool { // This should accept 200 or 204 status codes if ($httpCode !== 200 && $httpCode !== 204) { // Log error to syslog - exec("logger -t webGUI -- \"2FA code for {$username} is invalid, blocking access!\""); + my_logger('webGUI', "2FA code for {$username} is invalid, blocking access!"); return false; } // Log success to syslog - exec("logger -t webGUI -- \"2FA code for {$username} is valid, allowing login!\""); + my_logger('webGUI', "2FA code for {$username} is valid, allowing login!"); // Success return true; @@ -199,7 +199,7 @@ if (!empty($username) && !empty($password)) { // Check if we're limited if ($failCount >= $maxFails) { - if ($failCount == $maxFails) exec("logger -t webGUI -- \"Ignoring login attempts for {$username} from {$remote_addr}\""); + if ($failCount == $maxFails) my_logger('webGUI', "Ignoring login attempts for {$username} from {$remote_addr}"); throw new Exception(_('Too many invalid login attempts')); } @@ -216,7 +216,7 @@ if (!empty($username) && !empty($password)) { $_SESSION['unraid_user'] = $username; session_regenerate_id(true); session_write_close(); - exec("logger -t webGUI -- \"Successful login user {$username} from {$remote_addr}\""); + my_logger('webGUI', "Successful login user {$username} from {$remote_addr}"); // Redirect the user to the start page header("Location: /".$start_page); @@ -226,7 +226,7 @@ if (!empty($username) && !empty($password)) { $error = $exception->getMessage(); // Log error to syslog - exec("logger -t webGUI -- \"Unsuccessful login user {$username} from {$remote_addr}\""); + my_logger('webGUI', "Unsuccessful login user {$username} from {$remote_addr}"); appendToFile($failFile, $time."\n"); } } diff --git a/emhttp/plugins/dynamix/include/.set-password.php b/emhttp/plugins/dynamix/include/.set-password.php index 3e3256f46..f19b97b91 100644 --- a/emhttp/plugins/dynamix/include/.set-password.php +++ b/emhttp/plugins/dynamix/include/.set-password.php @@ -36,7 +36,7 @@ if (!empty($_POST['password']) && !empty($_POST['confirmPassword'])) { } // Error when attempting to set password - exec("logger -t webGUI -- \"{$VALIDATION_MESSAGES['saveError']} [REMOTE_ADDR]: {$REMOTE_ADDR}\""); + my_logger('webGUI', "{$VALIDATION_MESSAGES['saveError']} [REMOTE_ADDR]: {$REMOTE_ADDR}"); return $POST_ERROR = $VALIDATION_MESSAGES['saveError']; } diff --git a/emhttp/plugins/dynamix/include/PageBuilder.php b/emhttp/plugins/dynamix/include/PageBuilder.php index 931d05943..e2c88ff4d 100644 --- a/emhttp/plugins/dynamix/include/PageBuilder.php +++ b/emhttp/plugins/dynamix/include/PageBuilder.php @@ -12,6 +12,7 @@ ?> 'D j M Y h:i A','%A' => 'l','%Y' => 'Y','%B' => 'F','%e' => 'j','%d' => 'd','%m' => 'm','%I' => 'h','%H' => 'H','%M' => 'i','%S' => 's','%p' => 'a','%R' => 'H:i', '%F' => 'Y-m-d', '%T' => 'H:i:s']; return date(strtr($fmt,$legacy), $time); } +// ensure params passed to logger are properly escaped +function my_logger($tag, $message) { + exec('logger -t '.escapeshellarg($tag).' -- '.escapeshellarg($message)); +} ?> diff --git a/emhttp/plugins/dynamix/include/local_prepend.php b/emhttp/plugins/dynamix/include/local_prepend.php index 0f5458f7a..c683c1b87 100644 --- a/emhttp/plugins/dynamix/include/local_prepend.php +++ b/emhttp/plugins/dynamix/include/local_prepend.php @@ -15,7 +15,7 @@ // auto_prepend_file="/usr/local/emhttp/webGui/include/local_prepend.php" function csrf_terminate($reason) { - exec("logger -t webGUI -- \"error: {$_SERVER['REQUEST_URI']} - {$reason} csrf_token\""); + exec('logger -t webGUI -- '.escapeshellarg("error: {$_SERVER['REQUEST_URI']} - {$reason} csrf_token")); exit; } diff --git a/emhttp/plugins/dynamix/include/publish.php b/emhttp/plugins/dynamix/include/publish.php index f4340dc4f..87bf0d3f3 100644 --- a/emhttp/plugins/dynamix/include/publish.php +++ b/emhttp/plugins/dynamix/include/publish.php @@ -11,13 +11,16 @@ */ ?> $socket, CURLOPT_RETURNTRANSFER => 1]); if ($message) curl_setopt_array($com, [CURLOPT_POSTFIELDS => $message, CURLOPT_POST => 1]); $reply = curl_exec($com); curl_close($com); - if ($reply===false) exec("logger -t curl_socket -- 'curl to $url failed'"); + if ($reply===false) my_logger('curl_socket', "curl to $url failed"); return $reply; } @@ -32,7 +35,7 @@ function publish($endpoint, $message, $len=1) { ]); $reply = curl_exec($com); curl_close($com); - if ($reply===false) exec("logger -t publish -- 'curl to $endpoint failed'"); + if ($reply===false) my_logger('publish', "curl to $endpoint failed"); return $reply; } ?> diff --git a/emhttp/plugins/dynamix/scripts/netconfig b/emhttp/plugins/dynamix/scripts/netconfig index 0621a9c97..7aca65912 100755 --- a/emhttp/plugins/dynamix/scripts/netconfig +++ b/emhttp/plugins/dynamix/scripts/netconfig @@ -12,6 +12,9 @@ */ ?> Date: Thu, 1 Feb 2024 20:31:25 -0700 Subject: [PATCH 2/4] remove dependency on webgui the plugin script should be at /usr/local/sbin/plugin, independent of the webgui --- .../dynamix.plugin.manager/scripts/plugin | 43 ++++++++++--------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/emhttp/plugins/dynamix.plugin.manager/scripts/plugin b/emhttp/plugins/dynamix.plugin.manager/scripts/plugin index f49afb17d..316ecb268 100755 --- a/emhttp/plugins/dynamix.plugin.manager/scripts/plugin +++ b/emhttp/plugins/dynamix.plugin.manager/scripts/plugin @@ -6,9 +6,6 @@ // Program updates made by Bergware International (April 2020) // Program updates made by Bergware International (June 2022) -$docroot ??= ($_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp'); -require_once "$docroot/webGui/include/Wrappers.php"; - $usage = <<SHA256) { - my_logger('plugin-manager',"checking: $name - SHA256"); + logger("checking: $name - SHA256"); if (hash_file('sha256', $name) != $file->SHA256) { unlink($name); } } elseif ($file->MD5) { - my_logger('plugin-manager',"checking: $name - MD5"); + logger("checking: $name - MD5"); if (md5_file($name) != $file->MD5) { unlink($name); } @@ -393,12 +396,12 @@ function plugin($method, $plugin_file, &$error) { // If file already exists, do not overwrite // if (file_exists($name)) { - my_logger('plugin-manager',"skipping: $name already exists"); + logger("skipping: $name already exists"); } elseif ($file->LOCAL) { // Create the file // // for local file, just copy it - my_logger('plugin-manager',"creating: $name - copying LOCAL file $file->LOCAL"); + logger("creating: $name - copying LOCAL file $file->LOCAL"); if (!copy($file->LOCAL, $name)) { $error = "unable to copy LOCAL file: $name"; @unlink($name); @@ -406,10 +409,10 @@ function plugin($method, $plugin_file, &$error) { } } elseif ($file->INLINE) { // for inline file, create with inline contents - my_logger('plugin-manager',"creating: $name - from INLINE content"); + logger("creating: $name - from INLINE content"); $contents = trim($file->INLINE).PHP_EOL; if ($file->attributes()->Type == 'base64') { - my_logger('plugin-manager',"decoding: $name as base64"); + logger("decoding: $name as base64"); $contents = base64_decode($contents); if ($contents === false) { $error = "unable to decode inline base64: $name"; @@ -423,20 +426,20 @@ function plugin($method, $plugin_file, &$error) { } } elseif ($file->URL) { // for download file, download and maybe verify the file MD5 - my_logger('plugin-manager',"creating: $name - downloading from URL $file->URL"); + logger("creating: $name - downloading from URL $file->URL"); if ( (download($file->URL, $name, $error) === false) && (download(filter_url($file->URL), $name, $error) === false) ) { @unlink($name); return false; } if ($file->SHA256) { - my_logger('plugin-manager',"checking: $name - SHA256"); + logger("checking: $name - SHA256"); if (hash_file('sha256', $name) != $file->SHA256) { $error = "bad file SHA256: $name"; unlink($name); return false; } } elseif ($file->MD5) { - my_logger('plugin-manager',"checking: $name - MD5"); + logger("checking: $name - MD5"); if (md5_file($name) != $file->MD5) { $error = "bad file MD5: $name"; unlink($name); @@ -449,7 +452,7 @@ function plugin($method, $plugin_file, &$error) { if ($file->attributes()->Mode) { // if file has 'Mode' attribute, apply it $mode = $file->attributes()->Mode; - my_logger('plugin-manager',"setting: $name - mode to $mode"); + logger("setting: $name - mode to $mode"); if (!chmod($name, octdec($mode))) { $error = "chmod failure: $name"; return false; @@ -461,13 +464,13 @@ function plugin($method, $plugin_file, &$error) { if ($file->attributes()->Run) { $command = $file->attributes()->Run; if ($name) { - my_logger('plugin-manager',"running: $command $name"); + logger("running: $command $name"); $retval = run("$command $name"); } elseif ($file->LOCAL) { - my_logger('plugin-manager',"running: $command $file->LOCAL"); + logger("running: $command $file->LOCAL"); $retval = run("$command $file->LOCAL"); } elseif ($file->INLINE) { - my_logger('plugin-manager',"running: 'anonymous'"); + logger("running: 'anonymous'"); $name = '/tmp/inline.sh'; file_put_contents($name, $file->INLINE); $retval = run("$command $name"); @@ -715,10 +718,10 @@ if ($method == 'install') { if ($target != $plugin_file) copy($plugin_file, $target); symlink($target, $symlink); write("plugin: $plugin installed\n"); - my_logger('plugin-manager',"$plugin installed"); + logger("$plugin installed"); } else { write("script: $plugin executed\n"); - my_logger('plugin-manager',"script: $plugin executed"); + logger("script: $plugin executed"); } // run hook scripts for post processing post_hooks(); @@ -832,7 +835,7 @@ if ($method == 'update') { copy($plugin_file, $target); symlink($target, $symlink); write("plugin: $plugin updated\n"); - my_logger('plugin-manager',"$plugin updated"); + logger("$plugin updated"); // run hook scripts for post processing post_hooks(); done(0); @@ -864,7 +867,7 @@ if ($method == 'remove') { // remove the plugin file move($installed_plugin_file, "$boot-removed"); write("plugin: $plugin removed\n"); - my_logger('plugin-manager',"$plugin removed"); + logger("$plugin removed"); exec("/usr/local/sbin/update_cron"); // run hook scripts for post processing post_hooks(); From 551f85ad92ee781d2f3ca53455eb90b47105d0b4 Mon Sep 17 00:00:00 2001 From: ljm42 Date: Fri, 2 Feb 2024 12:51:23 -0700 Subject: [PATCH 3/4] escape more params --- emhttp/plugins/dynamix.plugin.manager/scripts/plugin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emhttp/plugins/dynamix.plugin.manager/scripts/plugin b/emhttp/plugins/dynamix.plugin.manager/scripts/plugin index 316ecb268..b2c767f9f 100755 --- a/emhttp/plugins/dynamix.plugin.manager/scripts/plugin +++ b/emhttp/plugins/dynamix.plugin.manager/scripts/plugin @@ -691,7 +691,7 @@ if ($method == 'install') { $event = "Install error"; $subject = "plugin: ".basename($plugin_file); $description = "Plugin failed to install"; - exec("$notify -e $event -s $subject -d $description) -i 2"); + exec("$notify -e ".escapeshellarg($event)." -s ".escapeshellarg($subject)." -d ".escapeshellarg($description)." -i 'warning'"); // run hook scripts for post processing post_hooks($error); done(1); From 0287d8dfac321f7b20373b96f0a46fdf6ecbe662 Mon Sep 17 00:00:00 2001 From: ljm42 Date: Fri, 2 Feb 2024 13:02:40 -0700 Subject: [PATCH 4/4] my_logger: make the tag optional --- .../dynamix.docker.manager/include/DockerClient.php | 2 +- emhttp/plugins/dynamix/include/.login.php | 10 +++++----- emhttp/plugins/dynamix/include/.set-password.php | 2 +- emhttp/plugins/dynamix/include/PageBuilder.php | 2 +- emhttp/plugins/dynamix/include/Wrappers.php | 2 +- emhttp/plugins/dynamix/include/publish.php | 4 ++-- emhttp/plugins/dynamix/scripts/netconfig | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php index 0553b9334..6e57960ff 100644 --- a/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php +++ b/emhttp/plugins/dynamix.docker.manager/include/DockerClient.php @@ -367,7 +367,7 @@ class DockerTemplates { @copy($iconRAM,$icon); } if (!is_file($iconRAM)) { - my_logger('webGUI', "$contName: Could not download icon $imgUrl"); + my_logger("$contName: Could not download icon $imgUrl"); } return (is_file($iconRAM)) ? str_replace($docroot, '', $iconRAM) : ''; diff --git a/emhttp/plugins/dynamix/include/.login.php b/emhttp/plugins/dynamix/include/.login.php index aac485100..103fed3c1 100644 --- a/emhttp/plugins/dynamix/include/.login.php +++ b/emhttp/plugins/dynamix/include/.login.php @@ -119,12 +119,12 @@ function verifyTwoFactorToken(string $username, string $token): bool { // This should accept 200 or 204 status codes if ($httpCode !== 200 && $httpCode !== 204) { // Log error to syslog - my_logger('webGUI', "2FA code for {$username} is invalid, blocking access!"); + my_logger("2FA code for {$username} is invalid, blocking access!"); return false; } // Log success to syslog - my_logger('webGUI', "2FA code for {$username} is valid, allowing login!"); + my_logger("2FA code for {$username} is valid, allowing login!"); // Success return true; @@ -199,7 +199,7 @@ if (!empty($username) && !empty($password)) { // Check if we're limited if ($failCount >= $maxFails) { - if ($failCount == $maxFails) my_logger('webGUI', "Ignoring login attempts for {$username} from {$remote_addr}"); + if ($failCount == $maxFails) my_logger("Ignoring login attempts for {$username} from {$remote_addr}"); throw new Exception(_('Too many invalid login attempts')); } @@ -216,7 +216,7 @@ if (!empty($username) && !empty($password)) { $_SESSION['unraid_user'] = $username; session_regenerate_id(true); session_write_close(); - my_logger('webGUI', "Successful login user {$username} from {$remote_addr}"); + my_logger("Successful login user {$username} from {$remote_addr}"); // Redirect the user to the start page header("Location: /".$start_page); @@ -226,7 +226,7 @@ if (!empty($username) && !empty($password)) { $error = $exception->getMessage(); // Log error to syslog - my_logger('webGUI', "Unsuccessful login user {$username} from {$remote_addr}"); + my_logger("Unsuccessful login user {$username} from {$remote_addr}"); appendToFile($failFile, $time."\n"); } } diff --git a/emhttp/plugins/dynamix/include/.set-password.php b/emhttp/plugins/dynamix/include/.set-password.php index f19b97b91..628532069 100644 --- a/emhttp/plugins/dynamix/include/.set-password.php +++ b/emhttp/plugins/dynamix/include/.set-password.php @@ -36,7 +36,7 @@ if (!empty($_POST['password']) && !empty($_POST['confirmPassword'])) { } // Error when attempting to set password - my_logger('webGUI', "{$VALIDATION_MESSAGES['saveError']} [REMOTE_ADDR]: {$REMOTE_ADDR}"); + my_logger("{$VALIDATION_MESSAGES['saveError']} [REMOTE_ADDR]: {$REMOTE_ADDR}"); return $POST_ERROR = $VALIDATION_MESSAGES['saveError']; } diff --git a/emhttp/plugins/dynamix/include/PageBuilder.php b/emhttp/plugins/dynamix/include/PageBuilder.php index e2c88ff4d..19bdc1fbc 100644 --- a/emhttp/plugins/dynamix/include/PageBuilder.php +++ b/emhttp/plugins/dynamix/include/PageBuilder.php @@ -33,7 +33,7 @@ function build_pages($pattern) { foreach (glob($pattern,GLOB_NOSORT) as $entry) { [$header, $content] = my_explode("\n---\n",file_get_contents($entry)); $page = @parse_ini_string($header); - if (!$page) {my_logger('webGUI', "Invalid .page format: $entry"); continue;} + if (!$page) {my_logger("Invalid .page format: $entry"); continue;} $page['file'] = $entry; $page['root'] = dirname($entry); $page['name'] = basename($entry, '.page'); diff --git a/emhttp/plugins/dynamix/include/Wrappers.php b/emhttp/plugins/dynamix/include/Wrappers.php index 3297aea09..f97b1ab8d 100644 --- a/emhttp/plugins/dynamix/include/Wrappers.php +++ b/emhttp/plugins/dynamix/include/Wrappers.php @@ -146,7 +146,7 @@ function my_date($fmt, $time) { return date(strtr($fmt,$legacy), $time); } // ensure params passed to logger are properly escaped -function my_logger($tag, $message) { +function my_logger($message, $tag="webgui") { exec('logger -t '.escapeshellarg($tag).' -- '.escapeshellarg($message)); } ?> diff --git a/emhttp/plugins/dynamix/include/publish.php b/emhttp/plugins/dynamix/include/publish.php index 87bf0d3f3..66d42ac9e 100644 --- a/emhttp/plugins/dynamix/include/publish.php +++ b/emhttp/plugins/dynamix/include/publish.php @@ -20,7 +20,7 @@ function curl_socket($socket, $url, $message='') { if ($message) curl_setopt_array($com, [CURLOPT_POSTFIELDS => $message, CURLOPT_POST => 1]); $reply = curl_exec($com); curl_close($com); - if ($reply===false) my_logger('curl_socket', "curl to $url failed"); + if ($reply===false) my_logger("curl to $url failed", 'curl_socket'); return $reply; } @@ -35,7 +35,7 @@ function publish($endpoint, $message, $len=1) { ]); $reply = curl_exec($com); curl_close($com); - if ($reply===false) my_logger('publish', "curl to $endpoint failed"); + if ($reply===false) my_logger("curl to $endpoint failed", 'publish'); return $reply; } ?> diff --git a/emhttp/plugins/dynamix/scripts/netconfig b/emhttp/plugins/dynamix/scripts/netconfig index 7aca65912..8dcca64df 100755 --- a/emhttp/plugins/dynamix/scripts/netconfig +++ b/emhttp/plugins/dynamix/scripts/netconfig @@ -28,7 +28,7 @@ function update_wireguard($ifname) { $vtun = basename($wg,'.conf'); // interface has changed? if (exec("grep -Pom1 ' dev $nic ' $wg")=='') { - my_logger('netconfig', "updated wireguard $vtun configuration"); + my_logger("updated wireguard $vtun configuration", 'netconfig'); exec("sed -ri 's/ dev (br0|bond0|eth0) / dev $nic /' $wg"); } // restart active wireguard tunnels