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

Implement revocation service from Python code #134

Merged
merged 6 commits into from
Feb 8, 2021

Conversation

ashcrow
Copy link
Contributor

@ashcrow ashcrow commented Oct 15, 2020

Adds:

  • Cargo: Add zmq and bump versions
  • crypto: rsa_verify function
  • main: run_revocation_service implementation
  • tests/Dockerfile: Updated dep

Note: Callback is not implemented here.

See: #92

src/main.rs Outdated Show resolved Hide resolved
@ashcrow
Copy link
Contributor Author

ashcrow commented Oct 15, 2020

Will fix format issues

@ashcrow ashcrow force-pushed the revocation branch 3 times, most recently from 2c21930 to 8da03b7 Compare October 20, 2020 18:02
@ashcrow ashcrow force-pushed the revocation branch 6 times, most recently from c9dccd7 to e3a2016 Compare November 24, 2020 16:21
@ashcrow ashcrow changed the title WIP: Implement revocation service Implement revocation service Nov 30, 2020
@ashcrow ashcrow changed the title Implement revocation service Implement revocation service from Python code Nov 30, 2020
Copy link
Contributor

@lkatalin lkatalin left a comment

Choose a reason for hiding this comment

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

I think this makes sense, with the caveat that it should get some more sets of eyes as I'm new to Keylime.

@lukehinds
Copy link
Member

lukehinds commented Dec 4, 2020

The code looks good to me. Would it take much to refactor into a zmq.rs or perhaps revocation.rs might be better? I am aware I left that placeholder function for you to use, but I am now mindful that we should try to keep main.rs slimmed down when we can.

The other thing would be some unit tests, but I am understanding this might not be easy with ZMQ and might be more suited to a functional / integration test.

@ashcrow
Copy link
Contributor Author

ashcrow commented Dec 4, 2020

@lukehinds That's a good idea. I'll move it out into it's on file and have it utilized in main.rs

@ashcrow
Copy link
Contributor Author

ashcrow commented Dec 4, 2020

Updated

Copy link
Member

@puiterwijk puiterwijk left a comment

Choose a reason for hiding this comment

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

Please fix the comments I pointed out. There's a few more .expect() uses.

src/crypto.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
src/revocation.rs Outdated Show resolved Hide resolved
src/crypto.rs Outdated Show resolved Hide resolved
src/revocation.rs Outdated Show resolved Hide resolved
src/revocation.rs Outdated Show resolved Hide resolved
src/revocation.rs Outdated Show resolved Hide resolved
src/revocation.rs Outdated Show resolved Hide resolved
src/revocation.rs Outdated Show resolved Hide resolved
src/revocation.rs Outdated Show resolved Hide resolved
@ashcrow
Copy link
Contributor Author

ashcrow commented Dec 10, 2020

Updated based on @puiterwijk's review.

Copy link
Member

@puiterwijk puiterwijk left a comment

Choose a reason for hiding this comment

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

A few more notes remaining, but starting to look decent!

src/crypto.rs Outdated Show resolved Hide resolved
"Loading the revocation certificate from {}",
revocation_cert_path
);
match crypto::rsa_import_pubkey(revocation_cert_path.clone()) {
Copy link
Member

Choose a reason for hiding this comment

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

If rsa_import_pubkey had accepted an &str, you wouldn't have needed to .clone() the path here. That's exactly why that is more idiomatic 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense, thanks! I've updated the others but I'll leave this one be for now since it's in rsa_import_pubkey.


// Verify the message and signature with our key
let mut verified =
crypto::rsa_verify(cert_key.clone(), message, signature);
Copy link
Member

Choose a reason for hiding this comment

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

Is there any chance cert_key could be given as a reference too (&...)? That would save us from having to clone() every time we get a message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can make rsa_verify take a reference but once inside the function it seems like we need to clone for PKey::from_rsa though I may be wrong. Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Bump :-)

Copy link
Member

Choose a reason for hiding this comment

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

I am good with this now, @puiterwijk if @ashcrow answer satisfies you, we can merge this

Copy link
Member

Choose a reason for hiding this comment

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

Sure. Let's merge it like this and improve later.

@ashcrow ashcrow force-pushed the revocation branch 2 times, most recently from 5e91178 to 6bd2da8 Compare December 11, 2020 17:55
@ashcrow
Copy link
Contributor Author

ashcrow commented Dec 11, 2020

Rebased

@ashcrow ashcrow requested a review from puiterwijk December 17, 2020 15:07
@ashcrow
Copy link
Contributor Author

ashcrow commented Jan 7, 2021

Will rebase shortly

@ashcrow
Copy link
Contributor Author

ashcrow commented Jan 7, 2021

Rebased!

@ashcrow
Copy link
Contributor Author

ashcrow commented Jan 18, 2021

Bump

@lukehinds
Copy link
Member

hey @puiterwijk this needs approval from you as well (changes requested)

image

@lukehinds
Copy link
Member

@puiterwijk ,please ack if the review request is resolved, so we can merge this. I am sure we will revisit the code again once then parts are rigged together.

Copy link
Member

@puiterwijk puiterwijk left a comment

Choose a reason for hiding this comment

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

Sorry for forgetting to hit the Approve button. Thanks for the PR!

@ashcrow
Copy link
Contributor Author

ashcrow commented Feb 4, 2021

Bah! Needs another rebase!

Signed-off-by: Steve Milner <[email protected]>
Verify remote messages against signatures via rsa_verify

Signed-off-by: Steve Milner <[email protected]>
@ashcrow ashcrow force-pushed the revocation branch 2 times, most recently from 206e16e to af64084 Compare February 5, 2021 21:44
@lukehinds
Copy link
Member

lukehinds commented Feb 8, 2021

hey @ashcrow , keen to approve this for you. It seems all we have now are some redundant clones (see CI 'Fedora tests'). If you could make another quick commit I would like to merge this and start rigging up the revocation actions.

@lkatalin
Copy link
Contributor

lkatalin commented Feb 8, 2021

Looks like this resolves #92 (hopefully this comment will link it)

@lukehinds lukehinds merged commit dccc791 into keylime:master Feb 8, 2021
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.

4 participants