This commit is contained in:
Kevin Feiler
2025-10-16 03:34:17 +02:00
parent cbb20ba6ce
commit dccf4b1b4e
4 changed files with 64 additions and 8 deletions

View File

@@ -58,8 +58,11 @@ function _keyhelpmanager_APIRequest(
$apiKey = $params["serveraccesshash"] ?? "";
$useSSL = $params["serversecure"] ?? "on";
// Verify SSL is enabled by default for security
$verifySSL = "on";
// Check if SSL verification should be disabled
// Automatically disable for IP addresses or if serverhttpprefix is set to "no-verify"
$httpPrefix = $params["serverhttpprefix"] ?? "";
$isIpAddress = filter_var($hostname, FILTER_VALIDATE_IP) !== false;
$verifySSL = $httpPrefix === "no-verify" || $isIpAddress ? "off" : "on";
if (empty($hostname) || empty($apiKey)) {
return [
@@ -72,6 +75,17 @@ function _keyhelpmanager_APIRequest(
$protocol = $useSSL === "on" ? "https" : "http";
$url = sprintf("%s://%s/api/v2%s", $protocol, $hostname, $endpoint);
// Log warning if SSL verification is disabled
if ($verifySSL === "off") {
logActivity(
"KeyHelp Manager: SSL verification disabled for " .
$hostname .
($isIpAddress
? " (IP address detected)"
: " (manual override)"),
);
}
$client = new \GuzzleHttp\Client([
"verify" => $verifySSL === "on",
"timeout" => 30,