Adds function to securely fetch remote endpoint address from clients

This commit is contained in:
Christian Stein 2020-03-24 20:12:31 +01:00
parent d97bc8aeb8
commit 7361fd801b
3 changed files with 14 additions and 2 deletions

View file

@ -11,7 +11,7 @@ function Close-IcingaTCPConnection()
Write-IcingaDebugMessage -Message (
[string]::Format(
'Closing client connection for endpoint {0}',
$Client.Client.RemoteEndPoint
(Get-IcingaTCPClientRemoteEndpoint -Client $Client)
)
);

View file

@ -0,0 +1,12 @@
function Get-IcingaTCPClientRemoteEndpoint()
{
param(
[System.Net.Sockets.TcpClient]$Client = $null
);
if ($null -eq $Client) {
return 'unknown';
}
return $Client.Client.RemoteEndPoint;
}

View file

@ -13,7 +13,7 @@ function New-IcingaTCPClient()
Write-IcingaDebugMessage -Message (
[string]::Format(
'New incoming client connection for endpoint {0}',
$Client.Client.RemoteEndPoint
(Get-IcingaTCPClientRemoteEndpoint -Client $Client)
)
);