Skip to content

reef: mds/client: check the cephx mds auth access in client side#54468

Merged
batrick merged 25 commits intoceph:reeffrom
lxbsz:wip-62952
Mar 27, 2024
Merged

reef: mds/client: check the cephx mds auth access in client side#54468
batrick merged 25 commits intoceph:reeffrom
lxbsz:wip-62952

Conversation

@lxbsz
Copy link
Member

@lxbsz lxbsz commented Nov 13, 2023

backport tracker: https://tracker.ceph.com/issues/62952


backport of #48027 and #53887
parent tracker: https://tracker.ceph.com/issues/57154

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@lxbsz lxbsz requested a review from a team November 13, 2023 02:09
@lxbsz lxbsz requested a review from a team as a code owner November 13, 2023 02:09
@github-actions github-actions bot added this to the reef milestone Nov 13, 2023
@lxbsz
Copy link
Member Author

lxbsz commented Nov 29, 2023

jenkins retest this please

@github-actions
Copy link

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@lxbsz
Copy link
Member Author

lxbsz commented Mar 18, 2024

Rebased it.

Copy link
Member

@batrick batrick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lxbsz added 6 commits March 27, 2024 08:42
Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 5b6634c)
Will send this to clients.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 53caf31)
Need to add writeable/readable members and send them back to clients.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 6e4a644)
It will include the uid/gids and path in each cap_auth.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 213a27a)
Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit c1cbb9a)

Conflicts:
	src/mds/MDSAuthCaps.h: missed dependency commit 23f1fdb
	("AuthMonitor: allow "fs authorize" to update caps")
Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 27f73a9)
lxbsz and others added 12 commits March 27, 2024 08:42
Make it to be easier to debug when searching the debug logs.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit fa687be)
Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 429aafb)
Will use this to get the path string to do the mds auth check. It
may fail when the there is no any dentry in local cache, which could
be caused by just unlinking the last dentry while the inode keeps
opening and then try to change the mode.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit fd7aaab)
Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 01a9398)

Conflicts:
	src/client/Client.cc: conflict with commit 997b917
	("client: always refresh mds feature bits on session open")
If couldn't get the absolute path string we need to force it to
do the sync setattr.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit c1bf8d8)
This feature bit could be used to distinguish old and new clients.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit b2046fc)
Since the setattr will check the cephx mds auth access before
buffering the changes, so it makes no sense any more to let the
cap update to check the access in MDS again.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit f474203)

Conflicts:
	src/client/Client.cc: missed dependency commit a8d0158
	("Client/Inode: wait_for_caps fixups")
Before opening the file locally we need to check the cephx access.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit ce21659)
as it's too late. Session access authorization already happens
before new caps are issued.

Fixes: https://tracker.ceph.com/issues/56067
Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit 96305b5)
... MDS auth caps but don't have CEPHFS_FEATURE_MDS_AUTH_CAPS_CHECK
feature bit (i.e., can't check the auth caps sent back to it by the
MDS) from establishing a session. Do this in
Server::handle_client_session(), and Server::handle_client_reconnect(),
where old clients try to reconnect to MDS servers after an upgrade.

If the client doesn't have the ability to authorize session access
based on the MDS auth caps send back to it by the MDS, then the
client may buffer changes locally during open and setattr operations
when it's not supposed to, e.g., when enforcing root_squash MDS auth
caps.

Fixes: https://tracker.ceph.com/issues/56067
Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit e64931b)
The test.cc will be included in ceph_test_libcephfs, no need to
include it to access.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 77ac100)
Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 4af6a3f)
@lxbsz lxbsz force-pushed the wip-62952 branch 2 times, most recently from 1df81f6 to 8245071 Compare March 27, 2024 02:38
lxbsz and others added 7 commits March 27, 2024 12:19
Test the 'chown' and 'truncate', which will call the setattr and
'cat' will open the files. Before each testing will open the file
by non-root user and keep it to make sure the Fxw caps are issued,
and then user the 'sudo' do to the tests, which will set the uid/gid
to 0/0.

Fixes: https://tracker.ceph.com/issues/57154
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 28023f8)

Conflicts:
	qa/tasks/cephfs/caps_helper.py: missed dependency commit
	f0ffade("qa/cephfs/cap_tester: simplify CapTester and its
	instantiation")
…6067

A kernel CephFS client with MDS root_squash caps is able to write to a
file as non-root user. However, the data written is lost after clearing
the kernel client cache, or re-mounting the client. This issue is not
observed with a FUSE CephFS client.

Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit c8bae07)
kclient doesn't have CEPHFS_FEATURE_MDS_AUTH_CAPS required to
enforce root_squash. Run root_squash tests only for FUSE client.

Signed-off-by: Ramana Raja <rraja@redhat.com>
(cherry picked from commit a040446)
The mountpoint's root ino# possibly not be the full CephFS
filesystem root, it's just the mountpoint of this particular client.
Just prepend the mountpoint path to the full path.

Introduced-by: c1bf8d8 client: check the cephx mds auth access for setattr
Introduced-by: ce21659 client: check the cephx mds auth access for open
Fixes: ceph#48027 (comment)
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit e46dc20)
Just in case we cannot link all the way to our mount point we will
force to do sync requests instead and let the MDS do the auth access
check.

Introduced-by: fd7aaab client: add make_path_string() helpers support
Fixes: ceph#48027 (comment)
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit c7bc452)
Fixes: https://tracker.ceph.com/issues/63364
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 188aed9)
Update the oldest_client_tid via the session renew caps msg to
make sure that the MDSs won't pile up the completed request list
in a very large size.

Fixes: https://tracker.ceph.com/issues/63364
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit 0cff6d5)
@lxbsz lxbsz requested a review from batrick March 27, 2024 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants