Predefined scripts
Predefined scripts provides the syntax, usage, and examples of the predefined commands that are useful for writing scripts.
| Predefined script | Usage |
|---|---|
| COMPARE_IP_ADDR_2_ADDR_GROUP_DEMO |
Compares an IP address to an address group to determine if the IP address is included in the specified IP group. For example ,192.168.1.2 is included in 192.168.1.0/24. Note: Do NOT use this script "as is". Instead, copy it and customize the IP address and the IP address group. |
| CONTENT_ROUTING_by_URI | Routes to a pool member based on URI string matches. You should not use this script as is. Instead, copy it and customize the URI string matches and pool member names. |
|
CUSTOMIZE_AUTH_KEY |
Demonstrate how to customize the crypto key for authentication cookie. |
| HTTP_DATA_FETCH_SET_DEMO |
Collects data in HTTP request body or HTTP response body. In Note: Do NOT use this script "as is". Instead, copy it and manipulate the collected data. |
| REDIRECTION_by_USER_AGENT | Redirects requests based on User Agent (for example, a redirect to the mobile version of a site). You should not use this script as is. Instead, copy it and customize the User Agent and URL values. |
|
TWO_STEP_VERIFICATION_2_SAME |
Demonstrate how to perform 2-Step Verification for the second authentication group using the same token group. |
| OPTIONAL_CLIENT_AUTHENTICATION |
Performs optional client authentication. Note: Before using this script, you must have the following four parameters configured in the client-ssl-profile:
|
|
PERSIST_COMMANDS |
Lists the persist event and commands |
|
TWO_STEP_VERIFICATION_2_NEW |
Demonstrate how to perform 2-Step Verification using FortiToken for the second authentication group. |
|
AUTH_COOKIE_BAKE |
Allows you to retrieve the baked cookie and edit the cookie content. |
| HTTP_2_HTTPS_REDIRECTION_FULL_URL |
Redirects requests to the specified HTTPS URL. Note: This script can be used directly, without making any change. |
| REDIRECTION_by_STATUS_CODE |
Redirects requests based on the status code of server HTTP response (for example, a redirect to the mobile version of a site). Do NOT use this script "as is". Instead, copy it and customize the condition in the server HTTP response status code and the URL values. |
|
TWO_STEP_VERIFICATION_2_NEW |
Demonstrate how to perform 2-Step Verification using FortiToken for the second authentication group. |
|
TWO_STEP_VERIFICATION_2_SAME |
Demonstrate how to perform 2-Step Verification for the second authentication group using the same token group. |
|
TWO_STEP_VERIFICATION_CHANGE_KEY |
Demonstrate how to change the AES key and its size for stored token group. |
|
URL_UTILITY_COMMANDS |
Demonstrate how to use those url tools to encode/decode/parser/compare. |
| USE_REQUEST_HEADERS_in_OTHER_EVENTS |
Stores a request header value in an event and uses it in other events. For example, you can store a URL in a request event, and use it in a response event. Note: Do NOT use this script "as is". Instead, copy it and customize the content you want to store, use |
| UTILITY_FUNCTIONS_DEMO |
Demonstrates how to use the basic string operations and random number/alphabet, time, MD5, SHA1, SHA2, BASE64, BASE32, table to string conversion, network to host conversion utility function |
| Commands | |
|
AUTH_EVENTS_n_COMMANDS |
Lists the auth event and commands |
| COOKIE_COMMANDS | Lists the two cookie commands and shows how to use them. |
| IP_COMMANDS | Lists the IP commands and shows how to use them. |
| MANAGEMENT_COMMANDS | Lists the management commands and shows how to use them. |
|
PERSIST_COMMANDS |
Lists the persist event and commands |
|
RAM_CACHING_COMMANDS |
Lists the RAM caching event and commands |
| SSL_EVENTS_n_COMMANDS | Lists the SSL events and commands. |
| TCP_EVENTS_n_COMMANDS | Lists the TCP events and commands. |
| Predefined script | Usage |
|
AES_DIGEST_SIGN_2F_COMMANDS |
Demonstrate how to use AES to encryption/decryption data and some tools to generate the digest. |
|
AUTH_COOKIE_BAKE |
Allows you to retrieve the baked cookie and edit the cookie content. |
|
AUTH_EVENTS_n_COMMANDS |
Used to get the information from authentication process. |
| CLASS_SEARCH_n_MATCH | Demonstrates how to use the class_match and class_search utility function. |
| COMPARE_IP_ADDR_2_ADDR_GROUP_DEMO |
Compares an IP address to an address group to determine if the IP address is included in the specified IP group. For example ,192.168.1.2 is included in 192.168.1.0/24. Note: Do NOT use this script "as is". Instead, copy it and customize the IP address and the IP address group. |
| CONTENT_ROUTING_by_URI | Routes to a pool member based on URI string matches. You should not use this script as is. Instead, copy it and customize the URI string matches and pool member names. |
| CONTENT_ROUTING_by_X_FORWARDED_FOR | Routes to a pool member based on IP address in the X-Forwarded-For header. You should not use this script as is. Instead, copy it and customize the X-Fowarded-For header values and pool member names. |
|
COOKIE_COMMANDS |
Demonstrate the cookie command to get the whole cookie in a table and how to remove/insert/set the cookie attribute. |
|
COOKIE_COMMANDS_USAGE |
Demonstrate the sub-function to handle the cookie attribute "SameSite" and others. |
|
COOKIE_CRYPTO_COMMANDS |
Used to perform cookie encryption/decryption on behalf of the real server. |
|
CUSTOMIZE_AUTH_KEY |
Demonstrate how to customize the crypto key for authentication cookie. |
| GENERAL_REDIRECT_DEMO |
Redirects requests to a URL with user-defined code and cookie. Note: Do NOT use this script "as is". Instead, copy and customize the code, URL, and cookie. |