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

Audit mode #1805

Merged
merged 2 commits into from
Aug 9, 2024
Merged

Audit mode #1805

merged 2 commits into from
Aug 9, 2024

Conversation

alpeb
Copy link
Member

@alpeb alpeb commented Jul 16, 2024

  • Added Audit Mode section to the Authorization Policy feature article.
  • Expanded the reference doc for Servers to include the new accessPolicy field.
  • Updated the "Further Considerations" section in the Restricting Access To Services article to account for audit mode.

alpeb added a commit to linkerd/linkerd2 that referenced this pull request Jul 23, 2024
Followup to #12845

This expands the policy controller index in the following ways:

- Adds the new Audit variant to the DefaultPolicy enum
- Expands the function that synthesizes the authorizations for a given default policy (DefaultPolicy::default_authzs) so that it also creates an Unauthenticated client auth and a allow-all NetworkMatch for the new Audit default policy.
- Now that a Server can have a default policy different than Deny, when generating InboundServer authorizations (PolicyIndex::client_authzs) make sure to append the default authorizations when DefaultPolicy is Allow or Audit

Also, the admission controller ensures the new accessPolicy field contains a valid value.

Required test changes are addressed in #12847. Also note you'll need the proxy changes at linkerd/linkerd2-proxy#3068 to make this work.

Please check linkerd/website#1805 for how this is supposed to work from the user's perspective.
alpeb added a commit to linkerd/linkerd2 that referenced this pull request Jul 25, 2024
Followup to #12845

This expands the policy controller index in the following ways:

- Adds the new Audit variant to the DefaultPolicy enum
- Expands the function that synthesizes the authorizations for a given default policy (DefaultPolicy::default_authzs) so that it also creates an Unauthenticated client auth and a allow-all NetworkMatch for the new Audit default policy.
- Now that a Server can have a default policy different than Deny, when generating InboundServer authorizations (PolicyIndex::client_authzs) make sure to append the default authorizations when DefaultPolicy is Allow or Audit

Also, the admission controller ensures the new accessPolicy field contains a valid value.

Required test changes are addressed in #12847. Also note you'll need the proxy changes at linkerd/linkerd2-proxy#3068 to make this work.

Please check linkerd/website#1805 for how this is supposed to work from the user's perspective.
alpeb added a commit to linkerd/linkerd2 that referenced this pull request Jul 26, 2024
Followup to #12845

This expands the policy controller index in the following ways:

- Adds the new Audit variant to the DefaultPolicy enum
- Expands the function that synthesizes the authorizations for a given default policy (DefaultPolicy::default_authzs) so that it also creates an Unauthenticated client auth and a allow-all NetworkMatch for the new Audit default policy.
- Now that a Server can have a default policy different than Deny, when generating InboundServer authorizations (PolicyIndex::client_authzs) make sure to append the default authorizations when DefaultPolicy is Allow or Audit

Also, the admission controller ensures the new accessPolicy field contains a valid value.

Required test changes are addressed in #12847. Also note you'll need the proxy changes at linkerd/linkerd2-proxy#3068 to make this work.

Please check linkerd/website#1805 for how this is supposed to work from the user's perspective.
alpeb added a commit to linkerd/linkerd2 that referenced this pull request Jul 26, 2024
Followup to #12846, branched off alpeb/policy-audit-impl

This fixes the policy controller unit and integration tests by accounting for the new Audit default policy and the new accessPolicy field in Server.

New integration tests added:

- e2e_audit.rs exercising first the audit policy in Server, and then at the namespace level
- in admit_server.rs a new test checks invalid accessPolicy values are rejected.
- in inbound_api.rs server_with_audit_policy verifies the synthesized audit authorization is returned for a Server with accessPolicy=audit

Please check linkerd/website#1805 for how this is supposed to work from the user's perspective.
alpeb added a commit to linkerd/linkerd2 that referenced this pull request Jul 26, 2024
Followup to #12845

This expands the policy controller index in the following ways:

- Adds the new Audit variant to the DefaultPolicy enum
- Expands the function that synthesizes the authorizations for a given default policy (DefaultPolicy::default_authzs) so that it also creates an Unauthenticated client auth and a allow-all NetworkMatch for the new Audit default policy.
- Now that a Server can have a default policy different than Deny, when generating InboundServer authorizations (PolicyIndex::client_authzs) make sure to append the default authorizations when DefaultPolicy is Allow or Audit

Also, the admission controller ensures the new accessPolicy field contains a valid value.

## Tests

New integration tests added:

- e2e_audit.rs exercising first the audit policy in Server, and then at the namespace level
- in admit_server.rs a new test checks invalid accessPolicy values are rejected.
- in inbound_api.rs server_with_audit_policy verifies the synthesized audit authorization is returned for a Server with accessPolicy=audit

> [!NOTE]
> Please check linkerd/website#1805 for how this is supposed to work from the user's perspective.
@alpeb alpeb changed the base branch from main to alpeb/2.16 July 29, 2024 15:27
@alpeb alpeb force-pushed the alpeb/audit branch 2 times, most recently from a4108ea to 84bb578 Compare July 29, 2024 15:37
- Added Audit Mode section to the Authorization Policy feature article.
- Expanded the reference doc for `Servers` to include the new `accessPolicy` field.
- Updated the "Further Considerations" section in the Restricting Access To Services article to account for audit mode.
@alpeb alpeb requested a review from kflynn August 9, 2024 14:36
Copy link
Member

@kflynn kflynn left a comment

Choose a reason for hiding this comment

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

This will be really helpful! I'm approving it but I left some suggestions if you want to take them. Thanks!! 🙂

linkerd.io/content/2.16/features/server-policy.md Outdated Show resolved Hide resolved
linkerd.io/content/2.16/features/server-policy.md Outdated Show resolved Hide resolved
linkerd.io/content/2.16/features/server-policy.md Outdated Show resolved Hide resolved
linkerd.io/content/2.16/features/server-policy.md Outdated Show resolved Hide resolved
@alpeb alpeb merged commit 37f5401 into alpeb/2.16 Aug 9, 2024
3 checks passed
@alpeb alpeb deleted the alpeb/audit branch August 9, 2024 19:14
alpeb added a commit that referenced this pull request Aug 13, 2024
* Audit mode

- Added Audit Mode section to the Authorization Policy feature article.
- Expanded the reference doc for `Servers` to include the new `accessPolicy` field.
- Updated the "Further Considerations" section in the Restricting Access To Services article to account for audit mode.
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.

2 participants