-
Notifications
You must be signed in to change notification settings - Fork 35
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
uuid endpoint #39
uuid endpoint #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some questions, other than that, looking good.
pkg/server/apiHandler.go
Outdated
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError) | ||
return | ||
} | ||
cert, err := parseX509Cert(uuidRequest.GetDeviceCert()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we using this new parseX509Cert()
func, and not the existing getClientCert()
that all of the others use? Is this different somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, you need to take the certificate from the UuidRequest object, not from the request itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that documented somewhere? Is this fundamentally different than all the other requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the V2 API I'd expect the full client cert to be in the authcontainer. If we also have it in the UuidRequest it means that for V2 we'd have it in two places; either they need to be checked to be identical or we don't use the UuidRequest DeviceCert (latter would make the message a lot smaller.)
If we support the uuid API endpoint in the V1 API it means we do need the DeviceCert in the uuid request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, we need to add check that the TLS cert is the same with DeviceCert inside UuidRequest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not clear on this. Is /uuid
v1 or v2? If it is v1, then the device cert needs to be available via mTLS. If it is v2, we should just defer on adding /uuid
until adam goes v2.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somewhat related question, but for the other APIs (config, metrics, info) where we have a UUID in the URL and one which we fetch based on the cert, does Adam/Eden check that they match?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems we do not use/check uuid from url (only uuid of apps).
7ab2a71
to
d8132b5
Compare
pkg/server/server.go
Outdated
} | ||
|
||
//parseX509Cert parses incoming certificate | ||
func parseX509Cert(inp []byte) (*x509.Certificate, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either the cert needs to be removed from the uuid message and you get the cert from the authcontainer, or you need to check that the cert in the uuid message and the authcontainer are identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coming back to the earlier conversation, isn't authcontainer an entirely v2 construct? We should use defer on this until we get adam to v2.
d8132b5
to
7eef66f
Compare
pkg/server/apiHandler.go
Outdated
http.Error(w, http.StatusText(http.StatusUnauthorized), http.StatusUnauthorized) | ||
return | ||
} | ||
if u.String() != uuidTLS.String(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a check for a uuid match for certificates from TLS and from uuidRequest
@giggsoff can you please hold off from merging this, since there is a namespace conflict in python generated protofiles (due to uuid namespace collision), for which I need to move uuid/uuid.proto to eveuuid/eveuuid.proto. |
7eef66f
to
192db51
Compare
192db51
to
01f906f
Compare
01f906f
to
e63accc
Compare
So I see this is worked on again. Is the idea to merge it this time @giggsoff ? |
Yes, seems we need this PR for lf-edge/eve#2330 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but any chance you can add a unit test?
Signed-off-by: Petr Fedchenkov <[email protected]>
e63accc
to
2085db5
Compare
Added. I can see some problems with redis tests. Will work on them in another PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! @deitch -- can you give it a quick look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
My question was about the generic handing of a uuid in the URL and a uuid derived from the client cert in the authcontainer and not related to this PR.
Implementation of the /uuid endpoint #38
Signed-off-by: Petr Fedchenkov [email protected]