File tree 12 files changed +186
-15
lines changed
12 files changed +186
-15
lines changed Original file line number Diff line number Diff line change 52
52
mutateDigest : false
53
53
required : true
54
54
verifyDigest : false
55
- validationFailureAction : enforce
55
+ validationFailureAction : enforce
Original file line number Diff line number Diff line change
1
+ name : verify_multiple_resources
2
+ policies :
3
+ - policy3.yml
4
+ resources :
5
+ # - pod3.yml
6
+ - pod4.yml
7
+ variables : values.yml
8
+ results :
9
+ # - policy: check-image
10
+ # rule: check-image
11
+ # resource: pod-3
12
+ # kind: Pod
13
+ # result: pass
14
+ - policy : check-image
15
+ rule : check-image
16
+ resource : pod-4
17
+ kind : Pod
18
+ result : pass
Original file line number Diff line number Diff line change
1
+ # verified
1
2
apiVersion : apps/v1
2
3
kind : Deployment
3
4
metadata :
4
- name : nginx-deployment
5
5
labels :
6
6
app : nginx
7
+ name : nginx-deployment
7
8
spec :
8
9
replicas : 1
9
10
selector :
14
15
labels :
15
16
app : nginx
16
17
spec :
17
- imagePullSecrets :
18
- - name : regcred
19
18
containers :
20
- - name : nginx
21
- image : ghcr.io/hackeramitkumar/test5:app
22
- ports :
23
- - containerPort : 80
19
+ - image : ghcr.io/hackeramitkumar/test5:app
20
+ name : nginx
21
+ resources : {}
Original file line number Diff line number Diff line change
1
+ # verfied image
1
2
apiVersion : apps/v1
2
3
kind : Deployment
3
4
metadata :
4
- name : nginx-deployment
5
5
labels :
6
6
app : nginx
7
+ name : nginx-deployment
7
8
spec :
8
9
replicas : 1
9
10
selector :
14
15
labels :
15
16
app : nginx
16
17
spec :
17
- imagePullSecrets :
18
- - name : regcred
19
18
containers :
20
- - name : nginx
21
- image : ghcr.io/hackeramitkumar/test5:app2 # NEW VERSION of image
22
- ports :
23
- - containerPort : 80
19
+ - image : ghcr.io/hackeramitkumar/test5:app2
20
+ name : nginx
21
+ resources : {}
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : Pod
3
+ metadata :
4
+ name : pod-3
5
+ namespace : default
6
+ spec :
7
+ containers :
8
+ - image : ghcr.io/hackeramitkumar/test6:app
9
+ name : bad-container
10
+ imagePullPolicy : Always
11
+ - image : ghcr.io/hackeramitkumar/test5:app
12
+ name : good-container
13
+ imagePullPolicy : Always
Original file line number Diff line number Diff line change
1
+ apiVersion : v1
2
+ kind : Pod
3
+ metadata :
4
+ name : pod-4
5
+ namespace : default
6
+ spec :
7
+ containers :
8
+ - image : ghcr.io/hackeramitkumar/test5:app
9
+ name : good-container
10
+ imagePullPolicy : Always
11
+ - image : ghcr.io/hackeramitkumar/test6:app
12
+ name : bad-container
13
+ imagePullPolicy : Always
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ labels :
5
+ app : nginx
6
+ name : nginx-deployment-5
7
+ spec :
8
+ replicas : 1
9
+ selector :
10
+ matchLabels :
11
+ app : nginx
12
+ template :
13
+ metadata :
14
+ labels :
15
+ app : nginx
16
+ spec :
17
+ containers :
18
+ - image : ghcr.io/hackeramitkumar/test5:app
19
+ name : good-container
20
+ resources : {}
21
+ - image : ghcr.io/hackeramitkumar/test6:app
22
+ name : bad-container
23
+ resources : {}
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ labels :
5
+ app : nginx
6
+ name : nginx-deployment-6
7
+ spec :
8
+ replicas : 1
9
+ selector :
10
+ matchLabels :
11
+ app : nginx
12
+ template :
13
+ metadata :
14
+ labels :
15
+ app : nginx
16
+ spec :
17
+ containers :
18
+ - image : ghcr.io/hackeramitkumar/test6:app
19
+ name : bad-container
20
+ resources : {}
21
+ - image : ghcr.io/hackeramitkumar/test5:app
22
+ name : good-container
23
+ resources : {}
Original file line number Diff line number Diff line change
1
+ apiVersion : kyverno.io/v1
2
+ kind : ClusterPolicy
3
+ metadata :
4
+ name : check-image
5
+ spec :
6
+ validationFailureAction : Enforce
7
+ background : false
8
+ webhookTimeoutSeconds : 30
9
+ failurePolicy : Fail
10
+ rules :
11
+ - name : check-image
12
+ match :
13
+ any :
14
+ - resources :
15
+ kinds :
16
+ - Pod
17
+ verifyImages :
18
+ - imageReferences :
19
+ - " ghcr.io/hackeramitkumar*"
20
+ attestors :
21
+ - count : 1
22
+ entries :
23
+ - keys :
24
+ publicKeys : |-
25
+ -----BEGIN PUBLIC KEY-----
26
+ MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEFN8gGjQua2g8N+aLx3Eff+/j5HxL
27
+ bV+H2z50/0A4d8XyMUvizPQBtcgei43pqLj1850m3wSwI08z2+6zT1QaEg==
28
+ -----END PUBLIC KEY-----
Original file line number Diff line number Diff line change
1
+ apiVersion : kyverno.io/v1
2
+ kind : ClusterPolicy
3
+ metadata :
4
+ name : check-image-signature
5
+ annotations :
6
+ policies.kyverno.io/title : Check Image Signature
7
+ policies.kyverno.io/category : ImageSignature
8
+ policies.kyverno.io/severity : medium
9
+ policies.kyverno.io/subject : Pod
10
+ policies.kyverno.io/minversion : 1.7.0
11
+ policies.kyverno.io/description : >-
12
+ Using the Cosign project, OCI images may be signed to ensure supply chain
13
+ security is maintained. Those signatures can be verified before pulling into
14
+ a cluster. This policy checks the signature of an image repo called
15
+ ghcr.io/kyverno/test-verify-image to ensure it has been signed by verifying
16
+ its signature against the provided public key. This policy serves as an illustration for
17
+ how to configure a similar rule and will require replacing with your image(s) and keys.
18
+ spec :
19
+ webhookTimeoutSeconds : 15
20
+ validationFailureAction : audit
21
+ background : false
22
+ rules :
23
+ - name : verify-image-signature
24
+ match :
25
+ resources : {}
26
+ any :
27
+ - resources :
28
+ kinds :
29
+ - Pod
30
+ namespaces :
31
+ - " cool-namespace"
32
+ verifyImages :
33
+ - imageReferences :
34
+ - " *"
35
+ mutateDigest : true
36
+ required : true
37
+ verifyDigest : true
38
+ attestors :
39
+ - entries :
40
+ - keys :
41
+ publicKeys : |
42
+ -----BEGIN PUBLIC KEY-----
43
+ ...
44
+ -----END PUBLIC KEY-----
45
+ # BC: https://github.com/kyverno/kyverno/issues/5738
46
+ mutate : {}
47
+ validate : {}
48
+ exclude :
49
+ resources : {}
50
+ generate :
51
+ clone : {}
52
+ cloneList : {}
Original file line number Diff line number Diff line change
1
+ policies :
2
+ - name : check-image
3
+ resources :
4
+ # - name: pod-3
5
+ - name : pod-4
You can’t perform that action at this time.
0 commit comments