From: Stefan Metzmacher <metze@samba.org>
To: Christoph Hellwig <hch@lst.de>, Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-cifs@vger.kernel.org, aurelien.aptel@gmail.com,
linux-cifsd-devel@lists.sourceforge.net,
senozhatsky@chromium.org, rdunlap@infradead.org,
sandeen@sandeen.net, linux-kernel@vger.kernel.org,
aaptel@suse.com, hch@infradead.org, viro@zeniv.linux.org.uk,
ronniesahlberg@gmail.com, linux-fsdevel@vger.kernel.org,
colin.king@canonical.com, Steve French <stfrench@microsoft.com>
Subject: Re: [Linux-cifsd-devel] [PATCH 2/5] cifsd: add server-side procedures for SMB3
Date: Mon, 22 Mar 2021 14:25:24 +0100 [thread overview]
Message-ID: <7894be19-54f6-4c2c-daaa-1db03141e87c@samba.org> (raw)
In-Reply-To: <20210322065011.GA2909@lst.de>
[-- Attachment #1.1: Type: text/plain, Size: 2414 bytes --]
Am 22.03.21 um 07:50 schrieb Christoph Hellwig:
> On Mon, Mar 22, 2021 at 09:47:13AM +0300, Dan Carpenter wrote:
>> On Mon, Mar 22, 2021 at 02:13:41PM +0900, Namjae Jeon wrote:
>>> +static unsigned char
>>> +asn1_octet_decode(struct asn1_ctx *ctx, unsigned char *ch)
>>> +{
>>> + if (ctx->pointer >= ctx->end) {
>>> + ctx->error = ASN1_ERR_DEC_EMPTY;
>>> + return 0;
>>> + }
>>> + *ch = *(ctx->pointer)++;
>>> + return 1;
>>> +}
>>
>>
>> Make this bool.
>>
>
> More importantly don't add another ANS1 parser, but use the generic
> one in lib/asn1_decoder.c instead. CIFS should also really use it.
I think the best would be to avoid asn1 completely in the kernel
and do the whole authentication in userspace.
The kernel can only deal this blobs here, I don't there's need to
look inside the blobs.
1. ksmbd-mount would provide a fixed initial blob that's always
the same and will be returned in the
"2.2.4 SMB2 NEGOTIATE Response" PDU as SecurityBuffer
2. The kernel just blindly forwards the SecurityBuffer
of "2.2.5 SMB2 SESSION_SETUP Request" to userspace
together with the client provided SessionId (from
2.2.1.2 SMB2 Packet Header - SYNC) as well as
negotiated signing and encryption algorithm ids
and the latest preauth hash.
3. Userspace passes a NTSTATUS together with SecurityBuffer blob for the
2.2.6 SMB2 SESSION_SETUP Response back to the kernel:
- NT_STATUS_MORE_PROCESSING_REQUIRED (more authentication legs are required)
SecurityBuffer is most likely a non empty buffer
- NT_STATUS_OK - The authentication is complete:
SecurityBuffer might be empty or not
It also pass a channel signing key, a decryption and encrytion key
as well as the unix token ( I guess in the current form it's only uid/gid)
down to the kernel
- Any other status means the authentication failed, which is a hard error for the client
The PDU definitions are defined here:
https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-smb2/6eaf6e75-9c23-4eda-be99-c9223c60b181
I think everything else belongs to userspace.
Such a "simple" design for the kernel part, would mean that ksmbd-mount would do what the
kernel part is currently doing, but it also means it will be trivial to plug the userspace
part to samba's winbindd in future order to get domain wide authentication.
metze
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-03-22 13:26 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20210322052203epcas1p21fe2d04c4df5396c466c38f4d57d8bb8@epcas1p2.samsung.com>
2021-03-22 5:13 ` [PATCH 0/5] cifsd: introduce new SMB3 kernel server Namjae Jeon
[not found] ` <CGME20210322052204epcas1p1382cadbfe958d156c0ad9f7fcb8532b7@epcas1p1.samsung.com>
2021-03-22 5:13 ` [PATCH 1/5] cifsd: add server handler and tranport layers Namjae Jeon
2021-03-22 22:18 ` Matthew Wilcox
2021-03-23 3:01 ` Namjae Jeon
2021-03-23 3:12 ` Matthew Wilcox
2021-03-23 3:16 ` Namjae Jeon
[not found] ` <CGME20210322052206epcas1p438f15851216f07540537c5547a0a2c02@epcas1p4.samsung.com>
2021-03-22 5:13 ` [PATCH 2/5] cifsd: add server-side procedures for SMB3 Namjae Jeon
2021-03-22 6:47 ` Dan Carpenter
2021-03-22 6:50 ` Christoph Hellwig
2021-03-22 13:25 ` Stefan Metzmacher [this message]
2021-03-22 23:20 ` Namjae Jeon
2021-03-22 23:17 ` Namjae Jeon
2021-03-23 7:19 ` Dan Carpenter
2021-03-25 5:25 ` Sebastian Gottschall
2021-03-22 8:34 ` Matthew Wilcox
2021-03-22 10:27 ` Sergey Senozhatsky
2021-03-22 13:12 ` Matthew Wilcox
[not found] ` <CGME20210322052207epcas1p3f0a5bdfd2c994a849a67b465479d0721@epcas1p3.samsung.com>
2021-03-22 5:13 ` [PATCH 3/5] cifsd: add file operations Namjae Jeon
2021-03-22 6:55 ` Al Viro
2021-03-23 0:12 ` Namjae Jeon
2021-03-22 7:02 ` Al Viro
2021-03-22 9:26 ` Sergey Senozhatsky
2021-03-22 7:04 ` Dan Carpenter
2021-03-22 9:39 ` Sergey Senozhatsky
2021-03-22 8:15 ` Matthew Wilcox
2021-03-22 9:03 ` Sergey Senozhatsky
2021-03-22 13:02 ` Matthew Wilcox
2021-03-22 13:57 ` Christoph Hellwig
2021-03-22 14:40 ` Matthew Wilcox
2021-03-22 17:09 ` Matthew Wilcox
2021-03-23 0:05 ` Sergey Senozhatsky
2021-03-22 16:16 ` Schaufler, Casey
2021-03-23 0:21 ` Namjae Jeon
[not found] ` <CGME20210322052208epcas1p430b2e93761d5194844c533c61d43242d@epcas1p4.samsung.com>
2021-03-22 5:13 ` [PATCH 4/5] cifsd: add Kconfig and Makefile Namjae Jeon
[not found] ` <CGME20210322052209epcas1p377f1542bcc9ec50219d2e57aa92d944b@epcas1p3.samsung.com>
2021-03-22 5:13 ` [PATCH 5/5] MAINTAINERS: add cifsd kernel server 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=7894be19-54f6-4c2c-daaa-1db03141e87c@samba.org \
--to=metze@samba.org \
--cc=aaptel@suse.com \
--cc=aurelien.aptel@gmail.com \
--cc=colin.king@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-cifsd-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rdunlap@infradead.org \
--cc=ronniesahlberg@gmail.com \
--cc=sandeen@sandeen.net \
--cc=senozhatsky@chromium.org \
--cc=stfrench@microsoft.com \
--cc=viro@zeniv.linux.org.uk \
/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®