xebialabs / overthere

Runs something "Over there"

Home Page:http://www.xebialabs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Disabling smb v1 results in com.xebialabs.overthere.RuntimeIOException

Rob19999 opened this issue · comments

commented

Recently we disabled smb v1 on our Windows environment. This result in the error below. Is there a way to configure the overthere framework to use SMB v2.X? The bug was confirmed when re-enabling smb v1. Currently we are using XLDeploy version 5.5.7 but I couldnt find a potential fix in the release notes of newer versions.

Uploading file to the temporary directory...
Cannot transfer files to x.x.x.x.x Please check the connection settings.
com.xebialabs.overthere.RuntimeIOException: Cannot determine existence of \1x.x.x.x.x\C$\windows\temp\ot-20170609T153247145: jcifs.smb.SmbException: Failed to connect: 0.0.0.0<00>/1x.x.x.x.x
jcifs.util.transport.TransportException
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at jcifs.util.transport.Transport.readn(Transport.java:29)
at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:388)
at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:288)
at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:319)
at jcifs.util.transport.Transport.run(Transport.java:241)
at java.lang.Thread.run(Unknown Source)

at jcifs.util.transport.Transport.run(Transport.java:258)
at java.lang.Thread.run(Unknown Source)

at com.xebialabs.overthere.cifs.CifsFile.exists(CifsFile.java:89)
at com.xebialabs.overthere.spi.BaseOverthereConnection.getTempFile(BaseOverthereConnection.java:190)
at com.xebialabs.overthere.spi.BaseOverthereConnection.getTempFile(BaseOverthereConnection.java:165)
at com.xebialabs.deployit.plugin.overthere.step.CheckFileTransferStep.uploadFile(CheckFileTransferStep.java:61)
at com.xebialabs.deployit.plugin.overthere.step.CheckFileTransferStep.execute(CheckFileTransferStep.java:49)
at com.xebialabs.deployit.engine.tasker.StepExecutingActor.executeStep(StepExecutingActor.scala:90)
at com.xebialabs.deployit.engine.tasker.StepExecutingActor$$anonfun$receiveExecute$1.applyOrElse(StepExecutingActor.scala:54)
at scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:36)
at com.xebialabs.deployit.engine.tasker.ReceiveWithMdc.apply(ReceiveWithMdc.scala:58)
at com.xebialabs.deployit.engine.tasker.ReceiveWithMdc.apply(ReceiveWithMdc.scala:33)
at scala.PartialFunction$class.applyOrElse(PartialFunction.scala:123)
at com.xebialabs.deployit.engine.tasker.ReceiveWithMdc.applyOrElse(ReceiveWithMdc.scala:33)
at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
at akka.actor.Actor$class.aroundReceive(Actor.scala:482)
at com.xebialabs.deployit.engine.tasker.StepExecutingActor.aroundReceive(StepExecutingActor.scala:36)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
at akka.actor.ActorCell.invoke(ActorCell.scala:495)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
at akka.dispatch.Mailbox.run(Mailbox.scala:224)
at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Caused by: jcifs.smb.SmbException: Failed to connect: 0.0.0.0<00>/x.x.x.x.x
jcifs.util.transport.TransportException
java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at jcifs.util.transport.Transport.readn(Transport.java:29)
at jcifs.smb.SmbTransport.peekKey(SmbTransport.java:388)
at jcifs.smb.SmbTransport.negotiate(SmbTransport.java:288)
at jcifs.smb.SmbTransport.doConnect(SmbTransport.java:319)
at jcifs.util.transport.Transport.run(Transport.java:241)
at java.lang.Thread.run(Unknown Source)

at jcifs.util.transport.Transport.run(Transport.java:258)
at java.lang.Thread.run(Unknown Source)

at jcifs.smb.SmbTransport.connect(SmbTransport.java:309)
at jcifs.smb.SmbTree.treeConnect(SmbTree.java:156)
at jcifs.smb.SmbFile.doConnect(SmbFile.java:911)
at jcifs.smb.SmbFile.connect(SmbFile.java:954)
at jcifs.smb.SmbFile.connect0(SmbFile.java:880)
at jcifs.smb.SmbFile.queryPath(SmbFile.java:1335)
at jcifs.smb.SmbFile.exists(SmbFile.java:1417)
at com.xebialabs.overthere.cifs.CifsFile.exists(CifsFile.java:87)
... 23 more

Hi Rob,

Yes there is such a possibility. From 5.5.6 onwards XLD has support for the SMBv2 protocol suite. You need to convert your overthere.CifsHost hosts to overthere.SmbHost hosts.

There is a converter plugin available at: https://github.com/xebialabs-community/xld-overthere-smb-converter-plugin

Also the regular XL support channel guys have some tools/scripts to help you.

commented

Thank you for the quick responce.

Hello, I know this issue is closed, but has this been addressed in the "regular" overthere libraries (i.e. not just XLD)? I am also seeing this issue in my overthere libraries (v5.0.2).

For overthere you need to switch to a different connection type (i.e. SMB instead of CIFS) to take advantage of the SMBv2 support.

Does that mean I create my connection with Overthere.getConnection(SmbConnectionBuilder.SMB_PROTOCOL, options) instead of Overthere.getConnection(CifsConnectionBuilder.CIFS_PROTOCOL, options)?

If that's the case, how do I configure the WINRM_INTERNAL connection type?

