Enabling Post-Processing Scripts

Faspex admins have the ability to execute post-processing scripts on the server to accomplish tasks such as virus checking, moving files, and creating backups once packages arrive. Post-processing uses a set of filtering options to determine when to execute customized scripts. Aspera Faspex can execute shell scripts and Windows batch scripts, where information about the package is passed to the script by means of environment variables.

Post-processing scripts that have been activated execute automatically after the initial transfer to a default inbox. The relay of a package to a custom inbox does not trigger script execution.

In the event that a Faspex Administrative account is compromised, post-processing can be a serious threat to your server's security. Thus, Aspera strongly recommends that you update your administrative users' permissions in order to prevent unauthorized users from executing post-processing on Faspex by restricting the IP addresses from which a user can log into an admin account. For more information, see Configure User Settings.
Note: By default, post-processing is enabled. To disable it for security reasons, see the instructions at the end of this topic.
  1. Prepare the post-processing script.

    Generate your post-processing script and place it in a directory on the machine running your Faspex. Take note of, or copy, your script's full system path on the server. You can utilize the following environment variables in your post-processing scripts, but be sure to use the proper format. For example, the variable faspex_pkg_directory will be available as $faspex_pkg_directory in shell scripts, and %faspex_pkg_directory% in Windows batch files.

    Variable Description
    faspex_pkg_directory Storage directory of the package. See cautionary note below.
    faspex_pkg_name Package title.
    faspex_pkg_note Package note.
    faspex_pkg_id Package ID.
    faspex_recipient_list Comma-separated list of recipients. (for example, "admin, johndoe")
    faspex_recipient_count Number of recipients. (for example, "3")
    faspex_recipient_i Name of the recipient. (i starts at "0", for example, faspex_recipient_0, faspex_recipient_1 ...).
    faspex_sender_id The sender's ID.
    faspex_sender_name The sender's full name.
    faspex_sender_email The sender's e-mail.
    faspex_pkg_total_bytes Size of the package in bytes.
    faspex_pkg_total_files Number of files in the package.
    faspex_pkg_uuid The package's UUID (36 characters).
    faspex_metadata_fields Comma separated list of the metadata fields defined for the package.
    faspex_metadata_<field> The value of the metadata field named <field>. In the field name, spaces are converted to underscores, non alphanumeric characters or underscores are stripped. For example, "my field" becomes "my_field"; "*my_group" becomes "mygroup".
    CAUTION:
    If you are upgrading from Faspex 2.X to 3.X and use post-processing scripts, modify the scripts as follows, since the package's full path is no longer available to the scripts:
    • If the transfer server is on the same machine as Faspex, ensure that the package path is prefixed with the user’s docroot. After doing so, you may want to check for an extra slash character in the path if you have a slash both at the end of the docroot and at the start of the path as defined in $faspex_pkg_directory. For example, the entry C:\faspex_packages\$faspex_pkg_directory and a package title of "NewVideos" could result in C:\faspex_packages\$faspex_pkg_directory\\NewVideos - 10d8a2f1-30f4-47ad-a55b-6f8dbba7ff8d/PKG - NewVideos.
    • If the transfer server is on a different machine, modify post-processing scripts to invoke the Node API, or mount the remote volume on the Faspex server.

Set up post-processing in the Faspex Web UI.

  1. Go to Server > Post-Processing and click Create New.
  2. Configure the script.
    Script to run
    Item Description
    Name A descriptive name for this script.
    Path to script on server Enter the full path to the executable script that exists on the server.
    Important: The system user faspex should have the proper permissions to access and execute this file.
    Active Check to enable this script.

    Execution criteria

    All specified criteria must match the uploaded package's attributes for the script to be run on that package. All match fields in this section are optional. When Exact match is checked, the package attribute has to match the specified criterion exactly for the script to be run, the entered text will be matched anywhere in the field.
    Item Description
    Package name Execute when the package name matches the string.
    Sender name Execute when the sender name matches the string.
    Sender email Execute when the sender email matches the string.
    Recipient name Execute when the recipient name matches the string.
    Recipient email Execute when the recipient email matches the string.
    Package note Execute when the package note matches the string.
    Package date Execute when the package date falls into the determined range.
    Package size Execute when the package size falls into the determined range.
    Package file count Execute when the package file count falls into the determined range.

For security reasons, you may optionally disable post-processing in faspex.yml. The DisablePostProcessing setting can be found in the faspex.yml found at:

OS Version Location
Windows 32-bit C:\Program Files (x86)\Aspera\Faspex\config\faspex.yml
Windows 64-bit C:\Program Files (x86)\Aspera\Faspex\config\faspex.yml
Important: Aspera strongly recommends backing up faspex.yml before modifying.

Within faspex.yml, change DisablePostProcessing:false to DisablePostProcessing:true:

production:
    ...
    DisablePostProcessing:true
    ...
For more information on faspex.yml, see Configuring Faspex with faspex.yml.