This example describes how to deploy the NGINX Plus Ingress Controller with NGINX App Protect and NGINX Agent in order to integrate with NGINX Management Suite Security Monitoring. It involves deploying a simple web application, then configure load balancing and WAF protection for the application using the VirtualServer resource. Afterwards, we configure NGINX App Protect to send logs to the NGINX Agent syslog listener, which is then sent to the Security Monitoring dashboard in NGINX Instance Manager.
-
Follow the installation instructions to deploy NGINX Ingress Controller with NGINX App Protect and NGINX Agent. Configure NGINX Agent to connect to a deployment of NGINX Instance Manager with Security Monitoring, and verify your NGINX Ingress Controller deployment is online in NGINX Instance Manager.
-
Save the public IP address of the Ingress Controller into a shell variable:
IC_IP=XXX.YYY.ZZZ.III
-
Save the HTTP port of NGINX Ingress Controller into a shell variable:
IC_HTTP_PORT=<port number>
Create the application deployment and service:
kubectl apply -f webapp.yaml
-
Create the User Defined Signature, App Protect policy and log configuration:
kubectl apply -f ap-apple-uds.yaml kubectl apply -f ap-dataguard-alarm-policy.yaml kubectl apply -f ap-logconf.yaml
Note the log configuration in ap-logconf.yaml
is a specific format required by NGINX Agent for integration with Security Monitoring.
-
Create the WAF policy
kubectl apply -f waf.yaml
Note the App Protect configuration settings in the Policy resource. They enable WAF protection by configuring App Protect with the policy and log configuration created in the previous step.
-
Create the VirtualServer Resource:
kubectl apply -f virtual-server.yaml
Note that the VirtualServer references the policy waf-policy
created in Step 3.
To access the application, **curl** the coffee and the tea services. Use the --resolve option to set the Host header of a request with
webapp.example.com`
-
Send a request to the application:
curl --resolve webapp.example.com:$IC_HTTP_PORT:$IC_IP http://webapp.example.com:$IC_HTTP_PORT/
Server address: 10.12.0.18:80 Server name: webapp-7586895968-r26zn ...
-
Send a request with a suspicious URL:
curl --resolve webapp.example.com:$IC_HTTP_PORT:$IC_IP "http://webapp.example.com:$IC_HTTP_PORT/<script>"
<html><head><title>Request Rejected</title></head><body> ...
-
Finally, send some suspicious data that matches the user defined signature.
curl --resolve webapp.example.com:$IC_HTTP_PORT:$IC_IP -X POST -d "apple" http://webapp.example.com:$IC_HTTP_PORT/
<html><head><title>Request Rejected</title></head><body> ...
The suspicious requests are demonstrably blocked by App Protect.
-
Access the Security Monitoring dashboard in NGINX Instance Manager to view details for the blocked requests.