Add a custom Snort rule

Prev Next

Submits a custom Snort rule file.

POST https://<nx-address>/wsapis/[v1.2.0|v2.0.0]/customioc/snort/add/custom

Availability

This command is available on the following appliances:

  • Network Security

  • Central Management System (since release 8.1.0)

Required header:

X-FeApi-Token: [API-Token]

Request content-type:

multipart/form-data

Parameters

  • nx-address—This is the IP address of the appliance running the Web Services API.

  • API-Token—This token authenticates the session. By default, the session times out after 15 minutes of inactivity.

  • description—Optional. Passes a description for file in JSON format. For example, {"description": "This is my Snort file"}

Example request

POST https://<address>/wsapis/v2.0.0/customioc/snort/add/custom

Results

The specified Snort rule is submitted to the server.

Add a custom Snort rule response

  • Response Code—A standard HTML response code.

    • 200—Request successful.

    • 500—Request unsuccessful because the server encountered a problem.

    • 501—Device is not an Network Security appliance.

  • Response Message—A standard HTML response message.

    • OK—Request successful.

    • Internal Server Error—Request unsuccessful because the server encountered a problem.

cURL code sample: add a custom Snort rule

The following code sample can be copied and executed from any command-line interface that includes the cURL library.

Note

In this sample, line breaks are added for readability. Remove these line breaks before you paste the code sample into your command-line tool.

curl -qgsSk --header "${COOKIE}" -F options="{\"description\":\"This is my description\"}" -F filename=@${file} "https://xxx.xxx.xxx.xxx/wsapis/${API_VERSION}/customioc/snort/add/custom"

This cURL sample includes the following options:

  • -q—This option specifies that the curlrc config file is not read or used. Although this is an optional setting, Trellix recommends that you include this option.

  • -g—This option turns off the URL globbing parser. Although this is an optional setting, Trellix recommends that you include this option.

  • -s—This option turns off the progress meter and error message. Although this is an optional setting, Trellix recommends that you include this option.

  • -S—When used with the -s option, this option shows error messages if your cURL switch fails. Although this is an optional setting, Trellix recommends that you include this option.

  • -k—This option explicitly allows cURL to perform insecure SSL connections and transfers. This allows you to test your SSL connection without installing a CA certificate.

  • --header—This option allows you to specify a custom header.

  • -F filename=@${file}—This option specifies the Snort file to submit.

  • https://xxx.xxx.xxx.xxx/wsapis/${API_VERSION}/customioc/snort/add/custom—The add request URL. Replace the IP address xxx.xxx.xxx.xxx with the IP address of your appliance.