diff options
author | Christoph Schulthess | 2017-01-17 15:24:56 +0100 |
---|---|---|
committer | Christoph Schulthess | 2017-01-17 15:24:56 +0100 |
commit | 0bb7b216ae6e278d60523766ee6051ba6ee4e74c (patch) | |
tree | 2bba17b872a672eea04e174d2955a0d36d568dd3 | |
parent | [sysconfig] Handle invalid chars in logfile when doing htmlspecialchars() (diff) | |
download | slx-admin-0bb7b216ae6e278d60523766ee6051ba6ee4e74c.tar.gz slx-admin-0bb7b216ae6e278d60523766ee6051ba6ee4e74c.tar.xz slx-admin-0bb7b216ae6e278d60523766ee6051ba6ee4e74c.zip |
added debugrequest and functions in property
-rw-r--r-- | apis/debugrequest.php | 18 | ||||
-rw-r--r-- | inc/property.inc.php | 9 |
2 files changed, 27 insertions, 0 deletions
diff --git a/apis/debugrequest.php b/apis/debugrequest.php new file mode 100644 index 00000000..d9f1a169 --- /dev/null +++ b/apis/debugrequest.php @@ -0,0 +1,18 @@ +<?php + +$debug_settings = Property::getRemoteDebuggingConfig(); +if ($debug_settings["status"] !== "enabled") { + http_response_code(403); + exit; +} + +$debug_request = json_decode(file_get_contents("php://input")); + +$validclient = Database::queryFirst("SELECT * FROM machine WHERE machineuuid = :uuid AND clientip = :ip", array(":uuid" => $debug_request["uuid"], ":ip" => $_SERVER["REMOTE_ADDR"])); +if ($validclient == false) { + http_response_code(400); +} else { + http_response_code(200); + $data = json_encode(array("uuid" => $debug_request["uuid"], "ip" => $_SERVER["REMOTE_ADDR"], "port" => $debug_request["port"])); + Taskmanager::submit('relay', $data, true); +} diff --git a/inc/property.inc.php b/inc/property.inc.php index 9adfbda3..0eb700e3 100644 --- a/inc/property.inc.php +++ b/inc/property.inc.php @@ -191,4 +191,13 @@ class Property return self::get('default-ipxe'); } + public static function getRemoteDebugConfig() + { + return self::get('remote-debug-config'); + } + + public static function setRemoteDebugConfig($value) + { + return self::set('remote-debug-config', $value); + } } |