-
Notifications
You must be signed in to change notification settings - Fork 1
/
verify.yaml
71 lines (71 loc) · 2.24 KB
/
verify.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
apiVersion: v1
kind: Pod
metadata:
name: ingress-waf-webhook-available
spec:
containers:
- name: await
image: ghcr.io/utopia-planitia/kubectl-image:v1.24.3
command:
- bash
- -c
args:
- |
set -e
set -u
set -o pipefail
set -x
rm -f /tmp/available
until curl -k --max-time 10 --fail https://ingress-waf.nginx-ingress.svc.cluster.local:9443/healthz; do
echo "webhook not available yet"
sleep 5
done
sleep 5
touch /tmp/available
sleep infinity
readinessProbe:
exec:
command:
- test
- -f
- /tmp/available
---
apiVersion: v1
kind: Pod
metadata:
name: ingress-waf-labels-exists
spec:
containers:
- name: test
image: ghcr.io/utopia-planitia/kubectl-image:v1.24.3
command:
- bash
- -c
args:
- |
set -e
set -u
set -o pipefail
set -x
kubectl delete ingress test --ignore-not-found=true --wait=true
kubectl create ingress test --rule=foo.com/bar=svc1:8080
kubectl get ingress test -o yaml
[[ "$(kubectl get ingress test -o jsonpath='{.metadata.annotations.nginx\.ingress\.kubernetes\.io\/enable-modsecurity}')" == "true" ]]
[[ "$(kubectl get ingress test -o jsonpath='{.metadata.annotations.nginx\.ingress\.kubernetes\.io\/enable-owasp-core-rules}')" == "true" ]]
[[ "$(kubectl get ingress test -o jsonpath='{.metadata.annotations.nginx\.ingress\.kubernetes\.io\/modsecurity-snippet}')" =~ "SecRuleEngine On" ]]
[[ "$(kubectl get ingress test -o jsonpath='{.metadata.annotations.nginx\.ingress\.kubernetes\.io\/modsecurity-snippet}')" =~ "SecAuditLog /dev/stdout" ]]
[[ "$(kubectl get ingress test -o jsonpath='{.metadata.annotations.nginx\.ingress\.kubernetes\.io\/modsecurity-transaction-id}')" == "\$request_id" ]]
echo done
sleep infinity
---
kind: RoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: ingress-waf-tester
subjects:
- kind: ServiceAccount
name: default
roleRef:
kind: ClusterRole
name: cluster-admin
apiGroup: rbac.authorization.k8s.io