-
Notifications
You must be signed in to change notification settings - Fork 94
Added the document and BRS for Application Gateway #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jaiswalricha
wants to merge
2
commits into
main
Choose a base branch
from
users/v-rijaiswal/ApplicationGatewayBRSandDocChanges
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,108 @@ | ||
| # ApplicationGateway | ||
|
|
||
| **Resource Type:** Microsoft.Network/applicationGateways | ||
|
|
||
| <!-- TOC --> | ||
|
|
||
| - [Azure_ApplicationGateway_NetSec_Enable_WAF_Configuration_Trial](#azure_applicationgateway_netsec_enable_waf_configuration_trial) | ||
|
|
||
| <!-- /TOC --> | ||
| <br/> | ||
|
|
||
| ___ | ||
|
|
||
| ## Azure_ApplicationGateway_NetSec_Enable_WAF_Configuration_Trial | ||
|
|
||
| ### Display Name | ||
| [Trial] Application Gateway should have Web Application Firewall configured | ||
|
|
||
| ### Rationale | ||
| Web application firewall configuration protects Application Gateway from internet based vulnerabilities and attacks without modification to back-end code. | ||
|
|
||
| ### Control Spec | ||
|
|
||
| > **Passed:** | ||
| > Web Application Firewall has been configured on Application Gateway. | ||
| > Configured WAF Policy mode must be Prevention only. | ||
| > DDoS is enabled on the Virtual Network assoicated with the Application Gateway. | ||
| > Network Security Group is configured on the subnet assoicated with the Application Gateway. | ||
| > | ||
| > **Failed:** | ||
| > WAF is not configured on Application Gateway. | ||
| > Configured WAF Policy mode is not Prevention. | ||
| > DDoS is not enabled on the Virtual Network assoicated with the Application Gateway. | ||
| > Network Security Group is not configured on the subnet assoicated with the Application Gateway. | ||
| > | ||
| > **Error:** | ||
| > There was an error fetching WAF Configuration details of Application Gateway. | ||
| > | ||
| ### Recommendation | ||
|
|
||
| - **Azure Portal** | ||
|
|
||
| Use the Azure portal to configure WAF on the Application Gateway. | ||
|
|
||
| - **PowerShell** | ||
|
|
||
| ```powershell | ||
|
|
||
| # Below commands will be useful to Configure WAF on Application Gateway | ||
| Connect-AzAccount | ||
| Set-AzContext -SubscriptionId "<sub id>"` | ||
| #Get Application Gateway and existing policy object | ||
| $appgw = Get-AzApplicationGateway -Name "applicationgatewayName" -ResourceGroupName "RgName" | ||
| $policy = Get-AzApplicationGatewayFirewallPolicy -Name "WAFPolicyName" -ResourceGroupName "RgName" | ||
|
|
||
| #Attach the policy to an Application Gateway | ||
| $appgw.FirewallPolicy = $policy | ||
| #Save the Application Gateway | ||
| Set-AzApplicationGateway -ApplicationGateway $appgw | ||
|
|
||
| #Below commands will be useful to configure the WAF at the listener level in the Application Gateway: | ||
| Connect-AzAccount | ||
| Set-AzContext -SubscriptionId "<sub id>"` | ||
| #Get Application Gateway, Listener and existing policy object | ||
| $appgw = Get-AzApplicationGateway -Name "applicationgatewayName" -ResourceGroupName "RgName" | ||
| $policy = Get-AzApplicationGatewayFirewallPolicy -Name "WAFPolicyName" -ResourceGroupName "RgName" | ||
| $listener = Get-AzApplicationGatewayHttpListener -Name "L1" -ApplicationGateway $appgw | ||
| #Attach the policy to an Application Gateway Listener | ||
| $listener.FirewallPolicy = $policy | ||
|
|
||
| #Save the Application Gateway Listener | ||
| Set-AzApplicationGatewayHttpListener -FirewallPolicy $policy -ApplicationGateway $appgw | ||
|
|
||
| Below commands could be run to change the Policy Mode to Prevention mode: | ||
| Connect-AzAccount | ||
| Set-AzContext -SubscriptionId "<sub id>"` | ||
| #Get Application Gateway Firewall policy | ||
| $policy = Get-azapplicationGatewayFirewallPolicy -Name "WAFPolicyName" -ResourceGroupName "RGName" | ||
| #Get the Policy Settings and Set the Mode to prevention | ||
| $Policysettings = $policy.PolicySettings | ||
| $Policysettings.Mode = "Prevention" | ||
| #Save the WAF Policy | ||
| Set-AzApplicationGatewayFirewallPolicy -PolicySetting $Policysettings -InputObject $policy | ||
|
|
||
| Run command | ||
| Retrieve-ApplicationGatewayVirtualNetworkDDoSNotConfigured - to retrieve the list of Application Gateway virtual network where DDoS is not enabled. | ||
| Run Enable-DDoSProtectionPlanOnVirtualNetwork to remediate the Virtual Network(s) retrieved from above command. | ||
|
|
||
| Run command Retrieve-ApplicationGatewaySubnetNSGNotConfigured to retrieve the list of Application Gateway subnet where NSG is not configured. | ||
| Run Add-NSGConfigurationOnSubnet to remediate the Subnet(s) retrieved from above command. | ||
|
|
||
| # For more help run: | ||
| Get-Help Retrieve-ApplicationGatewayVirtualNetworkDDoSNotConfigured -Detailed | ||
| Get-Help Enable-DDoSProtectionPlanOnVirtualNetwork -Detailed | ||
| Get-Help Retrieve-ApplicationGatewaySubnetNSGNotConfigured -Detailed | ||
| Get-Help Add-NSGConfigurationOnSubnet -Detailed | ||
| ``` | ||
|
|
||
| ### Azure Policy or ARM API used for evaluation | ||
|
|
||
| - ARM API to list all Application Gateway: /subscriptions/{0}/providers/Microsoft.Network/applicationGateways?api-version=2022-01-01<br /> | ||
| **Properties:** properties.rights | ||
| <br /> | ||
|
|
||
| <br /> | ||
|
|
||
| ___ | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we getting everything we need for control evaluation by just single API call?