generated from nginx/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 85
merge from fork to nap-release-5.7 #575
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
kudriavitsky
wants to merge
17
commits into
nginx:nap-release-5.7
Choose a base branch
from
kudriavitsky:main
base: nap-release-5.7
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
17 commits
Select commit
Hold shift + click to select a range
95173cc
Create ip-groups-override-rules.md
kudriavitsky 3fe5705
Create ip-groups-overview.md
kudriavitsky a33004e
Update configuration.md
kudriavitsky 344be01
Update configuration.md
kudriavitsky f6835f2
Update content/includes/nap-waf/config/common/ip-groups-override-rule…
kudriavitsky db0efbe
Update content/includes/nap-waf/config/common/ip-groups-overview.md
kudriavitsky c08147e
Update content/includes/nap-waf/config/common/ip-groups-override-rule…
kudriavitsky e78a5ba
Update content/includes/nap-waf/config/common/ip-groups-override-rule…
kudriavitsky 09ab5b8
Update content/includes/nap-waf/config/common/ip-groups-override-rule…
kudriavitsky 8683d49
Update content/includes/nap-waf/config/common/ip-groups-override-rule…
kudriavitsky b3dac52
Update content/includes/nap-waf/config/common/ip-groups-overview.md
kudriavitsky 940baa2
Update content/includes/nap-waf/config/common/ip-groups-override-rule…
kudriavitsky 5ce83c3
Merge branch 'nginx:main' into main
kudriavitsky 82f0f1f
Update configuration.md
kudriavitsky fe6bfa3
Update configuration.md in V5
kudriavitsky 2b153be
Update ip-groups-override-rules.md
kudriavitsky dfb5c57
Update configuration.md (ip-groups)
kudriavitsky 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
70 changes: 70 additions & 0 deletions
70
content/includes/nap-waf/config/common/ip-groups-override-rules.md
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,70 @@ | ||
#### IP-Groups feature as part of Override Rules feature. | ||
|
||
The Override Rules feature allows you to modify original or parent policy settings. | ||
|
||
Rules are defined using specific conditions, which can include an IP group based on the declarative policy JSON schema. | ||
|
||
When triggered, the rule is applied to the _clientIp_ attribute using the _matches_ function. | ||
|
||
'clientIp.matches(ipAddressLists["standalone"])' | ||
|
||
Here is a policy example: | ||
|
||
```json | ||
{ | ||
"policy": { | ||
"name": "ip_group_override_rule", | ||
"template": { | ||
"name": "POLICY_TEMPLATE_NGINX_BASE" | ||
}, | ||
"applicationLanguage": "utf-8", | ||
"caseInsensitive": false, | ||
"enforcementMode": "blocking", | ||
"ip-address-lists": [ | ||
{ | ||
"name": "standalone", | ||
"description": "This is my list of IP addresses", | ||
"ipAddresses": [ | ||
{ | ||
"ipAddress": "6.5.3.3/32" | ||
}, | ||
{ | ||
"ipAddress": "6.5.4.2" | ||
} | ||
] | ||
} | ||
], | ||
"override-rules": [ | ||
{ | ||
"name": "myFirstRule", | ||
"condition": "clientIp.matches(ipAddressLists['standalone'])", | ||
"actionType": "violation", | ||
"violation": { | ||
"block": true, | ||
"alarm": true, | ||
"attackType": { | ||
"name": "Forceful Browsing" | ||
}, | ||
"description": "Attempt to access from clientIp", | ||
"rating": 4 | ||
} | ||
} | ||
], | ||
} | ||
} | ||
``` | ||
|
||
The previous example policy contains an IP group with the name "standalone", used for the override rule condition "clientIp.matches(ipAddressLists['standalone'])". | ||
The condition means that the rule enforcement is applied when clientIp is matched to one of ipAddresses in ipAddressList with name "standalone". | ||
The value used for the override condition must exist and exactly match the name in "ip-address-lists". | ||
|
||
#### Possible errors | ||
|
||
| Error text | Input | Explanation | | ||
| -----------| ------------- | ------------ | | ||
| _Invalid field invalidList_ | _clientIp.matches(invalidList['standalone']);_ | An incorrect keyword was used instead of _ipAddressLists_ | | ||
| _Invalid value empty string_ | _clientIp.matches(ipAddressLists['']_ | An empty name was provided | | ||
| _Failed to compile policy - 'ipGroupOverridePolicy'_ | _uri.matches(ipAddressLists['standalone']);_ | Used _ipAddressLists_ without the _clientIP_ attribute | | ||
|
||
|
||
|
86 changes: 86 additions & 0 deletions
86
content/includes/nap-waf/config/common/ip-groups-overview.md
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,86 @@ | ||
IP groups is a feature to organize lists of allowed and forbidden IP addresses across several lists with common attributes. | ||
|
||
This allows you to control unique policy settings for incoming requests based on specific IP addresses. | ||
|
||
Each IP Group contains a unique name, enforcement type (_always_, _never_ and _policy-default_), and list of IP addresses. | ||
|
||
|
||
An example of a declarative policy using IP Groups configuration: | ||
|
||
```json | ||
{ | ||
"policy": { | ||
"name": "IpGroups_policy", | ||
"template": { | ||
"name": "POLICY_TEMPLATE_NGINX_BASE" | ||
}, | ||
"applicationLanguage": "utf-8", | ||
"caseInsensitive": false, | ||
"enforcementMode": "blocking", | ||
"ip-address-lists": [ | ||
{ | ||
"name": "Standalone", | ||
"description": "Optional Description", | ||
"blockRequests": "policy-default", | ||
"setGeolocation": "IN", | ||
"ipAddresses": [ | ||
{ | ||
"ipAddress": "1.2.3.4/32" | ||
}, | ||
{ | ||
"ipAddress": "1111:fc00:0:112::2" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
|
||
``` | ||
The example with IP-Group definition in external file external_ip_groups.json: | ||
|
||
```json | ||
{ | ||
"policy": { | ||
"name": "IpGroups_policy2", | ||
"template": { | ||
"name": "POLICY_TEMPLATE_NGINX_BASE" | ||
}, | ||
"applicationLanguage": "utf-8", | ||
"caseInsensitive": false, | ||
"enforcementMode": "blocking", | ||
"ip-address-lists": [ | ||
{ | ||
"name": "external_ip_groups", | ||
"description": "Optional Description", | ||
"blockRequests": "always", | ||
"setGeolocation": "IL", | ||
"ipAddresses": [ | ||
{ | ||
"ipAddress": "31.8.194.27" | ||
} | ||
], | ||
"$ref": "file:///tmp/policy/external_ip_groups.json" | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
Example of the file external_ip_groups.json | ||
|
||
```json | ||
{ | ||
"name": "External Ip Groups List", | ||
"description": "Optional Description", | ||
"blockRequests": "always", | ||
"setGeolocation": "IR", | ||
"ipAddresses": [ | ||
{ | ||
"ipAddress": "66.51.41.21" | ||
}, | ||
{ | ||
"ipAddress": "66.52.42.22" | ||
} | ||
] | ||
} | ||
``` |
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
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.
might be better: "Brute force prevention example"