You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove com.hierynomus:smbj — the last runtime dependency of winrm-java — and replace the SMB-based temporary-share file copy with a file transfer performed through the WinRM command shell itself, the way dependency-free clients like pywinrm (Copy-Item helpers), winrs-based tooling, and Ansible's win_copy do it.
This is the final step of the zero-dependency goal of the winrm-light effort (#103–#108) and the actual fix for #116:
smbj cannot run on stock JDK crypto (it needs MD4 for NTLM, AES-CMAC for SMB 3.x signing, AES-CCM for SMB 3.x encryption — none of which are in SunJCE), which is why it drags in BouncyCastle. Removing smbj removes all of the above in one move and takes the standalone JAR from ~9 MB to a few hundred KB.
Proposed design
Transfer the file over the already-authenticated, already-encrypted WinRM channel — no new port (445), no separate SMB authentication, works through firewalls that only allow 5985/5986:
Base64-encode the local file and split it into chunks that fit comfortably within the WinRM MaxEnvelopeSize (pywinrm/Ansible use ~1 KB–8 KB per command leg; we can size chunks dynamically from the negotiated envelope size).
Append each chunk on the remote side via the command shell, e.g. echo <chunk> >> C:\Windows\Temp\<name>.b64.tmp, or preferably a single PowerShell invocation that reads chunks from stdin to reduce round-trips.
Decode once at the end: certutil -decode or PowerShell [IO.File]::WriteAllBytes(..., [Convert]::FromBase64String((Get-Content ...))), then delete the temp .b64 file.
Verify integrity by comparing a hash (certutil -hashfile / Get-FileHash SHA-256) against the locally computed digest; fail with a WindowsRemoteException on mismatch.
Clean up the remote temp artifacts on failure paths too.
Performance note: base64-over-SOAP is slower than SMB for large payloads. That is acceptable — the existing SmbTempShare/WindowsTempShare use case is copying small script files for execution, not bulk data. Document the expected use (small files) and consider a size guard with a clear error message.
Scope
Reimplement the SmbTempShare functionality (temporary remote directory + file copy + cleanup) on top of WindowsRemoteExecutor.executeCommand(...); keep the public API (WindowsTempShare contract) as stable as possible.
mvn dependency:tree shows zero runtime/compile dependencies (test scope only).
No org.bouncycastle, org.slf4j, net.engio, or com.hierynomus classes in the standalone JAR; JAR size back to a few hundred KB.
File copy works live against a real Windows host over NTLM/HTTP (encrypted) and HTTPS, including: file with multibyte UTF-8 content, binary file, empty file, and a file large enough to require multiple chunks.
Goal
Remove
com.hierynomus:smbj— the last runtime dependency of winrm-java — and replace the SMB-based temporary-share file copy with a file transfer performed through the WinRM command shell itself, the way dependency-free clients like pywinrm (Copy-Itemhelpers), winrs-based tooling, and Ansible'swin_copydo it.This is the final step of the zero-dependency goal of the winrm-light effort (#103–#108) and the actual fix for #116:
smbj cannot run on stock JDK crypto (it needs MD4 for NTLM, AES-CMAC for SMB 3.x signing, AES-CCM for SMB 3.x encryption — none of which are in SunJCE), which is why it drags in BouncyCastle. Removing smbj removes all of the above in one move and takes the standalone JAR from ~9 MB to a few hundred KB.
Proposed design
Transfer the file over the already-authenticated, already-encrypted WinRM channel — no new port (445), no separate SMB authentication, works through firewalls that only allow 5985/5986:
MaxEnvelopeSize(pywinrm/Ansible use ~1 KB–8 KB per command leg; we can size chunks dynamically from the negotiated envelope size).echo <chunk> >> C:\Windows\Temp\<name>.b64.tmp, or preferably a single PowerShell invocation that reads chunks from stdin to reduce round-trips.certutil -decodeor PowerShell[IO.File]::WriteAllBytes(..., [Convert]::FromBase64String((Get-Content ...))), then delete the temp.b64file.certutil -hashfile/Get-FileHashSHA-256) against the locally computed digest; fail with aWindowsRemoteExceptionon mismatch.Performance note: base64-over-SOAP is slower than SMB for large payloads. That is acceptable — the existing
SmbTempShare/WindowsTempShareuse case is copying small script files for execution, not bulk data. Document the expected use (small files) and consider a size guard with a clear error message.Scope
SmbTempSharefunctionality (temporary remote directory + file copy + cleanup) on top ofWindowsRemoteExecutor.executeCommand(...); keep the public API (WindowsTempSharecontract) as stable as possible.pom.xml.Acceptance criteria
mvn dependency:treeshows zero runtime/compile dependencies (test scope only).org.bouncycastle,org.slf4j,net.engio, orcom.hierynomusclasses in the standalone JAR; JAR size back to a few hundred KB.Closes the dependency-removal half of #116 (SLF4J) as a side effect.