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

TLS certificates should be Silo-scoped #3095

Merged
merged 5 commits into from
May 12, 2023
Merged

TLS certificates should be Silo-scoped #3095

merged 5 commits into from
May 12, 2023

Conversation

davepacheco
Copy link
Collaborator

Fixes #2367 (see that issue for details).

@davepacheco davepacheco requested a review from zephraph May 12, 2023 01:09
Comment on lines +501 to +504
/// Synthetic resource describing the list of Certificates associated with a
/// Silo
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct SiloCertificateList(Silo);
Copy link
Contributor

Choose a reason for hiding this comment

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

I know we've talked about this a little bit, but I just want to clarify... is the reason this needs to have a synthetic resource because it's permissions differ in some meaningful way from other silo resources or is it because you think all silo resources (or every resource) should have a synthetic resource?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The obvious alternative would be directly checking "list children" on the Silo. Compared to that, a synthetic resource gives us two things: first what you said that the policy is different for certificates than for, say, projects (both of which are Silo children); and second: the policy ("a person can list the certificates in the Silo if they are an administrator of the Silo's parent fleet") can be separated from the code that checks it (which just asks "can this person list the certificates in the Silo"). This makes the code easier to write and verify (since you're not making any judgments about the policy there) and the policy is easier to write and verify too (since you're not worrying about implementation details there).

Copy link
Contributor

@zephraph zephraph left a comment

Choose a reason for hiding this comment

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

Overall it looks good. I did have a few questions about authz and noticed one duplicated line in the polar file.

The /v1/ prefix was accidentally removed when /system was taken out so you'll need to re-add that.

"read" if "admin" on "parent_silo";
"modify" if "admin" on "parent_silo";
"create_child" if "admin" on "parent_silo";
"list_children" if "admin" on "parent_silo";
Copy link
Contributor

Choose a reason for hiding this comment

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

If the synthetic resource represents the list container, why does the base resource need create_child and list_children?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's probably not necessary. Removed in af6d6d5.

Comment on lines 422 to 423
"list_children" if "admin" on "parent_silo";
"list_children" if "admin" on "parent_silo";
Copy link
Contributor

Choose a reason for hiding this comment

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

duplicate?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup. Fixed in af6d6d5.

diesel::insert_into(dsl::certificate)
.values(certificates)
.on_conflict(dsl::id)
.do_nothing()
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean there would be no error?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah. The uuid was just generated, though, so it would be rather surprising if this happened. But I'll go ahead and remove that.

nexus/db-queries/src/db/lookup.rs Show resolved Hide resolved
nexus/src/external_api/http_entrypoints.rs Outdated Show resolved Hide resolved
zephraph

This comment was marked as duplicate.

@davepacheco
Copy link
Collaborator Author

Thanks for the review. It looks like I was fixing the /v1 thing as you were reviewing -- that should be fixed now. I'll address the rest in a bit.

@davepacheco davepacheco enabled auto-merge (squash) May 12, 2023 15:39
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.

tls: need per-DNS-name (per-Silo) configuration of certificates
2 participants