Hello @milancas
You can use nginx.ingress.kubernetes.io/modsecurity-snippet
ModSecurity snippet in your Ingress annotations
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
...
annotations:
# To restric traffic coming only through our Front Door instance, we use a header check on the X-Azure-FDID
# The value gets injected by the pipeline. Hence, this ID should be treated as a senstive value
nginx.ingress.kubernetes.io/modsecurity-snippet: |
SecRuleEngine On
SecRule &REQUEST_HEADERS:X-Azure-FDID \"@eq 0\" \"log,deny,id:106,status:403,msg:\'Front Door ID not present\'\"
SecRule REQUEST_HEADERS:X-Azure-FDID \"@rx ^(?!{{ .Values.azure.frontdooridfirst }}).$\" \"log,deny,id:107,status:403,msg:\'Wrong Front Door ID\'\"
SecRule REQUEST_HEADERS:X-Azure-FDID \"@rx ^(?!{{ .Values.azure.frontdooridsecond }}).$\" \"log,deny,id:107,status:403,msg:\'Wrong Front Door ID\'\"
...
If you think your question has been answered, click "Mark as Accept Answer" if just helped click "Vote as helpful". This can be beneficial to other community members reading this forum thread.