3. Configuration
Configuration is set from a JSON file.
pyrasp
first loads default values and overwrite data from configuration.
If configuration is loaded from a remote server, the response body to the request should be a JSON containing a valid pyrasp configuration file as described below.
Example File
Parameters
Generic Parameters Table
HOSTS
list of strings
any
[]
List of valid 'Host' headers checked for spoofing detection
APP_NAME
string
any
["Web Server"]
Identification of the web application in the logs
GTFO_MSG
string
any
["Blocked"]
Message displayed when request is blocked. HTML page code is authorized
DENY_STATUS_CODE
integer
any
403
HTTP status code sent in response to blocked requests
VERBOSE
integer
any
0
DECODE_B64
boolean
true, false
true
Decode Base64-encoded payloads
SECURITY_CHECKS
integer
0, 1, 2, 3
WHITELIST
list of strings
any
[]
Whitelisted source IP addresses
IGNORE_PATHS
list of regexp
any
Paths to which requests will entirely bypass security checks including blacklist
BRUTE_AND_FLOOD_PATH
list of regexp
any
["^/"]
Paths for which flood and brute force threshold will be enabled
FLOOD_DELAY
integer
any
60
Sliding time window (in second) against which request threshold is calculated
FLOOD_RATIO
integer
any
50
Requests threshold
ERROR_FLOOD_DELAY
integer
any
10
Sliding time window (in second) against which error threshold is calculated
ERROR_FLOOD_RATIO
integer
any
100
Errors threshold
BLACKLIST_DELAY
integer
any
3600
Duration (in seconds) of source IP blacklisting
BLACKLIST_OVERRIDE
boolean
true, false
false
Ignore source IP blacklisting (usually for testing)
DECOY_ROUTES
list of list
any
EXCEPTIONS
list of list
any
[]
XSS_PROBA
float
0 to 1
0.6
Machine Learning prediction minimum probability for XSS (should be left to 0.8)
SQLI_PROBA
float
0 to 1
0.6
Machine Learning prediction minimum probability for SQL injections (should be left to 0.725)
DLP_PHONE_NUMBERS
boolean
true, false
false
Check phone number leak
DLP_CC_NUMBERS
boolean
true, false
false
Check credit card number leak
DLP_PRIVATE_KEYS
boolean
true, false
false
Check private key leak
DLP_HASHES
boolean
true, false
false
Check hash leak
DLP_WINDOWS_CREDS
boolean
true, false
false
Check Windows credentials leak
DLP_LINUX_CREDS
boolean
true, false
false
Check Linux credentials leak
DLP_LOG_LEAKED_DATA
boolean
true, false
false
Log leaked data
LOG_ENABLED
boolean
true, false
false
Enable event logging
LOG_FORMAT
string
syslog, json
"syslog"
LOG_SERVER
string
any
"127.0.0.1"
Log server IP address or FQDN
LOG_PORT
integer
1 - 36635
514
Log server port
LOG_PROTOCOL
string
tcp, udp, http, https
"udp"
Log server protocol (tcp or udp for syslog, http or https for json)
LOG_PATH
string
any
""
URL path to use for http(s) log webhook (ex: /logs)
RESOLVE_COUNTRY
boolean
true, false
true
Resolve country of attack source IP address
CHANGE_SERVER
boolean
true, false
true
Change response "Server" header
SERVER_HEADER
string
any
"Apache"
Message displayed when request is blocked. HTML page code is authorized
ZTAA_HEADER
string
any
"pcb-ztaa"
Name of header used for Zero-Trust Application Access
ZTAA_KEYS
list of strings
any
[]
List of Zero-Trust valid keys
ZTAA_BROWSER_VERSION
boolean
true, false
false
Enable browser version check
Specific Parameters Values
Default ignore paths
SECURITY_CHECKS
SECURITY_CHECKS
0
Disabled
1
Enabled, no Blacklisting
2
Enabled, Blacklisting activated
3
Log Only
Default security checks values are provided in the table below.
flood
Flood
2
headers
Forbidden Headers
0
path
Requests Validation
1
spoofing
Spoofing
0
decoy
Decoy
2
sqli
SQL Injection
2
xss
XSS
2
command
Command Injection
2
hpp
HTTP Parameter Polution
2
dlp
Data Leak Prevention
0
brute
Brute Force
2
ztaa
Zero-Trust Application Access
0
Note:
spoofing
module refers to "Host" header validation
VERBOSE
VERBOSE
0
Start, Stop, Configuration load status
10+
Configuration loading details, XSS and SQLi model load status, Logging process status, Attacks detection
100+
Configuration details, attack details
Decoy routes
Decoy routes are defined as a list of list of 2 elements: a pattern and a match operation.
The list of valid patch operations is provided in the related section
Default DECOY_ROUTES
variable is provided below.
Exceptions
Exceptions are defined as a list of list of 2 elements: a pattern and a match operation.
The list of valid match operations is provided in the related section
Match operations
starts
string
Tested text starts with pattern
ends
string
Tested text ends with pattern
contains
string
Tested text contains pattern
match
string
Tested text matches pattern
regexp
regular expression
Tested text matches pattern
Last updated