Thanks for any help!

The same as with CIFS_PROTOCOL. You just set the connectionType option in the ConnectionOptions.

Thank you! I am able to make the change to use SMB instead of CIFS, however, when I try to use WinRM over HTTP, I am unable to execute any commands, they result in a connection timeout. The process is that I make the connection, and copy a zip file and an "unzip.exe" file to the remote host. That works fine. When I then execute the "unzip.exe" command to extract the zip file contents, I get the following:

29/08/2018 22:43:24.045 INFO org.cisecurity.session.impl.BaseSession - Obtaining reference to a temporary file on the remote host
29/08/2018 22:43:24.052 INFO com.hierynomus.smbj.session.Session - Connecting to \\ip-0A0300AE\C$ on session 598134325510177
29/08/2018 22:43:24.483 INFO org.cisecurity.session.impl.BaseSession - Obtained 'temp' path --> C:\CIS\ot-20180829T224323531\
29/08/2018 22:43:24.484 INFO org.cisecurity.session.impl.BaseSession - postConnect - Copying scripts from local:C:\ASSESSOR-RELEASE\Assessor-CLI\scripts to remote directory C:\CIS\ot-20180829T224323531\
29/08/2018 22:43:39.517 INFO org.cisecurity.session.impl.BaseSession - postConnect - Script copy finished...
29/08/2018 22:43:39.517 INFO org.cisecurity.session.impl.BaseSession - postConnect - [ END ]
29/08/2018 22:43:39.526 INFO org.cisecurity.wrapper.SessionUtilities - Connection type is Windows:
29/08/2018 22:43:39.527 INFO org.cisecurity.wrapper.SessionUtilities - --> Unzipping [START]
29/08/2018 22:43:39.540 INFO com.xebialabs.overthere.winrm.WinRmConnection - Starting command [C:\CIS\ot-20180829T224323531\unzip.exe -o -qq C:\CIS\ot-20180829T224323531\scripts.zip -d C:\CIS\ot-20180829T224323531\] on [com.xebialabs.overthere.winrm.WinRmConnection@2098d37d]
29/08/2018 22:44:00.770 ERROR org.cisecurity.wrapper.SessionUtilities - Exception Creating Session!
com.xebialabs.overthere.winrm.WinRmRuntimeIOException: Error when sending request to http://ip-0A0300AE:5985/wsman
Request:
<?xml version="1.0" encoding="UTF-8"?>

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
  <env:Header>
    <a:To xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">http://ip-0A0300AE:5985/wsman</a:To>
    <a:ReplyTo xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">
      <a:Address mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</a:Address>
    </a:ReplyTo>
    <w:MaxEnvelopeSize xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" mustUnderstand="true">307200</w:MaxEnvelopeSize>
    <a:MessageID xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing">uuid:B685292B-597F-4CDA-8E00-C28A63E2030E</a:MessageID>
    <w:Locale xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" mustUnderstand="false" xml:lang="en-US"/>
    <p:DataLocale xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd" mustUnderstand="false" xml:lang="en-US"/>
    <w:OperationTimeout xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">PT3600.000S</w:OperationTimeout>
    <a:Action xmlns:a="http://schemas.xmlsoap.org/ws/2004/08/addressing" mustUnderstand="true">http://schemas.xmlsoap.org/ws/2004/09/transfer/Create</a:Action>
    <w:ResourceURI xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" mustUnderstand="true">http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd</w:ResourceURI>
    <w:OptionSet xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
      <w:Option Name="WINRS_NOPROFILE">FALSE</w:Option>
      <w:Option Name="WINRS_CODEPAGE">437</w:Option>
    </w:OptionSet>
  </env:Header>
  <env:Body>
    <rsp:Shell xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell">
      <rsp:InputStreams>stdin</rsp:InputStreams>
      <rsp:OutputStreams>stdout stderr</rsp:OutputStreams>
    </rsp:Shell>
  </env:Body>
</env:Envelope>

Response:
[EMPTY]
	at com.xebialabs.overthere.winrm.WinRmClient.doSendRequest(WinRmClient.java:441)
	at com.xebialabs.overthere.winrm.WinRmClient.sendRequest(WinRmClient.java:345)
	at com.xebialabs.overthere.winrm.WinRmClient.createShell(WinRmClient.java:149)
	at com.xebialabs.overthere.winrm.WinRmConnection.startProcess(WinRmConnection.java:114)
	at com.xebialabs.overthere.smb.SmbProcessConnection.startProcess(SmbProcessConnection.java:67)
	at com.xebialabs.overthere.spi.BaseOverthereConnection.execute(BaseOverthereConnection.java:272)
	at com.xebialabs.overthere.spi.BaseOverthereConnection.execute(BaseOverthereConnection.java:267)
	at com.xebialabs.overthere.OverthereConnection$execute$0.call(Unknown Source)
	...
	...
	...
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to ip-0A0300AE:5985 [ip-0A0300AE/13.56.133.120] failed: Connection timed out: connect
	at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:151)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)
	at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
	at com.xebialabs.overthere.winrm.WinRmClient.doSendRequest(WinRmClient.java:414)
	... 64 common frames omitted
Caused by: java.net.ConnectException: Connection timed out: connect
	at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
	at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
	at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
	at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)

This is similar to another issue I reported, #220

Again, thanks for any help, I very much appreciate it!