mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Koester <jan.koester@gmx.net>
To: Namjae Jeon <linkinjeon@kernel.org>, Steve French <smfrench@gmail.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Tom Talpey <tom@talpey.com>,
	ChenXiaoSong <chenxiaosong@chenxiaosong.com>,
	linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 0/2] ksmbd: NTLM pass-through to a domain controller
Date: Sun, 18 Oct 2026 19:53:14 +0200	[thread overview]
Message-ID: <cover.1792345559.git.jan.koester@gmx.net> (raw)

Hi,

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.

The series is based on v7.3-rc7.

Jan Koester (2):
  ksmbd: pass through NTLM authentication to a domain controller
  ksmbd: put the workgroup into the NTLMSSP target info's domain names

 fs/smb/server/auth.c          | 109 +++++++++++++++++++++++++++++++---
 fs/smb/server/ksmbd_netlink.h |  41 +++++++++++++
 fs/smb/server/smb2pdu.c       |  21 ++++++-
 fs/smb/server/transport_ipc.c |  73 ++++++++++++++++++++++-
 fs/smb/server/transport_ipc.h |   3 +
 5 files changed, 236 insertions(+), 11 deletions(-)


base-commit: 32c52ec87d6245ee2d12ed5dd509e40062939b50
-- 
2.56.0


             reply	other threads:[~2026-10-18 17:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-18 17:53 Jan Koester [this message]
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

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=cover.1792345559.git.jan.koester@gmx.net \
    --to=jan.koester@gmx.net \
    --cc=chenxiaosong@chenxiaosong.com \
    --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=smfrench@gmail.com \
    --cc=tom@talpey.com \
    /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®