cifsd-team / ksmbd

ksmbd kernel server(SMB/CIFS server)
151 stars 23 forks source link

Fedora issue on connecting #553

Closed pesa1234 closed 2 years ago

pesa1234 commented 2 years ago

Dear, we found an issue on Fedora34...

If I try to connect to the ksmbd share... this is the log of ksmbd

Mon Jan 10 14:35:43 2022 kern.info kernel: [131355.155907] ksmbd: got SMB2 command
Mon Jan 10 14:35:43 2022 kern.info kernel: [131355.159518] ksmbd: SMB2 len 68
Mon Jan 10 14:35:43 2022 kern.info kernel: [131355.162673] ksmbd: credits: requested[1] granted[1] total_granted[385]
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.516420] ksmbd: got SMB2 command
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.520017] ksmbd: no length check for command
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.524566] ksmbd: SMB2 data length 0 offset 0
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.529125] ksmbd: SMB2 len 100
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.532366] ksmbd: cli req padded more than expected. Length 218 not 100 for cmd:0 mid:0
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.540590] ksmbd: client requested dialect 0x311
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.545403] ksmbd: selected SMB 3.1.1 dialect
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.549958] ksmbd: conn->dialect 0x311
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.553808] ksmbd: Received negotiate request
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.558278] ksmbd: decoding 3 negotiate contexts
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.563003] ksmbd: deassemble SMB2_PREAUTH_INTEGRITY_CAPABILITIES context
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.569913] ksmbd: deassemble SMB2_ENCRYPTION_CAPABILITIES context
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.576206] ksmbd: deassemble SMB2_NETNAME_NEGOTIATE_CONTEXT_ID context
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.582952] ksmbd: assemble SMB2_PREAUTH_INTEGRITY_CAPABILITIES context
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.589688] ksmbd: negotiate context offset 208, count 1
Mon Jan 10 14:35:50 2022 kern.info kernel: [131362.595110] ksmbd: credits: requested[31] granted[1] total_granted[1]

If I try to use... sudo mount -t cifs -o vers=2.0,username=username '\192.168.155.1\SambaShare' /mnt

All is ok...

mmakassikis commented 2 years ago

Hello,

Can you give more details on ksmbd version used and the config ?

I tested with fedora34 (kernel 5.11.12-300.fc34.aarch64) and I mounting with vers=3.1.1 works fine.

What error / log do you have client side ?

pesa1234 commented 2 years ago

KSMBD is 3.4.3

seems that the issue is coming only with nautilus, so, if I try to Connect to Server from nautilus I can not enter...

But, on terminal... sudo mount -t cifs -o vers=2.0,username=username '\192.168.181.1\SambaShare' /mnt works ok

or by edit fstab by add this line, no problem at all.. //192.168.181.1/SambaShare /media/SambaShare cifs username=username,password=password,cache=none,uid=1000,iocharset=utf8 0 0

namjaejeon commented 2 years ago

Can you tell me what is problem ? When I connecting ksmbd share using nautilus on ubuntu, It work fine.

pesa1234 commented 2 years ago

Can you tell me what is problem ? When I connecting ksmbd share using nautilus on ubuntu, It work fine.

Yes, on Ubuntu is working fine. On Fedora 34-35 by using nautilus, if you try to connect to ksmbd server it asking forever for username and password.

namjaejeon commented 2 years ago

Okay, If you use samba, it work fine ? If yes, Can you give me two tcpdump(or wireshark) files that capture packets on samba and ksmbd ? I would like to compare packets.

pesa1234 commented 2 years ago

dump.zip

It is attached.

Samba4 -> OK KSMBD -> NOT OK

fedora 35 nautilus mount (connect to server)

mmakassikis commented 2 years ago

Do you have the same auth configuration on ksmbd / samba4 ? ksmbd is responding with LOGON_FAILURE while the client is trying to authenticate as guest.

pesa1234 commented 2 years ago

Yes, completly same, otherwise I don't open an issue

namjaejeon commented 2 years ago

@pesa1234 Can you provide tcpdump with nautilus of ubuntu ?

namjaejeon commented 2 years ago

@pesa1234 and please share your smb.conf also...

pesa1234 commented 2 years ago

ubuntu_ksmbd_conf.zip

Here dump of ubuntu nautilus on ksmbd and it is ok.

On zip also conf of ksmbd and samba

namjaejeon commented 2 years ago

Can you check two things ?

  1. check if there is "nobody" account in your /etc/passwd in fedora.
  2. When you remove null passwords or set to "no" for samba, you can login samba share using nautilus ?
    ## allow client access to accounts that have null passwords. 
    null passwords = yes
pesa1234 commented 2 years ago
  1. yes available nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin
  2. yes working

Thanks

pesa1234 commented 2 years ago

Hi, any news? Thanks

namjaejeon commented 2 years ago

@pesa1234 Please try this patch (https://github.com/namjaejeon/ksmbd/commit/f1e91cd035b5227eec762b0a575b1aefa1156f6b)

pesa1234 commented 2 years ago

Yeah! It works! Thanks!!!