izouxv / smbapi

smbapi is a pure golang smb server library
19 stars 3 forks source link

Unable to authenticate using Windows File Explorer #2

Closed tobychui closed 7 months ago

tobychui commented 8 months ago

While I am testing this library I encountered the following error on Linux (Debian)

IP: 192.168.1.214:600132024/01/13 23:09:35 [ DEBUG ]  Negotiating protocol
2024/01/13 23:09:35 [ DEBUG ]  Sending NegotiateProtocolServer2 request
2024-01-13 23:09:35.896037      INFO    smb/session_ser.go:315  [CMD] cmd, CommandNegotiate
clientSupportDialect: [514 528 768 770 785]2024-01-13 23:09:35.89672    INFO    smb/session_ser.go:315  [CMD] cmd, CommandSessionSetup
2024/01/13 23:09:35 [ DEBUG ]
2024-01-13 23:09:35.897107      ERROR   smb/session_ser.go:142  requestSetUp2, err: read tcp 192.168.1.154:445->192.168.1.214:60013: read: connection reset by peer
2024-01-13 23:09:35.897191      INFO    smb/server.go:99        login failed, false, err: read tcp 192.168.1.154:445->192.168.1.214:60013: read: connection reset by peer

I have migrated the library into a separate repo as there are typo in the go.mod file module defination

module github/izouxv/smbapi

instead of

module github.com/izouxv/smbapi

which make it impossible to use with go get command.

After migration, I saw the above error when deploying a test server using the example script in a Debian VM environment and try to connect to it using Windows 10 File Explorer. The username and password are both correct and when Windows try to connect to it, it always shows connection reset by peer error.

圖片 The password request dialog is correctly shown though, so I guess there might be issue with the way how the library handle the authentication.

I am trying to debug this by tracing down the NegotiateProtocolServer() function but after some modification I still cant get it working.

Any help will be grateful, thanks for the great work!

izouxv commented 8 months ago

hi thank you for the issure. currently i have not enough time to mainten this git. i recommand you a candidate git for you http://github.com/macos-fuse-t/go-smb2

tobychui commented 8 months ago

@izouxv thanks for your reply! I did tried the project from macos-fuse-t but the issue is that the code in his repo cannot even be connected with Windows File Explorer (aka cant even reach the "ask for username and password" dialog). I think your code is much better structured than his so I decided to pick the project up using your repo instead.

Any clue will be fine, can you at least point me to the locations / parts that might have caused the issue where I can look into further? Many thanks!!!

izouxv commented 8 months ago

@tobychui hi

This folder have smb2 protocol pdf.

You can use wireshark to trace the traffic, compare windows or macos build in smb server protocol with the go server protcol.