create_firewall_policy
Create a firewall policy in a specified policy package with interfaces, addresses, services, action, NAT, logging, and security profiles; install the package to activate the policy.
Instructions
Create a new firewall policy.
Creates a firewall policy in the specified policy package. The policy won't be active until the package is installed to devices.
Args:
adom: ADOM name
package: Policy package name
name: Policy name
srcintf: Source interfaces (e.g., ["internal"])
dstintf: Destination interfaces (e.g., ["wan1"])
srcaddr: Source addresses (e.g., ["all"])
dstaddr: Destination addresses (e.g., ["all"])
service: Services (e.g., ["ALL", "HTTP", "HTTPS"])
action: Policy action - "accept" or "deny" (default: "accept")
schedule: Schedule object name (default: "always")
nat: Enable NAT (default: False)
logtraffic: Log mode - "all", "utm", or "disable" (default: "utm")
status: Policy status - "enable" or "disable" (default: "enable")
comments: Policy comments (optional)
policyid: Specific policy ID (optional, auto-assigned if not set)
srcaddr_negate: Match all sources EXCEPT srcaddr (optional; omitted
from the payload when not set, leaving the FortiManager default)
dstaddr_negate: Match all destinations EXCEPT dstaddr (optional)
service_negate: Match all services EXCEPT service (optional)
utm_status: Enable/disable security profile inspection on this policy
(optional). Required (True) for any of the profile fields below
to actually apply.
av_profile: Antivirus profile name, e.g. "default" (optional)
ips_sensor: IPS sensor name, e.g. "default" (optional)
webfilter_profile: Web filter profile name (optional)
dnsfilter_profile: DNS filter profile name (optional)
application_list: Application control list name (optional)
file_filter_profile: File filter profile name (optional)
ssl_ssh_profile: SSL/SSH inspection profile name, e.g.
"certificate-inspection" (optional)
profile_protocol_options: Protocol options profile name (optional).
Mutually exclusive with profile_group -- it is itself a member
of the FortiOS firewall profile-group object, so FortiOS
rejects setting both
profile_group: Security profile group name (optional). Mutually
exclusive with av_profile, ips_sensor, webfilter_profile,
dnsfilter_profile, application_list, file_filter_profile,
ssl_ssh_profile, and profile_protocol_options -- FortiOS rejects
setting both
Returns: dict: Create result with keys: - status: "success" or "error" - policyid: Created policy ID - message: Status or error message
Example: >>> result = await create_firewall_policy( ... adom="root", ... package="default", ... name="Allow-Web-Traffic", ... srcintf=["internal"], ... dstintf=["wan1"], ... srcaddr=["LAN-Subnet"], ... dstaddr=["all"], ... service=["HTTP", "HTTPS"], ... action="accept", ... nat=True, ... utm_status=True, ... av_profile="default", ... ips_sensor="default", ... )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| nat | No | ||
| adom | Yes | ||
| name | Yes | ||
| action | No | accept | |
| status | No | enable | |
| dstaddr | Yes | ||
| dstintf | Yes | ||
| package | Yes | ||
| service | Yes | ||
| srcaddr | Yes | ||
| srcintf | Yes | ||
| comments | No | ||
| policyid | No | ||
| schedule | No | always | |
| av_profile | No | ||
| ips_sensor | No | ||
| logtraffic | No | utm | |
| utm_status | No | ||
| profile_group | No | ||
| dstaddr_negate | No | ||
| service_negate | No | ||
| srcaddr_negate | No | ||
| ssl_ssh_profile | No | ||
| application_list | No | ||
| dnsfilter_profile | No | ||
| webfilter_profile | No | ||
| file_filter_profile | No | ||
| profile_protocol_options | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||