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

Added support for GGF inquire cred and sec context #141

Merged
merged 1 commit into from
Jan 17, 2018

Conversation

jborean93
Copy link
Contributor

Implements gss_inquire_cred_by_oid and gss_inquire_sec_context_by_oid. This partially completes #51.

I was trying to also implement the other 2 methods and wasn't able to get a working implementation so have decided to ignore it for now.

@jborean93
Copy link
Contributor Author

This is also a superset of #128 but also includes some documentation and tests as well as the inquire_cred_by_oid method

Copy link
Member

@frozencemetery frozencemetery left a comment

Choose a reason for hiding this comment

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

Thanks, the code looks good to me (will wait for review from @DirectXMan12). Also appreciate you adding tests.

In the commit message, it would be good if you fleshed out what the GGF extensions are a bit more - maybe with a link to the IETF draft as well. Also, it would be nice to give the @vm86 an Also-authored-by (or otherwise mention their contributions) in the commit message.

@jborean93
Copy link
Contributor Author

Thanks @frozencemetery will do

@jborean93
Copy link
Contributor Author

@frozencemetery let me know if the latest commit message is what you are looking for.

Copy link
Member

@frozencemetery frozencemetery left a comment

Choose a reason for hiding this comment

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

It is, thanks!

@vm86
Copy link

vm86 commented Jan 13, 2018

Thanks! I unfortunately did not have time.

Copy link
Member

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

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

minor nits inline, mostly looks good

mech (OID): the desired mechanism

Returns:
list: A list of zero or more pieces of data corresponding to the
Copy link
Member

Choose a reason for hiding this comment

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

nit: a list of zero or more bytes objects? Can you be more specific about what a piece of data is?

Copy link
Contributor Author

@jborean93 jborean93 Jan 16, 2018

Choose a reason for hiding this comment

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

I'm honestly not really sure, I've only used this to retrieve GSS_C_INQ_SSPI_SESSION_KEY and the end result is a list with a single entry of a byte string. I'm happy to say the "piece of data" is a byte string but not sure what else it could be.

Copy link
Contributor

Choose a reason for hiding this comment

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

@DirectXMan12 no you can't be more precise, because the data is a bunch of bytes, and how you interpret them depends on the desired oid used.

Copy link
Member

Choose a reason for hiding this comment

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

I mean, if the actual return type is just multiple chunks of bytes, then it's fine to say

a list of zero or more pieces of data (as bytes objects)

or something of the sort


Args:
cred_handle (Creds): the security context to query
mech (OID): the desired mechanism
Copy link
Member

Choose a reason for hiding this comment

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

nit: is this really a mechanism OID, or is it just some other type of OID?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what the terms actually mean but this is probably more desired_object (OID): the OID of the desired object or something like that?

Copy link
Member

Choose a reason for hiding this comment

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

yeah, that's fine (alternatively, something like desired_aspect (OID): the desired aspect of the Credentials to inquire about (also, looks like you have have a copy-paste error above with creds vs contexts)

@DirectXMan12
Copy link
Member

DirectXMan12 commented Jan 16, 2018

Also, could you put that link and info from the commit message into a module-level doc string?
All extensions should have some module-level docs, even if just a title (like https://github.com/jborean93/python-gssapi/blob/a50b089aa9e7caa70254d64171bad22b59a7d563/gssapi/raw/ext_s4u.pyx#L1)

@jborean93
Copy link
Contributor Author

@DirectXMan12 so just add the commit message to a docstring at the top of the pyx file?

@DirectXMan12
Copy link
Member

Something like that should work, yes. When people look at the GGF extension module and they're wondering what it's all about, they'll see that documentation, so it should serve that purpose, more or less.

@jborean93
Copy link
Contributor Author

No worries, will update the PR now. Thanks for the review.

Copy link
Member

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

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

generally looks good. a couple small nits inline, then please to a git rebase -i and mark the second commit as a fixup (so you're left with one commit). We tend towards a policy of each commit being a clean, distinct piece of history/functionality.

Thanks!


GGF provides extended credential and security context inquiry that allows
application to retrieve more information about the client's credentials and
security context. One common use case is to use gss_inquire_sec_context_by_oid
Copy link
Member

Choose a reason for hiding this comment

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

should just be inquire_sec_context_by_oid, and you should be able to make it a link to the actual function documentation below.

Copy link
Contributor Author

@jborean93 jborean93 Jan 16, 2018

Choose a reason for hiding this comment

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

Do I link it by enclosing it with `? Sorry just can't find an example.

Edit: I think I found one, I will do ":meth:`inquire_sec_context_by_oid'"

security context. One common use case is to use gss_inquire_sec_context_by_oid
to retrieve the "session" key that is required by the SMB protocol for signing
and encrypting a message. These calls are provided as a part of the raw
interface and are not exposed in the high-level interface.
Copy link
Member

Choose a reason for hiding this comment

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

no need for the sentence starting with "These calls". It just means if we ever expose it at the high level, we'll have to remember to remove that sentence.

@jborean93
Copy link
Contributor Author

Thanks @DirectXMan12 hopefully the latest changes are what you are looking for.

@jborean93
Copy link
Contributor Author

sigh Travis-CI looks like it is still having issues, trying to run the tests again.

GGF provides extended credential and security context inquiry that allows
application to retrieve more information about the client's credentials and
security context. One common use case is to use gss_inquire_sec_context_by_oid
to retrieve the "session" key that is required by the SMB protocol for signing
and encrypting a message. These calls are provided as a part of the raw
interface and are not exposed in the high-level interface.

Thanks to @vm86 for his work on the gss_inquire_sec_context_by_oid.

Draft IETF document for these extensions can be found at
https://tools.ietf.org/html/draft-engert-ggf-gss-extensions-00
Copy link
Member

@DirectXMan12 DirectXMan12 left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@DirectXMan12 DirectXMan12 merged commit a14d750 into pythongssapi:master Jan 17, 2018
@jborean93 jborean93 deleted the ext_ggf branch January 17, 2018 22:41
@jborean93
Copy link
Contributor Author

Thanks @DirectXMan12 @frozencemetery for the reviews and help.

@frozencemetery frozencemetery added this to the 1.4.0 milestone Feb 16, 2018
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.

5 participants