create_local_in_policy
Create an IPv4 local-in policy to control traffic destined to the FortiGate management plane, defining allowed or denied services and source addresses by incoming interface.
Instructions
Create a new IPv4 local-in policy.
Local-in policies control traffic destined to the FortiGate's own
management plane (GUI, SSH, ping, API, SNMP, etc.) -- a distinct object
space from the regular firewall/policy table (create_firewall_policy),
which governs traffic passing through the device. There is no
srcintf/dstintf pair here: intf is the single incoming interface,
since local-in traffic terminates on the FortiGate itself rather than
being forwarded. A local-in policy only takes effect once its package
is installed to a device (see preview_install / install_package).
Args: adom: ADOM name package: Policy package name intf: Incoming interface(s) this policy applies to, e.g. ["port1"] srcaddr: Source addresses this policy matches (e.g. ["Admin-Subnet"]) dstaddr: Destination addresses on the FortiGate itself (e.g. ["all"]) service: Services this policy matches, e.g. ["HTTPS", "SSH"] action: Policy action - "accept" or "deny" (default: "deny", the FortiOS field default -- unlike create_firewall_policy this defaults closed since it governs management-plane access) schedule: Schedule object name(s) (default: ["always"] if omitted) status: Policy status - "enable" or "disable" (default: "enable") logtraffic: Local-in traffic logging - "enable" or "disable" (optional) comments: Policy comments (optional) policyid: Specific policy ID (optional, auto-assigned if not set) srcaddr_negate: Match all sources EXCEPT srcaddr (optional) dstaddr_negate: Match all destinations EXCEPT dstaddr (optional) service_negate: Match all services EXCEPT service (optional) ha_mgmt_intf_only: Restrict this policy to the HA management interface only (optional). IPv4-only field -- there is no equivalent on create_local_in_policy6. virtual_patch: Enable/disable virtual patching on this policy (optional)
Returns: dict: Create result with keys: - status: "success" or "error" - policyid: Created policy ID - message: Status or error message
Example: >>> result = await create_local_in_policy( ... adom="root", ... package="default", ... intf=["port1"], ... srcaddr=["Admin-Subnet"], ... dstaddr=["all"], ... service=["HTTPS", "SSH"], ... action="accept", ... )
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| adom | Yes | ||
| intf | Yes | ||
| action | No | deny | |
| status | No | enable | |
| dstaddr | Yes | ||
| package | Yes | ||
| service | Yes | ||
| srcaddr | Yes | ||
| comments | No | ||
| policyid | No | ||
| schedule | No | ||
| logtraffic | No | ||
| virtual_patch | No | ||
| dstaddr_negate | No | ||
| service_negate | No | ||
| srcaddr_negate | No | ||
| ha_mgmt_intf_only | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||