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

rbd: add kmip encryption type #3306

Merged
merged 2 commits into from
Aug 18, 2022
Merged

rbd: add kmip encryption type #3306

merged 2 commits into from
Aug 18, 2022

Conversation

Rakshith-R
Copy link
Contributor

@Rakshith-R Rakshith-R commented Aug 16, 2022

The Key Management Interoperability Protocol (KMIP)
is an extensible communication protocol
that defines message formats for the manipulation
of cryptographic keys on a key management server.
Ceph-CSI can now be configured to connect to
various KMS using KMIP for encrypting RBD volumes.

https://en.wikipedia.org/wiki/Key_Management_Interoperability_Protocol

Resolves: #3282

Signed-off-by: Rakshith R rar@redhat.com

Heavily inspired from noobaa/noobaa-operator#964 (comment)

@Rakshith-R Rakshith-R added the ci/skip/e2e skip running e2e CI jobs label Aug 16, 2022
@Rakshith-R Rakshith-R requested review from humblec and Madhu-1 August 16, 2022 05:54
@mergify mergify bot added the component/rbd Issues related to RBD label Aug 16, 2022
@humblec
Copy link
Collaborator

humblec commented Aug 16, 2022

@Rakshith-R looks like ans field has to be renamed for the codespell to be happy :)

./internal/kms/kms_util.go:49: ans ==> and
./internal/kms/kms_util.go:61: ans ==> and
./internal/kms/kms_util.go:71: ans ==> and
./internal/kms/kms_util.go:81: ans ==> and

@nixpanic
Copy link
Member

Please split the vendor part from the actual feature, that makes it much easier to review.

@mergify
Copy link
Contributor

mergify bot commented Aug 16, 2022

This pull request now has conflicts with the target branch. Could you please resolve conflicts and force push the corrected changes? 🙏

@Rakshith-R Rakshith-R force-pushed the kmip branch 2 times, most recently from 135c05d to 7ae7bd7 Compare August 16, 2022 09:52
@humblec humblec added this to the release-3.7 milestone Aug 16, 2022
@Rakshith-R Rakshith-R force-pushed the kmip branch 2 times, most recently from 80721b4 to 8b69305 Compare August 17, 2022 04:48
@Rakshith-R Rakshith-R marked this pull request as ready for review August 17, 2022 05:13
@Rakshith-R Rakshith-R requested a review from nixpanic August 17, 2022 05:46
@humblec
Copy link
Collaborator

humblec commented Aug 17, 2022

@Rakshith-R can you please address the comments.. I am planning to start the Release work of 3.7, thats why :)

@Rakshith-R Rakshith-R requested a review from Madhu-1 August 17, 2022 12:50
Copy link
Member

@nixpanic nixpanic left a comment

Choose a reason for hiding this comment

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

mostly nits

Add a note somewhere about how it was tested?

return conn, nil
}

// discover performs KMIP handshake.
Copy link
Member

Choose a reason for hiding this comment

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

It would be useful to link to the documentation (+chapter/paragraph) where this handshake is explained. Maybe for other protocol procedures too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its just discover protocol being run, linked discover operation chapter here.

}

// KMIP handshake
err = kms.discover(conn)
Copy link
Member

Choose a reason for hiding this comment

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

just above is conn.Handshake()... what's the difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed the term handshake, added more explanation in function description.

func (kms *kmipKMS) connect() (*tls.Conn, error) {
conn, err := tls.Dial("tcp", kms.endpoint, kms.tlsConfig)
if err != nil {
return nil, err
Copy link
Member

Choose a reason for hiding this comment

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

ideally add some more context in the returned errors with fmt.Errorf(...)

},
})
if err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

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

make sure that returned errors are unique, so that tracking the source of the error trivial. Use fmt.Errorf(...) for returned errors if you can.


req, err := ttlv.Marshal(msg)
if err != nil {
return nil, nil, nil, err
Copy link
Member

Choose a reason for hiding this comment

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

same here, use fmt.Errorf() so that tracking the source of errors becomes easy

return nil
}

// send sends KMIP operation over tls connection, return response and error.
Copy link
Member

Choose a reason for hiding this comment

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

return response and error... but there are 4 return values? probably good to explain each of them

@Rakshith-R
Copy link
Contributor Author

mostly nits

Add a note somewhere about how it was tested?

This was tested with pykimp server instance deployed in kubernetes cluster,
I'll open an issue to track this, so we can add e2e for kmip encryption in a follow-up pr.

@Rakshith-R
Copy link
Contributor Author

addressed the comments PTAL @nixpanic @humblec

@Rakshith-R Rakshith-R requested a review from nixpanic August 18, 2022 05:56
humblec
humblec previously approved these changes Aug 18, 2022
@humblec humblec dismissed their stale review August 18, 2022 06:04

correct the linter

The Key Management Interoperability Protocol (KMIP)
is an extensible communication protocol
that defines message formats for the manipulation
of cryptographic keys on a key management server.
Ceph-CSI can now be configured to connect to
various KMS using KMIP for encrypting RBD volumes.

https://en.wikipedia.org/wiki/Key_Management_Interoperability_Protocol

Signed-off-by: Rakshith R <rar@redhat.com>
Signed-off-by: Rakshith R <rar@redhat.com>
@mergify mergify bot merged commit e72ed59 into ceph:devel Aug 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/skip/e2e skip running e2e CI jobs component/rbd Issues related to RBD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add encryption support for RBD volumes with KMIP
5 participants