Setting Up Azure Application Gateway WAF for Web Protection

Author

Reads 267

Security Logo
Credit: pexels.com, Security Logo

To set up Azure Application Gateway WAF for web protection, you'll first need to create a resource group in Azure. This is where all your resources, including the Application Gateway, will be stored.

In the resource group, you'll create a new Application Gateway. Make sure to choose the "WAF" tier, as this will enable web application firewall capabilities.

The WAF tier comes with a set of predefined rules that help protect against common web attacks. These rules can be customized to fit your specific needs.

Next, you'll need to configure the WAF policy, which determines how the Application Gateway will respond to threats. This can be a bit complex, but don't worry, it's easier than it sounds.

Benefits and Features

The Azure Application Gateway WAF is a powerful tool that provides robust security for your web applications. It offers a wide range of benefits and features that can help protect your applications from various types of attacks.

Credit: youtube.com, Microsoft Azure Application Gateway Deep Dive

One of the key benefits is that it provides protection against common web attacks, including SQL injection and cross-site scripting. This is achieved through its robust feature set, which includes protection against command injection, HTTP request smuggling, and HTTP response splitting.

The WAF also provides protection against HTTP protocol violations and anomalies, such as missing host user-agent and accept headers. This helps to prevent attacks that rely on exploiting these vulnerabilities.

Some of the specific features of the WAF include protection against crawlers and scanners, detection of common application misconfigurations, and configurable request size limits. You can also create custom rules to suit the specific needs of your applications.

Here are some of the key features of the Azure Application Gateway WAF:

  • SQL injection protection
  • Cross-site scripting protection
  • Protection against common web attacks, such as command injection, HTTP request smuggling, and HTTP response splitting
  • Protection against HTTP protocol violations and anomalies
  • Exclusion lists for omitting certain request attributes from a WAF evaluation
  • Custom rules for specific application needs
  • Geo-filtering for traffic control
  • Bot mitigation ruleset for protecting against bots
  • JSON and XML inspection in the request body

These features make the Azure Application Gateway WAF a powerful tool for protecting your web applications from various types of attacks. By using this WAF, you can help ensure the security and reliability of your applications.

Protection and Monitoring

Credit: youtube.com, Web Application Firewall Azure Configuration | WAF Step by Step

Azure Application Gateway WAF offers robust protection and monitoring features to safeguard your web applications. It can protect up to 40 websites simultaneously without modifying the back-end code.

You can create custom WAF policies for different sites behind the same WAF, ensuring tailored security for each application. Additionally, the IP Reputation ruleset helps protect against malicious bots.

Here are some key protection features:

  • Protects against web vulnerabilities and attacks without modifying back-end code.
  • Protects multiple web applications at the same time, hosting up to 40 websites.
  • Creates custom WAF policies for different sites behind the same WAF.
  • Protects against malicious bots with the IP Reputation ruleset.
  • Protects against DDoS attacks, with more information available on Application DDoS Protection.

For monitoring, Azure Application Gateway WAF integrates with Azure Monitor to track WAF alerts and logs in real-time. This allows you to easily monitor trends and track attacks against your web applications.

Protection

You can protect your web applications from web vulnerabilities and attacks without modifying the back-end code. This is a huge advantage, as it allows you to keep your existing code intact while still getting the benefits of web application firewall (WAF) protection.

Application Gateway can host up to 40 websites that are protected by a WAF, making it a convenient option for large-scale web applications. You can also create custom WAF policies for different sites behind the same WAF, giving you fine-grained control over security settings.

Credit: youtube.com, Beacon Protection Monitoring Center

Protecting against malicious bots is also a key feature of Application Gateway. You can enable a managed bot protection rule set to take custom actions on requests from all bot categories. This includes blocking malicious bots, allowing verified search engine crawlers, and logging unknown bots by default.

Here are the three bot categories supported by Application Gateway:

  • Bad bots: malicious IP addresses and bots that have falsified their identities
  • Good bots: trusted user agents
  • Unknown bots: user agents without additional validation

By enabling bot protection, you can block malicious bots and ensure that only legitimate traffic reaches your web applications. This can help prevent common attacks like scraping and brute-force login attempts.

Monitoring

