Jump to content
  • entries
    142
  • comments
    0
  • views
    83597

Protect your Web App using Azure Application Gateway Web Application Firewall


proximagr

489 views

 Share

Protect your Web App using Azure Application Gateway Web Application Firewall
Web Application Firewall was always a big investment for a small or growing company as most of the top branded companies are charging a lot of money A Web Application Firewall protects your application from common web vulnerabilities and exploits like SQL Injection or Cross site scripting. Azure provides enterprise grade Web Application Firewall through the Application Gateway. It comes in two pricing models, Medium and Large. More about sizes and instances you can find here, and more about pricing here
We can add the Application Gateway Web Application Firewall to protect our Azure Web App (PaaS) and our Web Application inside a VMs web server (IaaS). At this post we will see how to protect them both.
appgatewaywafvm.jpg
One difference in order to fully protect the Azure Web App (PaaS) is to create an App Service Environment with internal VIP to host the Web App in order to hide it inside a VNET. First things first, create a VNET with one subnet for the Application Gateway WAF.App Service Environment
After the VNET create the App Service Environment, from the Azure Portal, New –> App Service Environment and select VIP Type “Internal”. Add it to the VNET created before and create a subnet for the ASE. You need to be patient here because the deploy will take more than an hour, almost two.
img_59e25c07f36a2.pngWeb App
As soon as the App Service Environment is ready we can create our Web App. Create a Web App from Azure Portal with one difference, on the App Service Plan location instead of selecting a Region select he App Service Environment.
img_59e25a67d94c5.png
As you realize, the Web App resides at the internal VNET with no access from the internet. So, in order to access the application at this point we need a VM ( a small one just to test and deploy our application ). Create a small VM and add it to this VNET. One small detail, in order to be able to browse to the site’s URL we need to enter the FQDN, in our case papwaf3app.funniest.gr. In order to do this we need an entry at the VM’s host file. This way we can access the new born Web App.
img_59e2349064b81.pngWeb Application Firewall
Lets create the Secure public entry point for our Web App. Create an application gateway, select WAF Tier, select the required SKU, add it to the WAF subnet we created before, select Public IP configuration and WAF enabled.
img_59e25f1b11d95.png
img_59e2359888b97.png
When the Application gateway is ready we need to do some configuration. First at the Backend pools, open the default created backend pool add the Internal Load Balancer IP address of the ASE as target.
img_59e23cf890acd.png
Then add a health probe. For host add the FQDN of the Web App.
img_59e23d966597a.png
at the HTTP settings check the “Use custom probe” and select the previously created probe.
img_59e23e88362b5.png
And that’s all. Now we can try our Web App from the Internet. In order to do so we need to browse to the Web App’s URL, that is now published by the Application Gateway, from the Internet. So, we need to create a Public DNS record to point the FQDN to the Application Gateway’s FQDN. In this case we need to crate a CNAME papwaf3app.funniest.gr to point to the 8b0510c1-47e9-4b94-a0ff-af92e4455840.cloudapp.net. In order to test the app right now we can just add a host file to our computer pointing to the Public IP Address of the application gateway and we can access the Web App behind the WAF.
img_59e2615d9fd0c.png
img_59e23fc549914.pngLogging
In order to be able to see the Application Gateway and Web Application Firewall logs we need to turn on diagnostics. The easiest way to see the logs is by sending them to Log Analytics (OMS).
img_59e240034d99e.png
img_59e2404e90c37.png
img_59e251cbdc0f8.png
With the Firewall at “Detection” mode, if we try an SQL Injection (?id=10||UTL_INADDR.GET_HOST_NAME( (SELECT user FROM DUAL) )–), the Web App still servers the landing page.
img_59e256703b895.png
By switching the Firewall to “Prevention” mode, the same SQL injection attach stops by the WAF before accessing our Web App.
img_59e2565c042a8.pngProtect an IaaS Web Application
To add a Web Application that runs inside a VM behind the Application Gateway Web Application Firewall, first add the VM as a Back End Pool. Create a new Backend Pool and select “Virtual Machine”. Select the Virtual Machine that runs the Web Application.
img_59e38491d257e.png
Then create a new probe adding the URL of the Web Applicationimg_59e384f93f20c.png
next add HTTP settings and add custom probe the new created probe “vmsite”
img_59e38d35ddce3.png
Next step is to create two multi-site listeners, one for each host name
img_59e38f3f06837.png
After the listener, add a Basic rule using the Listener, Backend Pool and HTTP settings we created for the VM Web Application,
img_59e38f77d13c0.png
Finally one extra step is to change the default rule1 to listen to the WeB App listener
img_59e3913eaf3dd.png
Finally the Application Gateway Web Application Firewall provides secure access to both the Web App (PaaS) and the VM Web Application (IaaS)
img_59e392843b503.png
[/url]share_save_171_16.png
The post Protect your Web App using Azure Application Gateway Web Application Firewall appeared first on Apostolidis IT Corner.



Source

 Share

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...