Skip to content

Commit

Permalink
Fixes after 20240508
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasdille committed May 10, 2024
1 parent aea8d4c commit 10c6b66
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 6 deletions.
4 changes: 3 additions & 1 deletion 120_kubernetes/kyverno/monitoring.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
## Monitoring

https://kyverno.io/docs/monitoring/
https://kyverno.io/docs/monitoring/

https://github.com/kyverno/policy-reporter
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ spec:
operator: Equals
value: "default"
validate:
message: "FOO"
message: "Die, pod, die"
pattern:
spec:
automountServiceAccountToken: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Pods should not mount service account by default

### Demo [<i class="fa fa-comment-code"></i>](https://github.com/nicholasdille/container-slides/blob/master/120_kubernetes/kyverno/validation_automountServiceAccountToken.demo "validation_automountServiceAccountToken.demo")

Deny pods...l
Deny pods...
- without `automountServiceAccountToken`
- when `serviceAccountName` is...
- not specified or
Expand Down
2 changes: 1 addition & 1 deletion 120_kubernetes/rbac/aggregation.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ rules:
Heavily used in builtin ClusterRoles [](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles)
- `rbac.authorization.k8s.io/aggregate-to-(admin|editview)`
- `rbac.authorization.k8s.io/aggregate-to-(admin|edit|view)`

---

Expand Down
19 changes: 19 additions & 0 deletions 120_kubernetes/rbac/kubeconfig-my-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURCVENDQWUyZ0F3SUJBZ0lJTXhiUWdNK1k2djh3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5T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TjJvZGlyS2Vpa2FkQnRCMlVkT1RqZzF6WApBQU5kY1JEWjdsaW84a0NGS2FhRFZxa3l3RGVsTnB4UlpmNVcwUy9uYlpFaDZQNXJhM0xEZGVHOEwrMGZYWlE1CnhzQmg4SnZFaW13dmhMWXlqVXFUeEVDamJORHBPbEtRbUhDUTF1aGxuRUV1SzVHekhKYWFzZ3J6MjB2cllrYTIKd0dnZXRraFpKdEFTCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
server: https://127.0.0.1:43641
name: kind-kind
contexts:
- context:
cluster: kind-kind
user: kind-kind
name: kind-kind
current-context: kind-kind
kind: Config
preferences: {}
users:
- name: kind-kind
user:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURLVENDQWhHZ0F3SUJBZ0lJTmFtU2E5UTJrcGt3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TkRBMU1EZ3hPVEExTkRCYUZ3MHlOVEExTURneE9URXdOREZhTUR3eApIekFkQmdOVkJBb1RGbXQxWW1WaFpHMDZZMngxYzNSbGNpMWhaRzFwYm5NeEdUQVhCZ05WQkFNVEVHdDFZbVZ5CmJtVjBaWE10WVdSdGFXNHdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCQVFEUWlSUVIKcWJhLytJZnJkUGtHS0ZQMzc2Vlg3VW8rZkJReWNuc2hZUjdzeVhiT1hUS2JjQUtKZGc0VWNLYUdoUTBEaEp3NQpLTmZ4ditnYWI3QlRFTGVxbkFZMGtrdWY0UDhORitCUFAvNWNtMVRRMEJoZW0rZGNGeTBVWmk0bDIyRDEyMUtzClk3czU5dy9zcVI0UVp5TkNHTElUZ1lqTDd0ZmdOMFQzeElsNktPbWhLR0dxK3NLV3FqZ09BVFFxOEtjVktIRncKRnJpaExLZFYvYlBtSlU5SjRwZXRvcHcwUTNiVW5pS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QS82WjEKekdMc1REMnJjckNYNEkwMTNlV3VqV3dXWkZ3c2RzZHFaQnEyZGVpb0ZmUWdsVTgvYXBEOVptK0wyMWd5eWtWcgpZT0R6WCtRT0RhSVdzbzFRZ0FoQ09YM2l5L0NFS1pTcW5LaVZXbWg3UHRpa0dpZC94Z01yRUdVaWxYOXIydDd4CjZYUnJkN0xJei80RURHRFZYY2s1Z3BQTVE1SVRxVTRsSFNlU2puc0NnWUErQ1k1UW5vK2ZKMWxiaVErUDM5R1YKK1FRM1NkSEE4bVBlQm1jbkxvTTByQnEvRnpjSEZPL1grN2dtMGx5VFFhc2k2ZjF1UHlucE5qSEFTMGYzbkphKwpzY25zUzBuOERnVStnNlBvaGF4MDBNdnVIOFN3YThuRFExYnYyVUMyZGFGRWtiUngvNUc5RU5nN09nYlZFUGllCi9leUpWSDhjTk5GNTlsOGd3RkpRT1FLQmdRQzNGeWhXY0tKN0Y4K3FHLzhwdXZoUkt5V1A4MUUySHkxWkJBaVcKR091RUZsUUxKUVFRNnVpb0VaN3B0Z21iMWRiS05sMW96TEtBZ252dUY1L1owSXRPcHB1SFFUa2toZVNoUXUvTgpzbzhFYUwrYml0dzhQdjJyZXFsazNJbWdOOW11cnV6aUhaYTU2emtXZlAyNVA4Q1Bvb1dsbHVRN29HcWtYbXNHCkxra3Y4UUtCZ0ZOYVBNcjlLb0FFN01idEZSY3I5Q3lhaFc5U2tjZWI5NzNvZDljeSs5Y3FzSmJIOHlubmQzSGoKdGFOQjFGTmQ3cGZDckMrMmxrLzRaQ3NFeTJ4RHRCaHFXMFQ1UGw3dW1BZytMZ3VIRlI0K0VXL0tiRVZhMmlWbAptNVk1VmdPVmswR24rZ0IvQldEYzNhTXdITUs1bllBYVZINlVoV0piTlRsNUdVK21EaTVWCi0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==
2 changes: 1 addition & 1 deletion 120_kubernetes/rbac/rbac.demo
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rules:
verbs:
- "get"
- "watch"
- "list"
- "list"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
Expand Down
2 changes: 1 addition & 1 deletion 120_kubernetes/rbac/risks.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Pods obtain permissions of service accounts ...even without `pods/exec`

### Namespace modification

Verb `patch` on namespace allows chaning labels [](https://kubernetes.io/docs/concepts/security/rbac-good-practices/#namespace-modification)...
Verb `patch` on namespace allows changing labels [](https://kubernetes.io/docs/concepts/security/rbac-good-practices/#namespace-modification)...

...and disabling of pod security admission as well as network policies

Expand Down
1 change: 1 addition & 0 deletions 120_kubernetes/rbac/service_account.demo
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ metadata:
name: foo-automount
spec:
serviceAccountName: foo
automountServiceAccountToken: true
containers:
- name: nginx
image: nginx:stable
Expand Down
2 changes: 2 additions & 0 deletions 120_kubernetes/rbac/service_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ Mount service account to a pod and check:
kubectl get pod bar -o=jsonpath='{.spec.imagePullSecrets[0].name}{"\n"}'
```

Works regardless of `automountServiceAccountToken`

### Demo [<i class="fa fa-comment-code"></i>](https://github.com/nicholasdille/container-slides/blob/master/120_kubernetes/rbac/service_account.demo "service_account.demo")

---
Expand Down

0 comments on commit 10c6b66

Please sign in to comment.