Monitoring is crucial for protecting your web applications. You can monitor attacks against your web applications by using a real-time WAF log, which is integrated with Azure Monitor to track WAF alerts and easily monitor trends.

The Application Gateway WAF is integrated with Microsoft Defender for Cloud, providing a central view of the security state of all your Azure, hybrid, and multicloud resources.

Woman using a secure mobile app, showcasing data encryption on a smartphone.
Credit: pexels.com, Woman using a secure mobile app, showcasing data encryption on a smartphone.

To support the health of your application gateway, integrate your WAF and the applications it protects with Microsoft Defender for Cloud, Azure Monitor, and Azure Monitor logs.

Azure Monitor logs are integrated with the Application Gateway, allowing you to track diagnostic information, including WAF alerts and logs.

You can access this capability on the Diagnostics tab in the Application Gateway resource in the portal or directly through Azure Monitor.

  1. Real-time WAF logs are integrated with Azure Monitor to track WAF alerts and monitor trends.
  2. Application Gateway logs are integrated with Azure Monitor to track diagnostic information.
  3. Microsoft Defender for Cloud provides a central view of the security state of all your Azure, hybrid, and multicloud resources.

This integration allows you to have a comprehensive view of your application's security and performance.

Configuration and Customization

You can configure and deploy all WAF policies using the Azure portal, REST APIs, Azure Resource Manager templates, and Azure PowerShell. This provides flexibility in managing your WAF policies.

Customization is key when it comes to WAF rules. You can customize WAF rules and rule groups to suit your application requirements and eliminate false positives. This is done by creating custom rules that are evaluated for each request that passes through WAF.

Credit: youtube.com, Azure Application Gateway + Web Application Firewall

Custom rules can be duplicated within a given policy, and you can also copy them from one Application Gateway WAF policy to another as long as the policies are both in the same subscription. This allows for easy management and reuse of custom rules.

Here are the ways to configure WAF rules:

  • Azure portal
  • REST APIs
  • Azure Resource Manager templates
  • Azure PowerShell

You can also configure and manage Azure WAF policies at scale using Firewall Manager integration (preview). This provides a more streamlined way of managing your WAF policies.

What We Want to Achieve

We want to achieve a specific goal with our web application configuration. Our goal is to restrict access based on location or country/region.

In this setup, we're looking to evaluate requests from users based on their location. This means we'll be taking into account where the user is coming from in the world.

We've associated a Web Application Firewall (WAF) policy with our Application Gateway. This policy has a custom geo-filtering rule that plays a crucial role in our setup.

This geo-filtering rule evaluates the requestor's location, and if there's a match, the WAF will allow or deny the request based on the condition.

Customization

A woman with blue hair types on a keyboard in a dark, tech-themed room, implying cybersecurity work.
Credit: pexels.com, A woman with blue hair types on a keyboard in a dark, tech-themed room, implying cybersecurity work.

Customization is a key feature of Application Gateway's Web Application Firewall (WAF). You can customize WAF rules and rule groups to suit your application requirements and eliminate false positives. This allows you to tailor the security settings to your specific needs.

To create a customized WAF policy, you can associate a WAF policy for each site behind your WAF, allowing for site-specific configuration. This means you can have different security settings for different websites or applications.

Custom rules are also supported, enabling you to create your own rules that are evaluated for each request passing through the WAF. These rules hold a higher priority than the rest of the rules in the managed rule sets.

You can create custom rules to suit the needs of your application, such as blocking traffic from specific countries or regions. For example, you can create a geo-filtering custom rule to allow or block traffic from specific countries or regions.

Computer server in data center room
Credit: pexels.com, Computer server in data center room

Here are some key benefits of customization:

  • Customize WAF rules and rule groups to suit your application requirements
  • Associate a WAF policy for each site behind your WAF
  • Create custom rules to suit the needs of your application

By customizing your WAF policy, you can ensure that your web applications are protected by the security settings that are most relevant to your specific use case.

Configuration

You can configure and deploy all WAF policies using the Azure portal, REST APIs, Azure Resource Manager templates, and Azure PowerShell. This provides a range of options for managing your WAF settings.

The Azure portal is a user-friendly interface for configuring and managing your WAF policies. You can also use REST APIs, Azure Resource Manager templates, and Azure PowerShell for more advanced and automated configurations.

