icinga-powershell-framework/lib/daemons/RestAPI/client/Test-IcingaRESTClientConnection.psm1

23 lines
755 B
PowerShell
Raw Normal View History

function Test-IcingaRESTClientConnection()
{
param(
[Hashtable]$Connection = @{ }
);
# If we couldn't establish a proper SSL stream, close the connection
# immediately without opening a client connection thread
if ($null -eq $Connection.Stream) {
Add-IcingaRESTClientBlacklistCount `
-Client $Connection.Client `
2021-12-09 11:42:06 -05:00
-ClientList $Global:Icinga.Public.Daemons.RESTApi.ClientBlacklist;
Write-IcingaEventMessage -EventId 1501 -Namespace 'Framework' -Objects $Connection.Client.Client;
Close-IcingaTCPConnection -Client $Connection.Client;
$Connection = $null;
return $FALSE;
}
Write-IcingaDebugMessage 'Client connection has passed Test';
return $TRUE;
}