The local configuration schema explained below is based on the schema version v1beta1. The latest available, significantly enhanced local configuration schema version is v1beta2,
documentation for v1beta2 is available here: Local Policy File v1beta2 (beta)
Here you find the full specification for the different configuration sections and elements that can be part of the declarative configuration file including an example for each:
Policies
The policies section defines the default behaviors that will apply to all web resources exposed by the NGINX server, Kong Gateway or APISIX Gateway as well as specific rules for overriding the default behaviour for specific hostname/path combinations.
modestring enum - security engines operation mode. Blocking will only happen in prevent-learn mode
prevent-learn / detect-learn / prevent / detect / inactive
(note that prevent and detect are just aliases for prevent-learn and detect-learn)
practicesarray of strings - defines which security engines to activate and their specific settings (Although this is an array already there cannot be multiple practices of the same kind specified here for now!)
reference to Practice resource(s)
triggersarray of strings - defines logging verbosity and destination (stdout, syslog, cloud, etc) (Although this is an array for now only a single trigger is supported!)
reference to LogTrigger resource(s)
custom-responsestring - defines prevent mode behaviors upon decision to block: HTTP response code, block page, http redirect
reference to CustomResponse resource
source-identifiersstring - defines how ML engine will distinguish between sources based on IP address, X-Foward-For, Key in Header/Cookie/JWT
reference to SourcesIdentifier resource
trusted-sourcesstring - defines which traffic sources are very unlikely to be malicious. Used for Machine Learning engine.
exceptionsarrays of strings - defines exceptions to be applied based on e.g. countryCode, countryName, sourceIP, URL, hostName, sourceIdentifier
reference to Exception resource(s)
specific-rules list
list of one or more per-host (ingress rule) policies that will override the defaults above
hoststring - policy will apply to this host
network path (exactly as appear in ingress rules)
All other keys can be used same as decribed above for default.
Practices
Practice resources define which security engines will be active and what their settings are.
override-modestring enum - allows overriding the mode defined at the Policy level for this specific engine (when set to as-top-level the value will be inherited from mode setting in the policy)
non-valid-http-methodsboolean, default: false - Prevent attacker from sending requests with unsafe HTTP methods
true / false
open-api-schema-validation (currently not supported yet, will be added soon)
configmap array of strings - specify configmap(s) containing the OpenAPI schema definitions
override-modeenum - allows overriding the mode defined at the Policy level for this specific engine (when set to as-top-level the value will be inherited from mode setting in the policy)
anti-bot (currently not supported yet, will be added soon)
override-modeenum - allows overriding the mode defined at the Policy level for this specific engine (when set to as-top-level the value will be inherited from mode setting in the policy)
injected-URIs array of strings - Provide URL(s) where Anti-Bot check is injected with GET request
validated-URIs array of strings - Provide URL(s) where result of Anti-Bot check is received from with POST request
snort-signatures (currently not supported yet, will be added soon)
override-modeenum - allows overriding the mode defined at the Policy level for this specific engine (when set to as-top-level the value will be inherited from mode setting in the policy)
configmaparray of strings - specify configmap(s) containing snort signatures
Custom Response
Optional custom responses can be configured to return in prevent mode either a customizable block page or the desired response code only. The custom responses than can be referenced within one or more policy elements.
Examples Specification
mode enum - engine will take one of these actions upon decision to block request
block-page - send HTML with text to client + HTTP response code
response-code-only - send only response code
message-title string - title of block page that will be displayed only in case mode is block page and engine decided to block
message-body string - content of block page that will be displayed only in case mode is block page and engine decided to block
http-response-code integer between 100-599 - http code that will be returned to client upon engine decision to block; default is 403 - HTTP Forbidden
Log Trigger
Optional log trigger elements can be used to configure custom logging requirements. They can then be referenced within one or more policy elements.
Example Specification
access-control-logging - configure logging for Access Control events
allow-events boolean, default: false - log access control allow events
true / false
drop-events boolean, default: true - log access control drop events
true / false
additional-suspicious-events-logging configure additional logging for suspicious events based on a selectable minimum severity-level
request-body boolean, default: false - log the request body (has performance impact)
true / false
log-destination
cloud boolean, default: false - enable or disable logging to the appsec-open Cloud Service (relevant when being connected to SaaS Mgmt WebUI)
true / false
file string - define file path to save logs to (local path from root directory of the open-appsec container, could also refer to a mountPath for a mounted Persistent Volume in the container)
stdout - configure logging to standard-out
format string enum - define the desired log format
json / json-formatted - select between formatted or standard json
syslog-service objects array - define one or more syslog servers and corresponding ports to send logs to
address string - Syslog server IP address
port integer - Syslog server port
cef-service - allows sending files to a log destination in CEF format
address string - CEF server IP address
port integer - CEFserver port
proto string enum Select the correct protocol
tcp / udp - Chose TCP or UDP protocol
Exceptions
Optional exception elements can be used to configure custom exceptions. They can then be referenced within one or more policy elements.
Example Specification
Define a list of actions-objects with the corresponding parameters to match to configure flexible custom exceptions/rules, each having the following configurable keys:
action string enum - Action to be performed when exception matches
Optional trusted sources can be defined, for which the machine learning engine will assume, that the traffic originating from them is benign and learn accordingly.
Trusted sources elements can then be referenced within the policies section.
Example Specification
Define trusted sources by referencing the source identifiers custom resources as well as setting the minimum amount of sources that need to be observed by the behavioural ML engine sending certain identical traffic patterns in order to learn this behaviour as being benign.
minNumOfSources integer - Minimum amount of sources having to be observed sending same traffic patterns to learn behaviour as benign.
sourcesIdentifiers string array - Specify one or more source identifiers
Source Identifiers
Source Identifiers can be used to define how open-appsec distinguishes between different sources, e.g. based on source IP addresses, x-forwarded-for header content, etc.
Examples Specification
Define list of one or more specific source identifiers that can be used in trusted sources custom resources.
identifiers objects array - provide single source identifier
Note: Although this is an array currently only adding single source identifier here is supported.
(Later an option is planned to be added to provide multiple source-identifiers here, so that if the first one is not found in an http request then the next one would be checked.)
source-identifier string enum - Specify the source identifier type of which the content shall be matched
value string array - Content to match the specified sourceIdentifier type
For types headerkey, cookie and JWTKey provide the fieldname that designates user
For type Source IP no value is required
For type x-forwarded-for provide previous proxy hops if there are any
Schema file
Here you find the full schema file for the local declarative configuration yaml file.
This also shows you which fields are required and which are optional