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

Add methods for linking a keyring to another keyring #16

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

afontenot
Copy link
Contributor

This is an important keyctl operation that can have implications on whether a key is readable and shows up in Search operations.

It may not be immediately be apparent that this is a supported operation when calling KEYCTL_LINK, you have to dig through the docs to find this.

man 7 keyrings:

As previously mentioned, keyrings are a special type of key that
contains links to other keys (which may include other keyrings). Keys may be linked to by multiple keyrings.

This is an important keyctl operation that can have implications on
whether a key is readable and shows up in Search operations.

It may not be immediately be apparent that this is a supported operation
when calling KEYCTL_LINK, you have to dig through the docs to find this.

man 7 keyrings:

> As previously mentioned, keyrings are a special type of key that
contains links to other keys (which may include other keyrings). Keys
may be linked to by multiple keyrings.
@afontenot
Copy link
Contributor Author

This one is a little thrown together, I'm willing to rework it and do it differently (e.g. we could make it possible to convert a KeyRingIdentifier to a KeySerialId more explicitly than KeySerialId::new(KeyRingIdentifier as i32) and that might be sufficient for these use cases with a little adjustment to the docs to make clear how to do this.

I do think there does need to be a supported way to link keyrings.

Also willing to add tests and improve the comments if you can do a cursory review and say what's needed.

@landhb
Copy link
Owner

landhb commented Aug 22, 2024

@afontenot Thanks for the PR!

I think your explicit methods are better than having users convert to a raw ID and using existing Key methods to workaround it.

It looks clean, some tests would be great though.

I'll try to get to these PRs this weekend.

Also fixes a minor doc issue in previous commit
@afontenot
Copy link
Contributor Author

@landhb tests have been added.

Implementing set_perms on KeyRing in the future would be useful, it would also allow testing some of the claims made about e.g. write / linking access (throughout the KeyRing implementation, not specific to this commit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants