Last active
September 19, 2024 10:40
-
-
Save soderlind/38ba10db6603db449c7f4a9333491c41 to your computer and use it in GitHub Desktop.
WordPress: Use Azure Front Door to rate limit access the login page
This file contains 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
resource wafPolicy 'Microsoft.Network/FrontDoorWebApplicationFirewallPolicies@2022-05-01' = { | |
name: wafPolicyName | |
location: 'global' | |
sku: { | |
name: frontDoorSkuName | |
} | |
tags: tags | |
properties: { | |
policySettings: { | |
enabledState: 'Enabled' | |
mode: wafMode | |
customBlockResponseStatusCode: 429 | |
} | |
customRules: { | |
rules: [ | |
{ | |
name: 'RateLimitOthers' | |
priority: 1 | |
ruleType: 'RateLimitRule' | |
matchConditions: [ | |
{ | |
matchVariable: 'RemoteAddr' | |
operator: 'GeoMatch' | |
negateCondition: true // Don't match the matchValue | |
matchValue: [ | |
'NO' // ISO country code for Norway | |
] | |
} | |
{ | |
matchVariable: 'RequestUri' | |
operator: 'BeginsWith' | |
matchValue: [ | |
'/wp-login.php' | |
] | |
} | |
] | |
action: 'Block' | |
rateLimitThreshold: 5 // Set your rate limit threshold | |
rateLimitDurationInMinutes: 1 // Set your rate limit duration | |
} | |
] | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment