Skip to content

Commit 9283688

Browse files
authored
Add documentation for UDS converter in NAP5
1 parent b188442 commit 9283688

File tree

1 file changed

+174
-3
lines changed

1 file changed

+174
-3
lines changed

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

Lines changed: 174 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,11 @@ In the cases where decompression fails, NGINX App Protect WAF will continue wit
931931

932932
---
933933

934-
## Policy Converter
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
935939

936940
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.
937941

@@ -943,7 +947,7 @@ Using the tool:
943947
/opt/app_protect/bin/convert-policy
944948
```
945949

946-
### Convert Policy using Command Line Interface (CLI Usage)
950+
#### Convert Policy using Command Line Interface (CLI Usage)
947951

948952
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:
949953

@@ -957,7 +961,7 @@ docker run -it --rm \
957961
--full-export
958962
```
959963

960-
### Command Line Options
964+
#### Command Line Options
961965

962966
{{<bootstrap-table "table table-striped table-bordered table-sm table-responsive">}}
963967
|Field Name | Notes |
@@ -969,6 +973,173 @@ docker run -it --rm \
969973
| --dos-profile | Filename of JSON DoS Profile (pre-converted to JSON from tmsh syntax) |
970974
| --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>}}
971975

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+
9721143
---
9731144

9741145
## Security Logs

0 commit comments

Comments
 (0)