|
4 | 4 |
|
5 | 5 | # [PerimeterX](http://www.perimeterx.com) NGINX Lua Plugin |
6 | 6 |
|
7 | | -> Latest stable version: [v5.1.0](https://luarocks.org/modules/bendpx/perimeterx-nginx-plugin/5.1-0) |
| 7 | +> Latest stable version: [v5.2.0](https://luarocks.org/modules/bendpx/perimeterx-nginx-plugin/5.2-0) |
8 | 8 |
|
9 | 9 |
|
10 | 10 | ## [Introduction](#introduction) |
|
16 | 16 | * [Supported Operating Systems](#supported_os) |
17 | 17 | * [Supported NGINX Versions](#supported_versions) |
18 | 18 | * [Installing with Ubuntu](#ubuntu) |
19 | | -* [Installing with CentOS7](centos7) |
20 | | -* [Installing the PerimeterX NGINX Plugin for NGINX+](#nstallation_nginxplus_px) |
| 19 | +* [Installing with CentOS7](#centos7) |
| 20 | +* [Installing the PerimeterX NGINX Plugin for NGINX+](#installation_nginxplus_px) |
21 | 21 | * [Required NGINX Configuration](#nginx_configuration) |
22 | 22 | * [Resolver](#nginx_resolver) |
23 | 23 | * [Lua Package Path](#nginx_lua_package_path) |
|
34 | 34 | * [Optional Configuration](#advanced_configuration) |
35 | 35 | * [Monitor / Block Mode](#monitoring_mode) |
36 | 36 | * [Debug Mode](#debug-mode) |
37 | | - * [Extracting Real IP Address](#real-ip) |
38 | 37 | * [Whitelisting](#whitelisting) |
39 | 38 | * [Filter Sensitive Headers](#sensitive-headers) |
40 | 39 | * [Remote Configurations](#remote-configurations) |
|
45 | 44 | * [Redirect to a Custom Block Page URL](#redirect_to_custom_blockpage) |
46 | 45 | * [Redirect on Custom URL](#redirect_on_custom_url) |
47 | 46 | * [Additional Activity Handler](#add-activity-handler) |
| 47 | + * [Enrich Custom Parameters](#custom-parameters) |
48 | 48 | * [Blocking Score](#blocking-score) |
49 | 49 |
|
50 | 50 | ## [Enrichment](#enrichment) |
@@ -339,65 +339,11 @@ sudo luarocks install perimeterx-nginx-plugin |
339 | 339 | ``` |
340 | 340 |
|
341 | 341 | ### <a name="installation_nginxplus_px"></a>Installing the PerimeterX NGINX Plugin for NGINX+ |
342 | | -If you are already using NGINX+ the following steps cover how to install the NGINX+ Lua Module & the PermimeterX NGINX Plugin. |
343 | 342 |
|
344 | | -###### 1. Install the <a href="https://docs.nginx.com/nginx/admin-guide/dynamic-modules/lua/" onclick="window.open(this.href); return false;">Lua modules provided by NGINX</a> |
| 343 | +If you are already using NGINX+, the following steps cover installing the NGINX+ Lua Module and the PermimeterX NGINX Plugin. |
345 | 344 |
|
346 | | -* For Amazon Linux, CentOS, and RHEL: |
347 | | - ```sh |
348 | | - yum install nginx-plus-module-lua |
349 | | - ``` |
350 | | - |
351 | | -* For Ubuntu: |
352 | | - ```sh |
353 | | - apt-get install nginx-plus-module-lua |
354 | | - ``` |
355 | | - |
356 | | -###### 2. Remove Pre-installed Nettle |
357 | | - ```sh |
358 | | - sudo yum -y remove nettle |
359 | | - ``` |
360 | | - |
361 | | -###### 3. Install Nettle from Source |
362 | | -Download and compile nettle using the version appropriate for your environment: |
363 | | - |
364 | | -For Amazon Linux, CentOS, and RHEL: |
365 | | - ```sh |
366 | | - yum -y install m4 # prerequisite for nettle |
367 | | - cd /tmp/ |
368 | | - wget https://ftp.gnu.org/gnu/nettle/nettle-3.3.tar.gz |
369 | | - tar -xzf nettle-3.3.tar.gz |
370 | | - cd nettle-3.3 |
371 | | - ./configure |
372 | | - make clean && make install |
373 | | - cd /usr/lib64 && ln -s /usr/local/lib64/libnettle.so. |
374 | | - ``` |
375 | | - |
376 | | -###### 4. Install Luarocks and Dependencies |
377 | | - ```sh |
378 | | - sudo yum install luarocks |
379 | | - sudo luarocks install lua-cjson |
380 | | - sudo luarocks install lustache |
381 | | - sudo luarocks install lua-resty-nettle |
382 | | - sudo luarocks install luasocket |
383 | | - sudo luarocks install lua-resty-http |
384 | | - |
385 | | - sudo ln -s /usr/lib64/lua /usr/lib/lua |
386 | | - ``` |
387 | | - |
388 | | -###### 5. Install PerimeterX NGINX Plugin |
389 | | - ```sh |
390 | | - sudo luarocks install perimeterx-nginx-plugin |
391 | | - ``` |
392 | | - |
393 | | -###### 6. Modify Selinux (Consult with your internal System Administrator) |
394 | | -On CentOS 7 and other Linux operating systems you may need to modify or disable Selinux. If you get the following error: |
395 | | - |
396 | | -`nginx: lua atpanic: Lua VM crashed, reason: runtime code generation failed, restricted kernel?` |
397 | | - |
398 | | -You will need to make one of the following changes: |
399 | | -* To disable SELinux: `RUN setenforcer 0` |
400 | | -* To enable execmem for httpd_t: `RUN setsebool httpd_execmem 1 -P` |
| 345 | +* [RHEL 7.4 and higher](NGINXPLUS_RHEL7.4.md) |
| 346 | +* [Amazon Linux, CentOS and RHEL 7.3 and lower](NGINXPLUS.md) |
401 | 347 |
|
402 | 348 | ## <a name="configuration"></a>Configuration |
403 | 349 |
|
@@ -784,6 +730,20 @@ Controls the timeouts for PerimeterX requests. The API is called when a Risk Coo |
784 | 730 | end |
785 | 731 | ``` |
786 | 732 |
|
| 733 | +### <a name="custom-parameters"> Enrich Custom Parameters |
| 734 | +With the `enrich_custom_params` function you can add up to 10 custom parameters to be sent back to PerimeterX servers. When set, the function is called before seting the payload on every request to PerimetrX servers. The parameters should be passed according to the correct order (1-10). |
| 735 | +You must return the `px_cusom_params` object at the end of the function. |
| 736 | + |
| 737 | + **Default:** nil |
| 738 | + |
| 739 | +Example: |
| 740 | +```lua |
| 741 | +_M.enrich_custom_parameters = function(px_custom_params) |
| 742 | + px_custom_params["custom_param1"] = "user_id" |
| 743 | + return px_custom_params |
| 744 | +end |
| 745 | +``` |
| 746 | + |
787 | 747 | ### <a name="blocking-score"></a> Changing the Minimum Score for Blocking |
788 | 748 |
|
789 | 749 | This value should not be changed from the default of 100 unless advised by PerimeterX. |
|
0 commit comments