Apply Rule File icon

Apply Rule File

Apply a rule file

Overview

This node applies a rule file to a firewall system via an API. It sends the content or path of a rule file to a specified endpoint, which processes and applies the rules accordingly. This is useful in scenarios where automated deployment or updating of firewall rules is needed, such as integrating firewall management into CI/CD pipelines or automating security policy updates.

Practical examples:

  • Automatically applying updated firewall rules after a security audit.
  • Deploying new access control policies across multiple environments.
  • Integrating firewall rule application into broader network automation workflows.

Properties

Name Meaning
Rule File The content of the rule file or a path to it. This string input accepts multiline text representing the rules to apply.

Output

The node outputs JSON data for each input item processed, containing:

  • success: Boolean indicating if the rule file was applied successfully.
  • message: A success message returned from the API or a default confirmation.
  • fileLength: Length of the rule file content sent.
  • response: The full response object returned by the API call.

In case of failure (and if continuing on fail), the output includes:

  • success: false
  • error: Error message describing what went wrong.
  • statusCode: HTTP status code from the failed request.
  • response: Response body or error details from the API.
  • fileLength: Length of the attempted rule file content.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential to authenticate with the firewall API service.
  • The node expects the API URL to be provided via credentials.
  • The firewall API must expose an endpoint at /api/pt/rule/aplly that accepts POST requests with JSON payload containing the rule file.

Troubleshooting

  • Common issues:

    • Incorrect or missing API URL or authentication credentials will cause connection failures.
    • Invalid rule file content or format may result in API errors.
    • Network connectivity problems can prevent successful API calls.
  • Error messages:

    • Errors include detailed messages with HTTP status codes and API response bodies.
    • If the node fails to apply the rule file, it throws an error specifying the failure reason, status code, response content, and the URL used.
    • To handle intermittent failures gracefully, enable "Continue On Fail" to receive error details per item without stopping the workflow.

Links and References

  • Refer to your firewall API documentation for details on the /api/pt/rule/aplly endpoint and expected rule file formats.
  • n8n documentation on HTTP Request Helper for understanding how HTTP calls are made within nodes.

Discussion