Skip to content
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

Enable CephFS encryption for CephFS subvolumes #1563

Closed
humblec opened this issue Oct 8, 2020 · 16 comments · Fixed by #3460
Closed

Enable CephFS encryption for CephFS subvolumes #1563

humblec opened this issue Oct 8, 2020 · 16 comments · Fixed by #3460
Labels
component/cephfs Issues related to CephFS enhancement New feature or request keepalive This label can be used to disable stale bot activiity in the repo

Comments

@humblec
Copy link
Collaborator

humblec commented Oct 8, 2020

Describe the feature you'd like to have

CephFS make use of fscrypt based encryption or it will be available soon.
Ref# https://lwn.net/Articles/829448/

We have to think about the possibilities of integration for the subvolumes we provision and manage from CSI.

CSI requirements can be summarized to below:

*) Each PVC is mapped to a subvolume in the backend
*) Each PVC has to be encrypted with a different key
     I believe in the `fscrypt` case, we will have a custom protector for “CSI” which is common for all the PVCs but will have a “seperate” protector key for each subvolume

*) The keys will be stored in a KMS engine and retrieved at time of mounting the volume to a workload/POD
*) The key retrieved from the KMS engine will be used for encrypting and decrypting the volume

*) Operations like “expansion”, “snapshot” , “Cloning to a new subvolume” on an existing PVC ..etc has to work without hiccups. 
*) Once the snapshot or clone is in place the parent/source volume can be deleted at any time. IOW, no dependency exist to the source/original volume used for snapshot/clone .

I would like to capture the thoughts or would like to discuss on fscrypt+ cephfs implmentation against satisfying above requirements from Ceph CSI side.

@batrick @dillaman @vasyl-purchel @ShyamsundarR @JohnStrunk

@Madhu-1 Madhu-1 added component/cephfs Issues related to CephFS enhancement New feature or request labels Oct 8, 2020
@stale
Copy link

stale bot commented Jan 24, 2021

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.

@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically closed due to inactivity. Please re-open if this still requires investigation.

@laptimus
Copy link

Thanks Madhu for the prompt reply and reopening this issue.

We are at a point of making critical design choices for our application. We will be going with CepfFS hoping that KMS encryption support will be added soon to the CephFS provisioning and storageclass.

regards

@Madhu-1 Madhu-1 added the keepalive This label can be used to disable stale bot activiity in the repo label Aug 23, 2021
@laptimus
Copy link

Hello Madhu

Any update on this issue

regards

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Oct 27, 2021

@jtlayton @batrick @vshankar @kotreshhr CephFS already supports fscrypt based encryption?

@jtlayton
Copy link

No, it's still a work in progress. We're hoping to have it ready to ship for Quincy release.

@laptimus
Copy link

Thanks @Madhu-1 @jtlayton

@laptimus
Copy link

laptimus commented Dec 9, 2021

@Madhu-1 @jtlayton - What is the bug number for this issue on tracker.ceph.com

thanks

@Madhu-1
Copy link
Collaborator

Madhu-1 commented Dec 10, 2021

https://tracker.ceph.com/issues/46690 is the one, lets get confirmation from Jeff.

@irq0
Copy link
Member

irq0 commented Feb 4, 2022

Hello!

I looked into how CephFS and FSCrypt could be integrated a bit and believe much of what is already there for RBD could be made to work for CephFS+FSCrypt as well. Biggest exception would be DEK storage.

I'd love to get started on a patch and like to hear if there is already something planned?

What I have in mind for a first version would be:

@humblec
Copy link
Collaborator Author

humblec commented Feb 4, 2022

Hello!

I looked into how CephFS and FSCrypt could be integrated a bit and believe much of what is already there for RBD could be made to work for CephFS+FSCrypt as well. Biggest exception would be DEK storage.

I'd love to get started on a patch and like to hear if there is already something planned?

@irq0 That would be awesome 👍 , please give a try, we can also target this feature's first version in release 3.6. 👍

What I have in mind for a first version would be:

* Enable FSCrypt always on the volume root level.

Do you mean, subvolume or subvolumegroup in this context ?

* Focus on the 'metadata' KSM. Use Xattrs as DEK storage

That looks reasonable.

* Either leverage https://github.com/google/fscrypt or https://github.com/google/fscryptctl to set keys and policies

I would prefer fscrypt library than cli though or was exploring on that more than CLI.

* Where encryption is set up during CreateVolume, do this in NodeStateVolume to allow easy access to Xattrs

Yep.

Also, please feel free to have a design doc along with first POC implementation, that helps.

Please let us know if you need any help on this.

@humblec humblec added this to the release-3.6 milestone Feb 4, 2022
@irq0
Copy link
Member

irq0 commented Feb 11, 2022

Hello!
I looked into how CephFS and FSCrypt could be integrated a bit and believe much of what is already there for RBD could be made to work for CephFS+FSCrypt as well. Biggest exception would be DEK storage.
I'd love to get started on a patch and like to hear if there is already something planned?

@irq0 That would be awesome +1 , please give a try, we can also target this feature's first version in release 3.6. +1

My WIP branch is here: https://github.com/irq0/ceph-csi/commits/wip/fscrypt. Needs k8s config from my dev env repo https://github.com/irq0/dev-ceph-csi-fscrypt-config plus custom kernel and MDS as the feature isn't merged yet.

It is currently more or less a PoC. The main feature, unlocking volumes, is there and stores encrypted DEKs in an xattr.
It shells out to fscryptctl quite a bit. I'll polish it up and replace with the fscrypt go library next. I'll open a PR once that is done.

