From: Stefan Metzmacher <metze@samba.org>
To: Namjae Jeon <linkinjeon@kernel.org>, Jan Koester <jan.koester@gmx.net>
Cc: linux-cifs@vger.kernel.org,
Sergey Senozhatsky <senozhatsky@chromium.org>,
samba-technical@lists.samba.org, linux-kernel@vger.kernel.org,
Tom Talpey <tom@talpey.com>, Wang Zhaolong <wangzhaolong@fygo.io>,
ChenXiaoSong <chenxiaosong@chenxiaosong.com>,
wang zhaolong <wangzhaolong@fnnas.com>
Subject: Re: [PATCH 0/2] ksmbd: NTLM pass-through to a domain controller
Date: Mon, 19 Oct 2026 12:43:31 +0200 [thread overview]
Message-ID: <0cadbdcf-6074-449c-98f9-3aeda3756160@samba.org> (raw)
In-Reply-To: <CAKYAXd_2AUVQFZWcmk55fBU2Rk-REb-onj38whT=kNCuZ=COew@mail.gmail.com>
Hi Jan,
>> a ksmbd server joined to an Active Directory domain can authenticate
>> domain users with Kerberos, but not with NTLM: it has no password hash
>> for them, so the NTLMv2 response can't be checked locally. Clients that
>> fall back to NTLM (access by IP address, machines outside the domain,
>> mount.cifs with user name and password) are refused.
>>
>> Samba solves this by forwarding the response to a domain controller
>> over NETLOGON (NetrLogonSamLogonEx on a schannel connection). These two
>> patches give ksmbd the kernel half of that, and leave the NETLOGON client
>> to user space, like the rest of ksmbd's user handling:
>>
>> 1/2 adds a KSMBD_USER_FLAG_PASSTHROUGH login flag. For such a user,
>> ksmbd_decode_ntlmssp_auth_blob() doesn't compute the response from a
>> local hash. It sends the server challenge, the user, domain and
>> workstation names and the NT/LM responses to user space in a new
>> KSMBD_EVENT_NTLM_AUTHEN_REQUEST event, then takes the session base
>> key from KSMBD_EVENT_NTLM_AUTHEN_RESPONSE and goes on with the
>> existing key exchange. Both events have a strict netlink policy and
>> are checked in ipc_validate_msg().
>>
>> 2/2 puts the workgroup, not the netbios name, into MsvAvNbDomainName and
>> MsvAvDnsDomainName of the challenge's target info. A domain
>> controller checks these when it verifies the NTLMv2 response (Samba
>> in NTLMv2_RESPONSE_verify_workstation()), so without this patch
>> every pass-through login fails with NT_STATUS_LOGON_FAILURE. The
>> patch also checks that the challenge blob fits the response buffer,
>> since the workgroup can be longer than the netbios name.
>>
>> Logins of users without the new flag are checked as before. The only
>> change they see is the domain names in the challenge's target info
>> (patch 2/2). ksmbd-tools doesn't set the flag yet. The user space side
>> we tested with is sharedd/adconnect from FenrirOS: it marks domain users
>> without a local hash as pass-through, and it answers the event through
>> a NETLOGON schannel client, tested against a Samba 4.22 AD DC.
>>
>> I can send the matching ksmbd-tools change if the interface looks
>> acceptable.
> Okay, Please send a PR to ksmbd-tools. Wang is also currently
> implementing AD/DC features in ksmbd and might be interested, so I'm
> adding him to CC.
why making this NTLM specific, I think it would be good to the whole session setup
blob exchange to userspace, so that authentication is not used in kernel at all?
And it will also help when IAKERB and other things will be implemented later.
It would also be good to have the infrastructure working with winbindd being
the bridge to the domain.
What exactly is "sharedd/adconnect from FenrirOS"?
And Wang, what are the AD/DC features?
metze
> Thanks for the patches!
next prev parent reply other threads:[~2026-10-19 10:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-18 17:53 Jan Koester
2026-10-18 17:53 ` [PATCH 1/2] ksmbd: pass through NTLM authentication " Jan Koester
2026-10-19 1:48 ` Namjae Jeon
2026-10-18 17:53 ` [PATCH 2/2] ksmbd: put the workgroup into the NTLMSSP target info's domain names Jan Koester
2026-10-19 2:00 ` Namjae Jeon
2026-10-19 1:31 ` [PATCH 0/2] ksmbd: NTLM pass-through to a domain controller Namjae Jeon
2026-10-19 10:43 ` Stefan Metzmacher [this message]
2026-10-19 13:02 ` Namjae Jeon
2026-10-20 13:54 ` Wang Zhaolong
2026-10-20 14:24 ` Ralph Boehme
2026-10-20 15:51 ` Wang Zhaolong
2026-10-21 8:56 ` Namjae Jeon
2026-10-20 19:40 ` ronnie sahlberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0cadbdcf-6074-449c-98f9-3aeda3756160@samba.org \
--to=metze@samba.org \
--cc=chenxiaosong@chenxiaosong.com \
--cc=jan.koester@gmx.net \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=senozhatsky@chromium.org \
--cc=tom@talpey.com \
--cc=wangzhaolong@fnnas.com \
--cc=wangzhaolong@fygo.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®