Sample Lua Scripts

Validator includes sample Lua scripts to help users get started writing a Lua script to fit their needs. These scripts are not meant to be used out of the box and do not work for every configuration.

Example Path Script Usage
basic.lua /opt/aspera/aspera-validator/examples/basic.lua This example script checks if file names include the string "failme".
check_ssn.lua /opt/aspera/aspera-validator/examples/check_ssn.lua This example script checks if the file contents includes a social security number.
env_log.lua /opt/aspera/aspera-validator/examples/env_log.lua This example script displays all available environment variables.
mount_mapping.lua /opt/aspera/aspera-validator/examples/mount_mapping.lua By default, Validator expects files to have the same path on the Validator server as on the HSTS node. This example script configures Validator to expect files in a different location.
clamav.lua /opt/aspera/aspera-validator/examples/clamav/clamav.lua

This example script interfaces with ClamAV to scan transferred files.

The script calls clamdscan with the recommended --fdpass option. If clamdscan fails, then it falls back to using clamscan.
icap.lua /opt/aspera/aspera-validator/examples/icap/icap.lua

This example script interfaces with a configured ICAP server to scan transferred files.

The example also includes decryption of files protected by Aspera encryption-at-rest.

Note: Customers must set up their own ICAP servers according to their third-party software.

Chaining Lua scripts

This feature is only available for Validator 1.0.7 and later. Chaining multiple Lua scripts for validation allows you to configure a sequence of scripts to be executed in order.

Configuration
Important: You can continue to use the validator.yaml file for validation if you want to process files using a single script.

To chain multiple Lua scripts, update the LuaFilePath parameter with a list of script file paths. The LuaFilePath can either be a list of files, or a single string. If using a list, each script runs sequentially in the order listed. If any script fails, the file validation process stops immediately.

Example LuaFilePath list:

##########################
# Lua settings
##########################

MaxRoutines: 10

LuaFilePath:
  - /path/to/clamav.lua
  - /path/to/basic.lua
  - /path/to/check_ssn.lua