2
2
3
3
# [ PerimeterX] ( http://www.perimeterx.com ) NGINX Lua Plugin
4
4
5
- > Latest stable version: [ v7.3.4 ] ( https://luarocks.org/modules/bendpx/perimeterx-nginx-plugin/7.3.4 -1 )
5
+ > Latest stable version: [ v7.3.5 ] ( https://luarocks.org/modules/bendpx/perimeterx-nginx-plugin/7.3.5 -1 )
6
6
7
7
## [ Introduction] ( #introduction )
8
8
61
61
62
62
## [ Enrichment] ( #enrichment )
63
63
64
- - [ Data Enrichment] ( #data-enrichment )
65
- - [ Log Enrichment] ( #log-enrichment )
64
+ - [ Data Enrichment] ( #data-enrichment )
65
+ - [ Log Enrichment] ( #log-enrichment )
66
66
67
67
## [ Advanced Blocking Response] ( #advancedBlockingResponse )
68
68
69
69
## [ Login Credentials Extraction] ( #loginCredentialsExtraction )
70
70
71
71
- [ Login Credentials Extraction Configuration] ( #loginCredentialsExtractionConfiguration )
72
- - [ Enable Login Credentials Extraction] ( #px_enable_login_creds_extraction )
73
- - [ Credentials JSON file] ( #px_login_creds_settings_filename )
74
- - [ Credentials Intelligence Version] ( #px_credentials_intelligence_version )
75
- - [ Additional s2s Activity Header] ( #px_additional_s2s_activity_header_enabled )
76
- - [ Send Raw Username On Additional s2s Activity] ( #px_send_raw_username_on_additional_s2s_activity )
77
- - [ Compromised Credentials Header Name] ( #px_compromised_credentials_header_name )
78
- - [ Login Successful Reporting Method] ( #px_login_successful_reporting_method )
79
- - [ Login Successful Header Name] ( #px_login_successful_header_name )
80
- - [ Login Successful Header Value] ( #px_login_successful_header_value )
81
- - [ Login Successful Status] ( #px_login_successful_status )
82
- - [ Login Successful Custom Function] ( #custom_login_successful )
72
+ - [ Enable Login Credentials Extraction] ( #px_enable_login_creds_extraction )
73
+ - [ Credentials JSON file] ( #px_login_creds_settings_filename )
74
+ - [ Credentials Intelligence Version] ( #px_credentials_intelligence_version )
75
+ - [ Additional s2s Activity Header] ( #px_additional_s2s_activity_header_enabled )
76
+ - [ Send Raw Username On Additional s2s Activity] ( #px_send_raw_username_on_additional_s2s_activity )
77
+ - [ Compromised Credentials Header Name] ( #px_compromised_credentials_header_name )
78
+ - [ Login Successful Reporting Method] ( #px_login_successful_reporting_method )
79
+ - [ Login Successful Header Name] ( #px_login_successful_header_name )
80
+ - [ Login Successful Header Value] ( #px_login_successful_header_value )
81
+ - [ Login Successful Status] ( #px_login_successful_status )
82
+ - [ Login Successful Custom Function] ( #custom_login_successful )
83
83
84
84
## [ HypeSale] ( #hypesale )
85
85
86
- - [ HypeSale host] ( #hypesale_host )
86
+ - [ HypeSale host] ( #hypesale_host )
87
87
88
88
## [ Sensitive GraphQL Operations] ( #graphql )
89
89
90
- - [ Sensitive GraphQL Operation Types] ( #px_sensitive_graphql_operation_types )
91
- - [ Sensitive GraphQL Operation Names] ( #px_sensitive_graphql_operation_names )
92
- - [ Sensitive GraphQL routes] ( #px_sensitive_graphql_routes )
93
-
90
+ - [ Sensitive GraphQL Operation Types] ( #px_sensitive_graphql_operation_types )
91
+ - [ Sensitive GraphQL Operation Names] ( #px_sensitive_graphql_operation_names )
92
+ - [ Sensitive GraphQL routes] ( #px_sensitive_graphql_routes )
94
93
95
94
## [ Appendix] ( #appendix )
96
95
97
- - [ HTTP v2 Support] ( #http2 )
98
- - [ NGINX Plus] ( #nginxplus )
99
- - [ NGINX Dynamic Modules] ( #dynamicmodules )
100
- - [ Multiple App Support] ( #multipleapps )
101
- - [ Setting Up A First Party Prefix] ( #setting_up_first_party_prefix )
102
- - [ URI Delimiters] ( #uri_delimiters )
96
+ - [ HTTP v2 Support] ( #http2 )
97
+ - [ NGINX Plus] ( #nginxplus )
98
+ - [ NGINX Dynamic Modules] ( #dynamicmodules )
99
+ - [ Multiple App Support] ( #multipleapps )
100
+ - [ Setting Up A First Party Prefix] ( #setting_up_first_party_prefix )
101
+ - [ URI Delimiters] ( #uri_delimiters )
103
102
104
103
## [ Test Environment] ( #test_environment )
105
104
@@ -158,7 +157,7 @@ To upgrade to the latest Enforcer version, [re-install](#installation) the Enfor
158
157
- [ CentOS 7] ( #centos7 )
159
158
- Amazon Linux (AMI)
160
159
161
- #### <a name =" supported_versions " ></a >Supported NGINX Versions:
160
+ #### <a name =" supported_versions " ></a >Supported NGINX Versions
162
161
163
162
Recommended that you use the newest version of NGINX from the [ Official NGINX] ( http://nginx.org/en/linux_packages.html ) repo.
164
163
@@ -191,7 +190,7 @@ If an `add-apt-repository: command not found` error is returned, run:
191
190
192
191
` sudo apt-get -y install software-properties-common `
193
192
194
- ###### 3. Install the dependencies for Ubuntu 14.04:
193
+ ###### 3. Install the dependencies for Ubuntu 14.04
195
194
196
195
``` sh
197
196
sudo apt-get -y install build-essential
@@ -401,7 +400,7 @@ luarocks install lua-cjson
401
400
luarocks install perimeterx-nginx-plugin
402
401
```
403
402
404
- ###### 10. Optionally, if you are testing in a new environment you may need to configure the following:
403
+ ###### 10. Optionally, if you are testing in a new environment you may need to configure the following
405
404
406
405
- Add the user "nginx"
407
406
@@ -437,6 +436,7 @@ luarocks install perimeterx-nginx-plugin
437
436
```
438
437
439
438
- Enable and Start the NGINX Service
439
+
440
440
``` sh
441
441
sudo systemctl is-enabled nginx.service
442
442
sudo systemctl start nginx.service
@@ -564,7 +564,7 @@ The following NGINX Configurations are required to support the PerimeterX NGINX
564
564
565
565
### <a name =" configuration " ></a >PerimeterX Plugin Configuration
566
566
567
- #### <a name =" perimterx_required_parameters " ></a >Required Configuration:
567
+ #### <a name =" perimterx_required_parameters " ></a >Required Configuration
568
568
569
569
The following configurations are set in:
570
570
@@ -694,7 +694,8 @@ Several filters can be configured:
694
694
_M .whitelist_uri_pattern = {},
695
695
_M .whitelist_ip_addresses = {},
696
696
_M .whitelist_ua_full = {},
697
- _M .whitelist_ua_sub = {}
697
+ _M .whitelist_ua_sub = {},
698
+ _M .whitelist_hosts = {}
698
699
```
699
700
700
701
| Filter Name | Value | Filters Request To |
@@ -706,6 +707,7 @@ Several filters can be configured:
706
707
| ** whitelist_ip_addresses** | ` {'192.168.99.1'} ` | Filters requests coming from any of the listed IPs. |
707
708
| ** whitelist_ua_full** | ` {'Mozilla/5.0 (compatible; pingbot/2.0; http://www.pingdom.com/)'} ` | Filters all requests matching this exact UA. |
708
709
| ** whitelist_ua_sub** | ` {'GoogleCloudMonitoring'} ` | Filters requests containing the provided string in their UA. |
710
+ | ** whitelist_hosts** | ` {'www.example.com'} ` | Filters requests coming from the listed hosts. |
709
711
710
712
### <a name =" sensitive-headers " ></a > Filter Sensitive Headers
711
713
@@ -754,8 +756,8 @@ _M.custom_enabled_routes = function(uri)
754
756
end
755
757
756
758
```
757
- See [ examples/custom_enabled_routes.lua] ( /examples/custom_enabled_routes.lua ) for a complete example of using ` custom_enabled_routes ` .
758
759
760
+ See [ examples/custom_enabled_routes.lua] ( /examples/custom_enabled_routes.lua ) for a complete example of using ` custom_enabled_routes ` .
759
761
760
762
### <a name =" monitored-routes " ></a > Monitored Routes
761
763
@@ -783,6 +785,7 @@ _M.sensitive_routes_suffix = {'/download'}
783
785
```
784
786
785
787
### <a name =" sensitive-routes-regex " ></a > Sensitive Routes Regex List
788
+
786
789
A list of route regular expressions (regex). When PerimeterX module matches the request URI with a regex from the list, the module creates a server-to-server call, even when the cookie is valid and the risk score is low.
787
790
788
791
** Default:** Empty list
@@ -794,6 +797,7 @@ _M.sensitive_routes = {'^/login/[0-9]*user$'}
794
797
```
795
798
796
799
### <a name =" custom-sensitive-routes " ></a > Custom Sensitive Routes
800
+
797
801
Allows you to define a function, which takes ` uri ` as an argument and returns ` true ` or ` false ` .
798
802
Returning ` true ` means that PerimeterX module creates a server-to-server call, even when the cookie is valid and the risk score is low.
799
803
@@ -815,8 +819,8 @@ _M.custom_sensitive_routes = function(uri)
815
819
end
816
820
817
821
```
818
- See [ examples/custom_enabled_routes.lua] ( /examples/custom_enabled_routes.lua ) for a complete example of using ` custom_enabled_routes ` (which is similar to ` custom_sensitive_routes ` ).
819
822
823
+ See [ examples/custom_enabled_routes.lua] ( /examples/custom_enabled_routes.lua ) for a complete example of using ` custom_enabled_routes ` (which is similar to ` custom_sensitive_routes ` ).
820
824
821
825
### <a name =" api-timeout " ></a >API Timeout Milliseconds
822
826
@@ -857,7 +861,7 @@ Example:
857
861
_M .custom_block_url = ' /block.html'
858
862
```
859
863
860
- > Note: This URI is whitelisted automatically under ` _M.Whitelist['uri_full'] ` to avoid infinite redirects.
864
+ > Note: This URI is whitelisted automatically under ` _M.Whitelist['uri_full'] ` to avoid infinite redirects.
861
865
862
866
### <a name =" redirect_on_custom_url " ></a > Redirect on Custom URL
863
867
@@ -1147,10 +1151,10 @@ For details on how to create a custom Captcha page, refer to the [documentation]
1147
1151
1148
1152
This feature extracts credentials (hashed username and password) from requests and sends them to PerimeterX as additional info in risk / activity api calls. The feature can be toggled on and off. The settings are adjusted by modifying a Credentials JSON file.
1149
1153
1150
-
1151
1154
### <a name =" loginCredentialsExtractionConfiguration " ></a > Login Credentials Extraction Configuration
1152
1155
1153
1156
### <a name =" px_enable_login_creds_extraction " ></a > Enable Login Credentials Extraction
1157
+
1154
1158
Enables Login Credentials Extraction
1155
1159
1156
1160
** Default:** false (disabled)
@@ -1160,6 +1164,7 @@ _M.px_enable_login_creds_extraction = true
1160
1164
```
1161
1165
1162
1166
### <a name =" px_login_creds_settings_filename " ></a > Credentials JSON file
1167
+
1163
1168
Sets a full path to credentials JSON file
1164
1169
1165
1170
** Default:** nil (none)
@@ -1182,6 +1187,7 @@ Example available in `examples/creds.json` file. It includes an array of JSON ob
1182
1187
```
1183
1188
1184
1189
### <a name =" px_credentials_intelligence_version " ></a > Credentials Intelligence Version
1190
+
1185
1191
Sets Credentials Intelligence protocol version
1186
1192
1187
1193
** Default:** 'v1'
@@ -1191,6 +1197,7 @@ _M.px_credentials_intelligence_version = 'v1'
1191
1197
```
1192
1198
1193
1199
### <a name =" px_additional_s2s_activity_header_enabled " ></a > Additional s2s Activity Header
1200
+
1194
1201
Enables attaching additional s2s activity header ('px-additional-activity'), instead of sending Additional s2s activity to PX Collector.
1195
1202
1196
1203
** Default:** false
@@ -1200,6 +1207,7 @@ _M.px_additional_s2s_activity_header_enabled = false
1200
1207
```
1201
1208
1202
1209
### <a name =" px_send_raw_username_on_additional_s2s_activity " ></a > Send Raw Username On Additional s2s Activity
1210
+
1203
1211
Enables sending a raw username on additional s2s activity (only when activities are sent to PX Collector)
1204
1212
1205
1213
** Default:** false
@@ -1209,6 +1217,7 @@ _M.px_send_raw_username_on_additional_s2s_activity = false
1209
1217
```
1210
1218
1211
1219
### <a name =" px_compromised_credentials_header_name " ></a > Compromised Credentials Header Name
1220
+
1212
1221
Compromised credentials header name
1213
1222
1214
1223
** Default:** 'x-px-compromised-credentials'
@@ -1218,6 +1227,7 @@ _M.px_compromised_credentials_header_name = 'x-px-compromised-credentials'
1218
1227
```
1219
1228
1220
1229
### <a name =" px_login_successful_reporting_method " ></a > Login Successful Reporting Method
1230
+
1221
1231
Sets login successful reporting method, could be one of the following values: 'none', 'header', 'status', 'custom'
1222
1232
1223
1233
** Default:** 'none'
@@ -1227,6 +1237,7 @@ Sets login successful reporting method, could be one of the following values: 'n
1227
1237
```
1228
1238
1229
1239
### <a name =" px_login_successful_header_name " ></a > Login Successful Header Name
1240
+
1230
1241
Sets login successful header name
1231
1242
1232
1243
** Default:** 'x-px-login-successful'
@@ -1236,6 +1247,7 @@ _M.px_login_successful_header_name = "x-px-login-successful"
1236
1247
```
1237
1248
1238
1249
### <a name =" px_login_successful_header_value " ></a > Login Successful Header Value
1250
+
1239
1251
Sets login successful header value
1240
1252
1241
1253
** Default:** '1'
@@ -1245,6 +1257,7 @@ _M.px_login_successful_header_value = "1"
1245
1257
```
1246
1258
1247
1259
### <a name =" px_login_successful_status " ></a > Login Successful Status
1260
+
1248
1261
Sets login successful status(-es)
1249
1262
1250
1263
** Default:** { 200 }
@@ -1254,6 +1267,7 @@ _M.px_login_successful_status = { 200 }
1254
1267
```
1255
1268
1256
1269
### <a name =" custom_login_successful " ></a > Login Successful Custom Function
1270
+
1257
1271
Sets an user defined function which should return ` true ` if login was successful.
1258
1272
1259
1273
** Default:** nil
@@ -1272,26 +1286,28 @@ _M.custom_login_successful = function()
1272
1286
end
1273
1287
```
1274
1288
1275
-
1276
1289
## <a name =" hypesale " ></a > HypeSale
1290
+
1277
1291
To enforcer will server the hypesale page in cases where the custom_param[ "is_hype_sale"] set to true.
1278
1292
If the request contains a cookie ` _px3 ` with the ` cpa ` value so the hypesale will not be served but the enforcer will do risk_api to verify the request.
1279
1293
1280
1294
### <a name =" hypesale_host " ></a > HypeSale host
1295
+
1281
1296
Sets HypeSale host
1282
1297
1283
- ** Default:** 'https://captcha.px-cdn.net '
1298
+ ** Default:** '< https://captcha.px-cdn.net > '
1284
1299
1285
1300
```
1286
1301
_M.hypesale_host = 'https://captcha.px-cdn.net'
1287
1302
```
1288
1303
1289
-
1290
1304
## <a name =" graphql " ></a > Sensitive GraphQL Operations
1305
+
1291
1306
For those using GraphQL endpoints, it is possible to trigger server-to-server risk calls on particular operation types or names. Like the sensitive routes feature, a request that contains an operation of the configured type or name will trigger a server call to PerimeterX servers every time that operation is performed.
1292
1307
Note: This feature only applies to requests that contain the string ` graphql ` somewhere in the path name.
1293
1308
1294
1309
### <a name =" px_sensitive_graphql_operation_types " ></a > Sensitive GraphQL Operation Types
1310
+
1295
1311
Sets an operation type (e.g., query, mutation)
1296
1312
1297
1313
** Default:** nil (none)
@@ -1301,6 +1317,7 @@ _M.px_sensitive_graphql_operation_types = {}
1301
1317
```
1302
1318
1303
1319
### <a name =" px_sensitive_graphql_operation_names " ></a > Sensitive GraphQL Operation Names
1320
+
1304
1321
Sets an operation name
1305
1322
1306
1323
** Default:** nil (none)
@@ -1321,7 +1338,6 @@ Note: the list contains Lua Patterns, more here: [Understanding Lua Patterns](ht
1321
1338
_M .px_graphql_routes = {" ^/graphql/?$" , " ^/graphql/csrf$" }
1322
1339
```
1323
1340
1324
-
1325
1341
## <a name =" appendix " ></a > Appendix
1326
1342
1327
1343
### <a name =" http2 " ></a > HTTP v2 Support
@@ -1413,9 +1429,10 @@ PerimeterX processes URI paths with general- and sub-delimiters according to RFC
1413
1429
1414
1430
PerimeterX Nginx Lua Enforcer repository contains Dockerfile used to create a test docker image.
1415
1431
In order to build an image, the following files must be present in the project's "example" directory:
1416
- * examples/pxconfig.lua - Enforcer configuration (` px_appId ` , ` cookie_secret ` and ` auth_token ` parameters are required and must be set).
1417
- * examples/nginx.conf - Nginx configuration
1418
- * examples/creds.json - Credential Intelligence configuration (optional)
1432
+
1433
+ - examples/pxconfig.lua - Enforcer configuration (` px_appId ` , ` cookie_secret ` and ` auth_token ` parameters are required and must be set).
1434
+ - examples/nginx.conf - Nginx configuration
1435
+ - examples/creds.json - Credential Intelligence configuration (optional)
1419
1436
1420
1437
When these files are present and adjusted, the following command could be executed from the project's root directory to run a test docker container: ` ./examples/run_docker.sh `
1421
1438
Docker container will run and Nginx will listen on 8080 port.
@@ -1443,4 +1460,5 @@ The following steps are welcome when contributing to our project.
1443
1460
2 . Run the tests using the following command: make docker-test.
1444
1461
1445
1462
- ### Pull Request
1463
+
1446
1464
Once you have completed the process, create a pull request. Provide a complete and thorough description explaining the changes. Remember, the code has to be read by our maintainers, so keep it simple, smart and accurate.
0 commit comments