What I have in mind for a first version would be:

* Enable FSCrypt always on the volume root level.

Do you mean, subvolume or subvolumegroup in this context ?

Subvolume / k8s PV

* Focus on the 'metadata' KSM. Use Xattrs as DEK storage

That looks reasonable.

I'm not sure if there is a good alternative. I don't think there is something akin to the RBD volume metadata for subvolumes, or did I miss anything?

* Either leverage https://github.com/google/fscrypt or https://github.com/google/fscryptctl to set keys and policies

I would prefer fscrypt library than cli though or was exploring on that more than CLI.

Me too. I started with fscryptctl though, because it is way simpler to use.

* Where encryption is set up during CreateVolume, do this in NodeStateVolume to allow easy access to Xattrs

Yep.

Also, please feel free to have a design doc along with first POC implementation, that helps.

Please let us know if you need any help on this.

Thanks! I'm a bit unsure on how to best test this, as most of the functionality crosses the system border towards the OS. Any ideas?

@humblec
Copy link
Collaborator Author

humblec commented Feb 16, 2022

Thanks a lot @irq0 for the revert and sharing the gist of what you have been experimenting. We got to discuss about this in 3.6 release triage call yesterday and few thoughts on how to proceed further. It would be good to start with a design doc of this feature and get opinions/suggestions about the approaches from CSI and Ceph Team . It was also told that, we may have to wait for CephFS merge and kernel releases to make sure we are taking right approach towards whats going to land finally as a cephfs encryption solution. With all that, would it be possible to propose a design doc, so that we can discuss further and validate the possibilities of this feature in 3.6.
@nixpanic anything else to add which I missed here?

@irq0
Copy link
Member

irq0 commented Feb 18, 2022

Will do. Should be ready mid next week.

I'll also want to explore integration possibilities with https://github.com/google/fscrypt some more. google/fscrypt and Ceph-CSI share quite a bit functionality around key management and there is probably some merit to making them compatible somehow. (The PoC code I wrote would require Ceph-CSI key management to unlock; google/fscrypt could allow multiple ways to unlock (e.g PAM, passwords, Ceph-CSI))

There aren't actually any hard CephFS dependencies here, since all the integration would do is key management. The nice thing about fscrypt is that this is independent of the filesystem below (see https://www.kernel.org/doc/html/latest/filesystems/fscrypt.html). (So, what Ceph-CSI would do to unlock fscrypt on CephFS would work on ext4 as well)

irq0 pushed a commit to irq0/ceph-csi that referenced this issue Mar 1, 2022
Add proposal document covering key management integration
of Ceph CSI and https://github.com/google/fscrypt

Updates: ceph#1563
Signed-off-by: Marcel Lauhoff <[email protected]>
irq0 pushed a commit to irq0/ceph-csi that referenced this issue Mar 1, 2022
Add proposal document covering key management integration
of Ceph CSI and https://github.com/google/fscrypt

Updates: ceph#1563
Signed-off-by: Marcel Lauhoff <[email protected]>
irq0 pushed a commit to irq0/ceph-csi that referenced this issue Mar 3, 2022
Add proposal document covering key management integration
of Ceph CSI and https://github.com/google/fscrypt

Updates: ceph#1563
Signed-off-by: Marcel Lauhoff <[email protected]>
irq0 pushed a commit to irq0/ceph-csi that referenced this issue Mar 28, 2022
Add proposal document covering key management integration
of Ceph CSI and https://github.com/google/fscrypt

Updates: ceph#1563
Signed-off-by: Marcel Lauhoff <[email protected]>
@humblec humblec removed this from the release-3.6 milestone Apr 1, 2022
@humblec
Copy link
Collaborator Author

humblec commented Apr 1, 2022

Considering we have to wait for the dependency support in place and also some discussions on the design has to be concluded, removing this from the release 3.6 tracker. Thanks for the great attempt to take it forward.. we will continue the effort and will try to get this in release 3.7..

@humblec humblec added this to the release-3.7 milestone Apr 1, 2022
@humblec humblec mentioned this issue Apr 21, 2022
4 tasks
irq0 pushed a commit to irq0/ceph-csi that referenced this issue Apr 29, 2022
Add proposal document covering key management integration
of Ceph CSI and https://github.com/google/fscrypt

Updates: ceph#1563
Signed-off-by: Marcel Lauhoff <[email protected]>
ceph-csi-bot pushed a commit to irq0/ceph-csi that referenced this issue May 24, 2022
Add proposal document covering key management integration
of Ceph CSI and https://github.com/google/fscrypt

Updates: ceph#1563
Signed-off-by: Marcel Lauhoff <[email protected]>
mergify bot pushed a commit that referenced this issue May 24, 2022
Add proposal document covering key management integration
of Ceph CSI and https://github.com/google/fscrypt

Updates: #1563
Signed-off-by: Marcel Lauhoff <[email protected]>
@humblec
Copy link
Collaborator Author

humblec commented Aug 18, 2022

@irq0 Thanks for all the meetings or disussions on this topic and continuously making progress on the same. We will continue reviewing the new PR in place #3310 and track this for upcoming Ceph CSI release. I am untracking this feature from release 3.7 . 👍

@humblec humblec removed this from the release-3.7 milestone Aug 18, 2022
@mergify mergify bot closed this as completed in #3460 Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/cephfs Issues related to CephFS enhancement New feature or request keepalive This label can be used to disable stale bot activiity in the repo
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants