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

certificate manager #599

Merged
merged 70 commits into from Jul 8, 2021
Merged

certificate manager #599

merged 70 commits into from Jul 8, 2021

Conversation

dopey
Copy link
Contributor

@dopey dopey commented Jun 2, 2021

No description provided.

@dopey dopey requested a review from maraino June 30, 2021 01:11
@github-actions github-actions bot added the needs triage Waiting for discussion / prioritization by team label Jul 3, 2021
Copy link
Contributor

@maraino maraino left a comment

Choose a reason for hiding this comment

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

Mostly ok, I've added a few new comments.

authority/admin/api/middleware.go Outdated Show resolved Hide resolved
authority/admin/api/provisioner.go Show resolved Hide resolved
if p, err = h.auth.LoadProvisionerByID(id); err != nil {
api.WriteError(w, admin.WrapErrorISE(err, "error loading provisioner %s", id))
return
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as before, do we need the id? should we ignore requests where id and name do not match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same answer as before. It's not a name AND an ID. It's either one or the other. If a query parameter is submitted, the name in the URL is completely ignored.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any benefit in the API in allowing 2 unique identifiers (name and UUID)?

Copy link
Contributor

Choose a reason for hiding this comment

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

Having to unique identifiers at this level is a little upsetting. At the db layer makes total sense.

authority/admin/db/nosql/admin.go Show resolved Hide resolved
authority/administrator/collection.go Show resolved Hide resolved
authority/config/ssh.go Show resolved Hide resolved
authority/provisioner/claims.go Show resolved Hide resolved
authority/authority.go Show resolved Hide resolved
authority/provisioners.go Show resolved Hide resolved
@maraino maraino self-requested a review July 6, 2021 11:36
Copy link
Contributor

@maraino maraino left a comment

Choose a reason for hiding this comment

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

LGTM

api.WriteError(w, admin.WrapErrorISE(err, "error retrieving paginated admins"))
return
}
api.JSON(w, &GetAdminsResponse{
Copy link
Contributor

@maraino maraino Jul 6, 2021

Choose a reason for hiding this comment

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

Protojson here? the problem with protojson, is that GetAdminsResponse is not a photo.Message, so I'm not sure if you can use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't use it. Throws an error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense, a solution to this, to get a nicer JSON is to use a proto message like the AdminList. With a new cursor property.

api.JSON(w, &GetProvisionersResponse{
Provisioners: p,
NextCursor: next,
})
Copy link
Contributor

Choose a reason for hiding this comment

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

Provisioners won't be nicely marshaled without using protojson.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The provisioners in this list aren't protojson linkedca provisioners anyway. They're the certificates type of provisioner. This method isn't being used right now. We're still using the existing API with step ca provisioner list.

I can take this method out for now if you want.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok for now, but to get a nicer JSON the same that we can use ProvisionerList with a cursor.

It's also possible to add custom MarshalJSON and UnmarshalJSON to GetProvisionersResponse that uses protojson to marshal the list of Provisioners/Admins.

authority/admin/errors.go Outdated Show resolved Hide resolved
authority/admin/errors.go Outdated Show resolved Hide resolved
Copy link
Contributor

@maraino maraino left a comment

Choose a reason for hiding this comment

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

Pretty much ok, but added a few comments.

- added a bit of validation to admin create and update
- using protojson where possible in admin api
- fixing a few instances of admin -> acme in errors
@dopey
Copy link
Contributor Author

dopey commented Jul 7, 2021

Update pushed. I addressed those comments which I could easily fix. Take a look when you have a chance and let me know.

@dopey dopey requested a review from maraino July 7, 2021 00:16
Copy link
Contributor

@maraino maraino left a comment

Choose a reason for hiding this comment

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

LGTM.

I've added some comments on mixed json/protojson types, but taking into account this is a beta release I'm ok with fixing them later. It's not ideal, because of backward compatibility with the cli, but ok for now.

@dopey dopey merged commit b9743b3 into master Jul 8, 2021
@dopey dopey deleted the max/cert-mgr-crud branch July 8, 2021 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Waiting for discussion / prioritization by team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants