Skip to content

Commit f3ab3ed

Browse files
authored
Update configuration.md with bf section (#115)
add brute force configuration
1 parent d05146d commit f3ab3ed

File tree

1 file changed

+116
-174
lines changed

1 file changed

+116
-174
lines changed

content/nap-waf/v5/configuration-guide/configuration.md

Lines changed: 116 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ For more information on the NGINX App Protect WAF security features, see [NGINX
3737
|[XFF headers & trust](#xff-headers-and-trust) | Disabled by default. User can enable it and optionally add a list of custom XFF headers. |
3838
|[gRPC Protection](#grpc-protection-for-unary-traffic) | gRPC content profile detects malformed content, parses well-formed content, and extracts the text fields for detecting attack signatures and disallowed meta-characters. In addition, it enforces size restrictions and prohibition of unknown fields. The Interface Definition Language (IDL) files for the gRPC API must be attached to the profile. gRPC protection can be on [unary](#grpc-protection-for-unary-traffic) or [bidirectional](#grpc-protection-for-bidirectional-streaming) traffic.|
3939
|[Secure Traffic Between NGINX and App Protect Enforcer using mTLS](#secure-traffic-between-nginx-and-app-protect-enforcer-using-mtls) | Disabled by default. You can manually configure mTLS to secure the traffic between NGINX and App Protect Enforcer.|
40+
|[Brute Force Attack Preventions](#brute-force-attack-preventions) | Configure brute-force-attack-preventions parameters to secured areas of a web application from brute force attacks.|
4041

4142
### Disallowed File Types
4243

@@ -788,6 +789,118 @@ To enable mTLS in NGINX, you need to perform the following steps:
788789

789790
Refer to the example for mTLS deployment in the admin guide, whether you're using [Docker]({{< relref "/nap-waf/v5/admin-guide/deploy-on-docker.md#docker-compose-file-with-mtls" >}}) or [Kubernetes]({{< relref "/nap-waf/v5/admin-guide/deploy-on-kubernetes.md#mtls-deployment" >}}).
790791

792+
## Brute Force Attack Preventions
793+
794+
### Overview
795+
796+
Brute force attacks are attempts to break in to secured areas of a web application by trying exhaustive,
797+
systematic, username/password combinations to discover legitimate authentication credentials.
798+
To prevent brute force attacks, WAF tracks the number of failed attempts to reach login pages
799+
with enforced brute force protection. When brute force patterns are detected,
800+
the WAF policy considers it to be an attack if the failed logon rate increased significantly or
801+
if failed logins reached a maximum threshold.
802+
803+
### Brute force policy example
804+
805+
```json
806+
{
807+
"policy": {
808+
"name": "BruteForcePolicy",
809+
"template": {
810+
"name": "POLICY_TEMPLATE_NGINX_BASE"
811+
},
812+
"applicationLanguage": "utf-8",
813+
"enforcementMode": "blocking",
814+
"brute-force-attack-preventions" : [
815+
{
816+
"bruteForceProtectionForAllLoginPages" : true,
817+
"detectionCriteria" : {
818+
"action" : "alarm",
819+
"detectDistributedBruteForceAttack" : true,
820+
"failedLoginAttemptsRateReached" : 100
821+
},
822+
"loginAttemptsFromTheSameIp" : {
823+
"action" : "alarm",
824+
"enabled" : true,
825+
"threshold" : 20
826+
},
827+
"loginAttemptsFromTheSameUser" : {
828+
"action" : "alarm",
829+
"enabled" : true,
830+
"threshold" : 3
831+
},
832+
"measurementPeriod" : 900,
833+
"preventionDuration" : "3600",
834+
"reEnableLoginAfter" : 3600,
835+
"sourceBasedProtectionDetectionPeriod" : 3600
836+
}
837+
]
838+
}
839+
}
840+
841+
```
842+
### brute-force-attack-preventions fields description
843+
844+
bruteForceProtectionForAllLoginPages:
845+
When enabled, enables Brute Force Protection for all configured login URLs.
846+
When disabled, only brute force configurations for specific login pages are applied in case they exist.
847+
848+
detectionCriteria:
849+
Specifies configuration for detecting distributed brute force attacks.
850+
action:
851+
Specifies action that is applied when the defined thresholds ( failedLoginAttemptsRateReached) is reached.
852+
- **alarm**: The system will log the login attempt.
853+
854+
detectDistributedBruteForceAttack:
855+
When enabled, the system detects distributed brute force attacks.
856+
857+
failedLoginAttemptsRateReached:
858+
After configured threshold (number of failed login attempts within measurementPeriod) defined action will be applied for the next login attempt.
859+
860+
loginAttemptsFromTheSameIp:
861+
Specifies configuration for detecting brute force attacks from IP Address.
862+
863+
action:
864+
Specifies action that is applied when defined threshold is reached.
865+
- **alarm**: The system will log the login attempt.
866+
- **alarm-and-blocking-page**: The system will log the login attempt, block the request and send the Blocking page.
867+
- **alarm-and-drop**: The system will log the login attempt and reset the TCP connection.
868+
869+
enabled:
870+
When enabled, the system counts failed login attempts from IP Address.
871+
872+
threshold:
873+
After configured threshold (number of failed login attempts from IP Address) defined action will be applied for the next login attempt.
874+
875+
loginAttemptsFromTheSameUser:
876+
Specifies configuration for detecting brute force attacks for Username.
877+
878+
action:
879+
Specifies action that is applied when defined threshold is reached.
880+
- **alarm**: The system will log the login attempt.
881+
882+
enabled:
883+
When enabled, the system counts failed login attempts for each Username.
884+
885+
threshold:
886+
After configured threshold (number of failed login attempts for each Username) defined action will be applied for the next login attempt.
887+
888+
measurementPeriod:
889+
Defines detection period (measured in seconds) for distributed brute force attacks.
890+
891+
preventionDuration:
892+
Defines prevention period (measured in seconds) for distributed brute force attacks.
893+
894+
reEnableLoginAfter:
895+
Defines prevention period (measured in seconds) for source-based brute force attacks.
896+
897+
sourceBasedProtectionDetectionPeriod:
898+
Defines detection period (measured in seconds) for source-based brute force attacks.
899+
900+
url:
901+
Reference to the URL used in login URL configuration (policy/login-pages). This login URL is protected by Brute Force Protection feature.
902+
903+
791904
## Custom Dimensions Log Entries
792905

793906
### Overview
@@ -931,11 +1044,7 @@ In the cases where decompression fails, NGINX App Protect WAF will continue wit
9311044

9321045
---
9331046

934-
## Converter Tools
935-
936-
NGINX App Protect WAF includes a number of tools that can be used to facilitate the process of porting existing resources or configuration files from the BIG-IP for use in the NGINX App Protect WAF environment. Note that these tools are available in the compiler package, and do not require a full installation of NGINX App Protect WAF or NGINX Plus.
937-
938-
### Policy Converter
1047+
## Policy Converter
9391048

9401049
The NGINX App Protect WAF v5 Policy Converter tool `/opt/app_protect/bin/convert-policy` is used to convert XML policies to JSON format. The converted JSON policy is based on the NGINX App Protect WAF policy base template and contains the minimal differences to it in JSON declarative policy format.
9411050

@@ -947,7 +1056,7 @@ Using the tool:
9471056
/opt/app_protect/bin/convert-policy
9481057
```
9491058

950-
#### Convert Policy using Command Line Interface (CLI Usage)
1059+
### Convert Policy using Command Line Interface (CLI Usage)
9511060

9521061
The input policy can also be converted using convert-policy as a CLI tool from within NGINX App Protect WAF Converter container by using the following commands:
9531062

@@ -961,7 +1070,7 @@ docker run -it --rm \
9611070
--full-export
9621071
```
9631072

964-
#### Command Line Options
1073+
### Command Line Options
9651074

9661075
{{<bootstrap-table "table table-striped table-bordered table-sm table-responsive">}}
9671076
|Field Name | Notes |
@@ -973,173 +1082,6 @@ docker run -it --rm \
9731082
| --dos-profile | Filename of JSON DoS Profile (pre-converted to JSON from tmsh syntax) |
9741083
| --full-export | If specified, the full policy with all entities will be exported. Otherwise, only entities that differ from the template will be included.<br> Default for the CLI is not specific (only differing entities). <br> Default for the REST endpoint above is "--full-export" (you can not override this).|{{</bootstrap-table>}}
9751084

976-
### User Defined Signatures Converter
977-
978-
The User Defined Signatures Converter tool `/opt/app_protect/bin/convert-signatures` takes a User Defined Signatures XML file as input and exports the content as a JSON file suitable for use in an NGINX App Protect WAF environment.
979-
980-
The tool can optionally accept a tag argument as an input. Otherwise, the default tag value `user-defined-signatures` is assigned to the exported JSON file.
981-
982-
Note that the User Defined signatures XML file can be obtained by exporting the signatures from a BIG-IP device.
983-
984-
Using the tool:
985-
```shell
986-
/opt/app_protect/bin/convert-signatures
987-
```
988-
989-
Output:
990-
```shell
991-
USAGE:
992-
/opt/app_protect/bin/convert-signatures
993-
994-
Required arguments:
995-
--outfile|o='/path/to/signatures.json'
996-
File name to write JSON format export
997-
Can also be set via an environment variable: EXPORT_FILE
998-
--infile|i='/path/to/signatures.xml'
999-
Advanced WAF/ASM User Defined Signatures file to Convert
1000-
Can also be set via an environment variable: IMPORT_FILE
1001-
1002-
Optional arguments:
1003-
--tag|t='mytag'
1004-
Signature Tag to associate with User Defined Signatures.
1005-
If no tag is specified in the XML file, a default tag of 'user-defined-signatures' will be assigned.
1006-
Can also be set via an environment variable: TAG
1007-
--format|f='json'
1008-
Desired output format for signature file. Default 'json'
1009-
Supported formats: 'json'
1010-
1011-
Optionally, using --help will issue this help message.
1012-
```
1013-
1014-
Example of generating a user defined signature JSON file (with default tag):
1015-
```shell
1016-
docker run -v `pwd`:`pwd` -w `pwd` --entrypoint /opt/app_protect/bin/convert-signatures docker_img:latest -i /path/to/signatures.xml -o /path/to/signatures.json | jq
1017-
```
1018-
1019-
Output:
1020-
```json
1021-
{
1022-
"filename": "/path/to/signatures.json",
1023-
"file_size": 1602,
1024-
"completed_successfully": true
1025-
}
1026-
```
1027-
1028-
Example of the contents of the output file (displayed and piped into `jq`):
1029-
```json
1030-
{
1031-
"tag": "user-defined-signatures",
1032-
"signatures": [
1033-
{
1034-
"accuracy": "high",
1035-
"risk": "high",
1036-
"systems": [],
1037-
"rule": "content:\"header1\"; nocase;",
1038-
"description": "",
1039-
"signatureType": "request",
1040-
"signatureId": "300000000",
1041-
"revision": "1",
1042-
"lastUpdateMicros": 1731425468000000,
1043-
"name": "sig_1_header",
1044-
"attackType": {
1045-
"name": "Abuse of Functionality"
1046-
}
1047-
},
1048-
{
1049-
"signatureId": "300000002",
1050-
"signatureType": "request",
1051-
"attackType": {
1052-
"name": "Cross Site Scripting (XSS)"
1053-
},
1054-
"name": "sig_3_uri",
1055-
"lastUpdateMicros": 1731425631000000,
1056-
"revision": "1",
1057-
"risk": "high",
1058-
"accuracy": "high",
1059-
"description": "",
1060-
"rule": "uricontent:\"<script>\"; nocase;",
1061-
"systems": [
1062-
{
1063-
"name": "Nginx"
1064-
}
1065-
]
1066-
},
1067-
{
1068-
"name": "sig_2_param",
1069-
"attackType": {
1070-
"name": "Abuse of Functionality"
1071-
},
1072-
"lastUpdateMicros": 1731425549000000,
1073-
"revision": "1",
1074-
"signatureId": "300000001",
1075-
"signatureType": "request",
1076-
"description": "",
1077-
"rule": "valuecontent:!\"param\"; nocase; httponly; norm;",
1078-
"systems": [],
1079-
"accuracy": "high",
1080-
"risk": "high"
1081-
},
1082-
{
1083-
"systems": [
1084-
{
1085-
"name": "Apache"
1086-
},
1087-
{
1088-
"name": "Unix/Linux"
1089-
},
1090-
{
1091-
"name": "Proxy Servers"
1092-
},
1093-
{
1094-
"name": "Django"
1095-
}
1096-
],
1097-
"description": "",
1098-
"rule": "valuecontent:\"json123\"; nocase; jsononly; norm;",
1099-
"risk": "high",
1100-
"accuracy": "high",
1101-
"lastUpdateMicros": 1731425782000000,
1102-
"revision": "1",
1103-
"attackType": {
1104-
"name": "Server-Side Request Forgery (SSRF)"
1105-
},
1106-
"name": "sig_5_",
1107-
"signatureType": "request",
1108-
"signatureId": "300000004"
1109-
},
1110-
{
1111-
"description": "",
1112-
"rule": "uricontent:\"etc\"; nocase;",
1113-
"systems": [
1114-
{
1115-
"name": "Microsoft Windows"
1116-
},
1117-
{
1118-
"name": "Unix/Linux"
1119-
}
1120-
],
1121-
"accuracy": "high",
1122-
"risk": "high",
1123-
"name": "sig_4_",
1124-
"attackType": {
1125-
"name": "Path Traversal"
1126-
},
1127-
"lastUpdateMicros": 1731425708000000,
1128-
"revision": "1",
1129-
"signatureId": "300000003",
1130-
"signatureType": "request"
1131-
}
1132-
]
1133-
}
1134-
```
1135-
1136-
Example of generating a user defined signature JSON file (with custom tag):
1137-
```shell
1138-
docker run -v `pwd`:`pwd` -w `pwd` --entrypoint /opt/app_protect/bin/convert-signatures docker_img:latest -i /path/to/signatures.xml -o /path/to/signatures.json --tag "MyTag" | jq
1139-
```
1140-
1141-
Note that if the script is run without the required switches and their corresponding arguments, it will display the help message.
1142-
11431085
---
11441086

11451087
## Security Logs

0 commit comments

Comments
 (0)