Firewall Manager integration is available in preview, allowing you to configure and manage Azure WAF policies at scale. This feature is a great option for large-scale deployments.

To configure WAF rules, you can change the mode settings to Prevention, which blocks matching rules defined in the Microsoft Managed Rulesets you selected. This mode is useful for testing and deploying your WAF policies in a production environment.

Credit: youtube.com, Configuration vs. Customization: Understanding the Differences

Here are the key components required for Application Gateway to work:

  • Frontend IP
  • Backend pool
  • Listener
  • HTTP Setting

These components work together to provide a robust and secure application delivery controller.

If you have a Custom Rules only WAF Policy, you can upgrade to a new WAF Policy by creating a Web Application Firewall Policy and associating it with your Application Gateway(s) and listener(s). This will allow you to make changes to your WAF rules and settings.

Selector (Optional)

The selector is an optional field that describes the field of the matchVariable collection. For example, if the matchVariable is RequestHeaders, the selector could be on the User-Agent header.

The selector must be one of the following operators:

Operator [Required]

The Operator is a crucial component of a WAF policy, and it's required to specify how to match the value of the matchVariable. It can be one of the following operators.

IPMatch is only used when the Match Variable is RemoteAddr, and only supports IPv4. Equal is used when the input is the same as the MatchValue.

Credit: youtube.com, Operators get more control and customization over their workstation environment

Any is a recommended operator for Match Variables with a valid Selector. It doesn't require a MatchValue. Contains, LessThan, GreaterThan, LessThanOrEqual, and GreaterThanOrEqual are also available operators.

BeginsWith and EndsWith are useful for matching strings. Regex is used for regular expression matching. Geomatch is used for geographic location matching.

Here are the available operators in a concise list:

  • IPMatch
  • Equal
  • Any
  • Contains
  • LessThan
  • GreaterThan
  • LessThanOrEqual
  • GreaterThanOrEqual
  • BeginsWith
  • EndsWith
  • Regex
  • Geomatch

Configure Rules (Optional)

Configure rules (optional) is a feature that allows you to customize your Web Application Firewall (WAF) policy to meet your specific application protection requirements. This feature is optional, but it can be a game-changer for those who need more control over their WAF policy.

You can configure WAF rules to detect and block malicious traffic, or you can choose to log the traffic instead. This is done by changing the mode settings from Detection to Prevention. In Prevention mode, matching rules defined in the Microsoft Managed Rulesets are blocked and/or logged in the WAF logs.

Credit: youtube.com, Sonarwhal Ep 3: Adding custom configuration to your rules

Custom rules can be created to suit the needs of your application. These rules hold a higher priority than the rest of the rules in the managed rule sets. If a set of conditions is met, an action is taken to allow or block.

Custom rules can also be duplicated within a given policy. When duplicating a rule, you need to specify a unique name for the rule and a unique priority value. This allows you to create multiple instances of the same rule with different priorities.

To configure custom rules, you can use the Azure portal, REST APIs, Azure Resource Manager templates, or Azure PowerShell. You can also configure and manage Azure WAF policies at scale using Firewall Manager integration (preview).

Here's a quick reference guide to help you understand the different modes and rules:

Note that this is not an exhaustive list, and you should consult the official documentation for more information on configuring WAF rules. However, this should give you a good starting point for understanding the basics of configuring rules (optional) for your WAF policy.

Frequently Asked Questions

What is the difference between Azure firewall and Application Gateway WAF?

Azure Firewall provides central logging and control, while Application Gateway WAF offers protection at the web application layer, with one sitting after the other in the traffic flow. This layered approach provides robust security and visibility for your web applications.

What is the difference between a gateway and a WAF?

A web gateway focuses on filtering unwanted software, whereas a Web Application Firewall (WAF) specifically safeguards web applications from attacks by monitoring HTTP traffic

Rosemary Boyer

Writer

Rosemary Boyer is a skilled writer with a passion for crafting engaging and informative content. With a focus on technical and educational topics, she has established herself as a reliable voice in the industry. Her writing has been featured in a variety of publications, covering subjects such as CSS Precedence, where she breaks down complex concepts into clear and concise language.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.