-
Notifications
You must be signed in to change notification settings - Fork 555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CephFS keyring requires nonsensicaly enormous and insecure privileges to work #4677
Comments
Hi @benapetr, Except for permissions to work with CephFS, Ceph-CSI needs to store additional metadata for mapping of (CSI) volume-handles to CephFS details. This metadata is stored directly in Rados OMAPs, which should explain the need for extra permissions. If there is a reduced permission set that allows to work with CephFS and Rados, we obviously would appreciate guidance in dropping unneeded capabilities. Details about the required capabilities are documented in docs/capabilities.md. |
So does that mean that only safe and truly isolated way to allow multiple k8s clusters to use CephFS is to build dedicated CEPH cluster for each k8s cluster? That is indeed not very efficient. |
Multitenancy for each k8s cluster on a single ceph filesystem will be possible, with the PR #4652 . About mgr capabilities of ceph-csi:ceph-csi/internal/cephfs/core/volume.go Line 161 in d5849a4
This would call in ceph-go: And they can be limited via for each tenant via ceph capabilities Those are hopefully all the commands ceph-csi uses internally based on the source code.
See also https://docs.ceph.com/en/latest/rados/operations/user-management/ ´Manager capabilities can also be specified for specific commands, for all commands exported by a built-in manager service, or for all commands exported by a specific add-on module.´ Is this something you are willing to maintain that in future ceph-csi releases this list of |
So i had some time.
Caps for OSD / MDS
So whats happening, we ask CephFS with setfattr to place any data written to the subvolume in an specifc radosNamespace. With this caps we should reach multitenancy for CephFS. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week if no further activity occurs. Thank you for your contributions. |
This issue has been automatically closed due to inactivity. Please re-open if this still requires investigation. |
Describe the bug
Right now (I tried this with many combinations) the smallest working caps that work with CephFS storage class are those:
That is with dedicated FS "fs_k8s" namespace that is however intended to be shared by multiple separate clusters.
Removing or reducing any bit in any way results in errors like
Those permissions on low level grant:
This is enormous security hole that makes isolation within same FS namespace impossible. Only way to workaround this is to install dedicated CEPH cluster for each CephFS CSI consumer.
You can also create a dedicated FS namespace with own MDS, but that still doesn't prevent the CSI keyring from abusing the MGR rw caps.
Why are such enormous privileges needed? It's perfectly possible to work with CephFS without any access (even read-only is not needed) for metadata pool as only MDS is supposed to access that. RW OSD access is only needed for data pools that are used by folders that cluster subvolume group is mapped to, no need to map all of them.
MGR rw caps are probably needed to access to MGR API for subvolume management, but most of those operations can be handled via alternative ways, like .snap folders for snapshot creation.
Basically list of unnecessary permissions:
This is a big security obstacle if you want to create secure environment
Environment details
fuse
orkernel
. for rbd itskrbd
orrbd-nbd
) :fuseSteps to reproduce
Steps to reproduce the behavior:
Try to create keyring that is restricted only to specific data pool, with no access to metadatapool, or mgr. CephFS is going to be mountable and usable just fine with such keyring, but CephFS Storage class is going to be unusable (only permission denied for anything)
Actual results
Getting permission denied unless the keyring has almost admin-like caps
Expected behavior
Storage class should not require admin-like caps to work with CephFS. Regular restricted caps should be enough.
Logs
Additional context
This was already discussed in #1818 (comment)
The text was updated successfully, but these errors were encountered: