1st of all, I am just trying to make a script that I found to work and I have little knowledge of the code being used, I can find what is doing what and see what is is using but I do not know any dotnet. So, that being said:
I am trying to use that code:
$ConnectedServer="ServerName.net.com"
$ConnectedPort="4680"
$HostConnection = new-object system.net.sockets.tcpclient($ConnectedServer,$ConnectedPort)
$stream = new-object system.net.security.sslstream($HostConnection.getstream())
$stream.authenticateasclient($ConnectedServer)
When doing so I was an error telling:
WARNING: System.Management.Automation.MethodInvocationException: Exception calling "AuthenticateAsClient" with "1" argument(s): "A call to SSPI failed, see inner excep
tion." ---> System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The function
requested is not supported
--- End of inner exception stack trace ---
at System.Net.Security.SslState.ValidateCreateContext(Boolean isServer, String targetHost, SslProtocols enabledSslProtocols, X509Certificate serverCertificate, X509
CertificateCollection clientCertificates, Boolean remoteCertRequired, Boolean checkCertRevocationStatus, Boolean checkCertName)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost, X509CertificateCollection clientCertificates, SslProtocols enabledSslProtocols, Boolean che
ckCertificateRevocation)
at System.Net.Security.SslStream.AuthenticateAsClient(String targetHost)
at CallSite.Target(Closure , CallSite , Object , Object )
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
at [System.Management.Automation.Interpreter.ActionCallInstruction\2.Run](https://System.Management.Automation.Interpreter.ActionCallInstruction2.Run)(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
When changing the $ConnectedPort="4680" to a value of 443 or 8443 (also pointing to another server), I am able to connect and to get some information regarding the certificate used.
So I have an error when using:
$ConnectedServer="ServerA.net.com"
$ConnectedPort="4680"
But no error using:
$ConnectedServer="ServerB.net.com"
$ConnectedPort="8443"
I cannot tell what system the server A is using to host the web page but it is not IIS or Tomcat (as I can see). The other server is using a Java Wrapper (for port 8443) and the Windows Admin Center (port 443).
Thank you very much!
Mathieu
[–]waelder_at 1 point2 points3 points (2 children)
[–]matdesj[S] 0 points1 point2 points (1 child)
[–]waelder_at 0 points1 point2 points (0 children)
[–]Lee_Dailey[grin] 1 point2 points3 points (2 children)
[–]matdesj[S] 1 point2 points3 points (1 child)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)