Access to PS Remoting Client info in the constrained endpoint

Copper Contributor

Is there a way to query out PS Remoting Client details (like hostname, IP address, etc.) via the script\advanced function that's exposed through the constrained endpoint?

The scenario is that a new Windows Server VM (that's not domain joined) need to connect to an PowerShell endpoint using some credentials that are hardcoded into the VM template and I need the script running on the endpoint to be able to confirm that it is actually this particular client connecting (say by checking if there's a VM with such an IP running on a hypervisor) and not someone else pretending to be one by reusing those hardcoded credentials.

2 Replies

Well, depends on what you have configured for the endpoint. You might want to add some specific cmdlets to the session config file, such as Get-ComputerInfo. Or expose the env: PsDrive, etc.

 

For scenarios like this, it's best to use something like certificate auth. IP, hostname, machine name - all can easily be changed/spoofed.

@Vasil Michev, thanks for the quick reply. If I expose Get-ComputerInfo cmdlet, it would give me the details of the endpoint host machine and not of the client, unless there's a way to have it executed on the client side, is there?

 

Being able to query client's IP and hostname, will allow me to perform additional checks from the endpoint host side to make sure that it was not spoofed.

 

I agree, that using something like a cert authentication would be much a better approach, but currently I can't figure out a way to securely inject a new cert into each new VM (I'm building them using MDT, btw).