mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
Adds function to securely fetch remote endpoint address from clients
This commit is contained in:
parent
d97bc8aeb8
commit
7361fd801b
3 changed files with 14 additions and 2 deletions
|
|
@ -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)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
12
lib/web/Get-IcingaTCPClientRemoteEndpoint.psm1
Normal file
12
lib/web/Get-IcingaTCPClientRemoteEndpoint.psm1
Normal 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;
|
||||
}
|
||||
|
|
@ -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)
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue