mirror of
https://github.com/FairwindsOps/polaris.git
synced 2026-08-20 04:36:50 +00:00
* Add missingNetworkPolicy, automountServiceAccountToken, and linuxHardening checks
42 lines
767 B
YAML
42 lines
767 B
YAML
# This succeeds because the NetworkPolicy contains and enables egress and ingress rules, and targets the pod's label.
|
|
apiVersion: v1
|
|
kind: Pod
|
|
metadata:
|
|
name: test-pod
|
|
labels:
|
|
security: medium
|
|
spec:
|
|
containers:
|
|
- name: nginx
|
|
image: nginx
|
|
ports:
|
|
- containerPort: 80
|
|
---
|
|
apiVersion: networking.k8s.io/v1
|
|
kind: NetworkPolicy
|
|
metadata:
|
|
name: test
|
|
spec:
|
|
podSelector:
|
|
matchLabels:
|
|
security: medium
|
|
policyTypes:
|
|
- Egress
|
|
- Ingress
|
|
ingress:
|
|
- from:
|
|
- ipBlock:
|
|
cidr: 0.0.0.0/0
|
|
ports:
|
|
- protocol: TCP
|
|
port: 8080
|
|
egress:
|
|
- to:
|
|
- podSelector:
|
|
matchLabels:
|
|
# Allow outbound with other medium-security pods.
|
|
security: medium
|
|
ports:
|
|
- protocol: TCP
|
|
port: 80
|