You're here: Reference > Handlers > Script Handler

previous topic  next topic

Script Handler

Caution:  In detection mode, only those functions work that are accessible during requests (see Accessible Python Modules and Functions). If you use functions that are only available during responses, this may hang your system when in detection mode!

Purpose

The Script Handler allows you to execute a Python script. This enables you to expand the scope of predefined handlers to your specific requirements.

Severity

Events triggered by this handler are given the severity: medium.
(For details on severity levels, see Severity of Events Triggered by Handlers).

Expand /Collapse All Subsections

Recommendations for use

Use the Script Handler if you want to add individual functions to Stingray Application Firewall that aren’t covered by the built-in handlers. This can be a very powerful tool for experienced administrators with appropriate Python scripting knowledge.

Attributes

Attribute

Meaning

scriptcode

Here you can enter or paste your Python script. For details on the accessible commands, please refer to Accessible Python Modules and Functions.

When you’ve entered your script, click the Save button.

Stingray Application Firewall automatically checks the syntax of the script. Should there be any syntax errors, the input field turns red and Stingray Application Firewall tells you which line the error is in.

Tip:  For debugging purposes, you can use the function log of the module http to write information to the Stingray Application Firewall log files.

Caution:  Should you by mistake create an infinite loop, none of your web applications are accessible at all. This even applies if the Script Handler is only used with in a ruleset in detection mode.

usertext

Optional:
Here you can specify some text that Stingray Application Firewall adds to the log file entries created by this handler. You can use this, for example, to document why you’ve added the handler to your configuration, and how the handler is intended to behave.

enable logging

Disable this option if you do not want Stingray Application Firewall to create a log file entry when the handler is executed. This can be useful to keep log files smaller in case the handler creates a large number of entries but you don’t need these entries.

Caution:  When in detection mode, disabling logging de facto makes the handler ineffective. Disabling logging also prevents the actions of the handler from being taken into account for the Top-10 lists in Attack Analysis, and from being listed in Reports.
To decrease the size of the log files, also consider to enable reduced logging, which excludes all non-handler-related information from the log files (see Editing Applications).

Log file entries written by this handler

Handlers

Editing Handlers

Accessible Python Modules and Functions

©  Riverbed Technology, all rights reserved   previous topic  next topic