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

Enforce our 7 day TTL on certificates #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions bitnami/shared/kyverno/require-default-duration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-default-duration
annotations:
policies.kyverno.io/title: Require certificate duration to be set to 7days
policies.kyverno.io/category: cert-manager
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Certificate
policies.kyverno.io/description: >-
certificate requests should set the duration to 7days
spec:
validationFailureAction: Enforce
background: true
rules:
- name: require-certificate-default-duration
match:
resources:
kinds:
- Certificate
preconditions:
any:
- key: "{{ request.object.spec.issuerRef.name || '' }}"
operator: Equals
value: kafka-shared-selfsigned-issuer
validate:
message: "Duration must be set to 168h (7 days) as per our recommended best practices"
Copy link
Contributor

Choose a reason for hiding this comment

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

per our recommended best practices

Where are these best recommendations documented (could we link to that here)?

pattern:
spec:
duration: "168h"
30 changes: 30 additions & 0 deletions bitnami/shared/kyverno/require-default-renewbefore.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: require-defaukt-renewbefore
annotations:
policies.kyverno.io/title: Require certificate renewBefore to be set to 2/3rds of duration
policies.kyverno.io/category: cert-manager
policies.kyverno.io/severity: medium
policies.kyverno.io/subject: Certificate
policies.kyverno.io/description: >-
certificate requests should set renewBefore to 2/3rds of duration
spec:
validationFailureAction: Enforce
background: true
rules:
- name: require-certificate-default-renewbefore
match:
resources:
kinds:
- Certificate
preconditions:
any:
- key: "{{ request.object.spec.issuerRef.name || '' }}"
operator: Equals
value: kafka-shared-selfsigned-issuer
validate:
message: "renewBefore must be unset or set to 2/3 of duration, which is required to be 168hrs currently (7 days)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Might help make it very clear where this value comes from

Suggested change
message: "renewBefore must be unset or set to 2/3 of duration, which is required to be 168hrs currently (7 days)"
# 2/3 of value defined in ./require-default-duration.yaml
message: "renewBefore must be unset or set to 2/3 of duration, which is required to be 168hrs currently (7 days)"

pattern:
spec:
=(renewBefore): "112h"