1
votes

I am using below code to connect to a Windows 2008 server.

WinRmTool.Builder builder = WinRmTool.Builder.builder("hostname", "domain\username", "password");
builder.setAuthenticationScheme(AuthSchemes.NTLM);
builder.useHttps(false);
WinRmTool tool =  builder.build();      
tool.executePs("COMMAND");

I am getting below exception

Caused by: java.io.IOException: Authorization loop detected on Conduit "{http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}WinRmPort.http-conduit" on URL "http://hostname:5985/wsman" with realm "null"

I am able to access the WS "http://hostname:5985/wsman" without any authentication in the browser and the winrm service settings on the Windows server are as below.

   AllowUnencrypted = false
    Auth
        Basic = false
        Kerberos = true
        Negotiate = true
        Certificate = false
        CredSSP = false
        CbtHardeningLevel = Relaxed
    DefaultPorts
        HTTP = 5985
        HTTPS = 5986

Settings are same on my client side also. HTTPS access to the winrm WS is not working, so I am using useHttps(false).

Client and Server are on different domains. I am able to successfully rdp to the server using the supplied hostname, domain\username & password.

I tried changing authentication schemes to kerberos/basic/digest. None of them seem to work. I tried 'allowUnencrypted=true' on both sides, but still doesnt work.

Am I missing any conf/prop files ?

1

1 Answers

1
votes

After configuring below settings on remote server, same code worked

winrm set winrm/config/service/Auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'