policy
Fortinet Policy object
FIREWALL_SESSION_DIRTY_TYPE
module-attribute
#
GEOIP_MATCH_TYPE
module-attribute
#
POLICY_ACTION
module-attribute
#
POLICY_DISCLAIMER
module-attribute
#
POLICY_OFFLOAD_LEVEL
module-attribute
#
REPUTATION_DIRECTION_TYPE
module-attribute
#
TCP_SESSION_WO_SYN_TYPE
module-attribute
#
PackageSettings #
Bases: BaseModel
Package Settings class
Attributes:
standardize_ssl_ssh_profile #
Keep accepting a single profile name while sending the API array.
Policy #
Bases: FMGObject
Policy class
Configure IPv4/IPv6 policies. When configuring policy within policy package, use (/pm/config/adom/pkg/). When configuring policy for a policy block, use (/pm/config/adom/pblock/).
Attributes:
| Name | Type | Description |
|---|---|---|
adom |
str
|
adom to use (default is specfied by fmg object) |
pkg |
str
|
PolicyPackage selection |
policy_block |
int
|
Assigned policy block. When this attribute is set, the policy represent a policy block, and all other attributes are ignored. This attribute is not available when configuring policy inside a policy block. |
action |
POLICY_ACTION
|
Policy action. |
anti_replay |
ENABLE_DISABLE
|
Enable/disable anti-replay check. |
application_list |
list[str]
|
Name of an existing Application list. |
auth_cert |
Optional[str]
|
HTTPS server certificate for policy authentication. |
auth_path |
str
|
Enable/disable authentication-based routing. |
auth_redirect_addr |
str
|
HTTP-to-HTTPS redirect address for firewall authentication. |
av_profile |
list[str]
|
Name of an existing Antivirus profile. |
block_notification |
str
|
Enable/disable block notification. |
captive_portal_exempt |
str
|
Enable to exempt some users from the captive portal. |
casb_profile |
list[str]
|
Name of an existing CASB profile. |
comments |
str
|
Comment. |
custom_log_fields |
List[str]
|
Custom fields to append to log messages for this policy. |
decrypted_traffic_mirror |
str
|
Decrypted traffic mirror. |
delay_tcp_npu_session |
str
|
Enable TCP NPU session delay to guarantee packet order of 3-way handshake. |
diameter_filter_profile |
list[str]
|
Name of an existing Diameter filter profile. |
diffserv_copy |
str
|
Enable to copy packet's DiffServ values from session's original direction to its reply direction. |
diffserv_forward |
str
|
Enable to change packet's DiffServ values to the specified diffservcode-forward value. |
diffserv_reverse |
str
|
Enable to change packet's reverse (reply) DiffServ values to the specified diffservcode-rev value. |
diffservcode_forward |
str
|
Change packet's DiffServ to this value. |
diffservcode_rev |
str
|
Change packet's reverse (reply) DiffServ to this value. |
disclaimer |
str
|
Enable/disable user authentication disclaimer. |
dlp_profile |
list[str]
|
Name of an existing DLP profile. |
dnsfilter_profile |
list[str]
|
Name of an existing DNS filter profile. |
dsri |
str
|
Enable DSRI to ignore HTTP server responses. |
dstaddr |
List[str]
|
Destination IPv4 address and address group names. |
dstaddr_negate |
str
|
When enabled dstaddr specifies what the destination address must NOT be. |
dstaddr6 |
List[str]
|
Destination IPv6 address name and address group names. |
dstaddr6_negate |
str
|
When enabled dstaddr6 specifies what the destination address must NOT be. |
dstintf |
List[str]
|
Outgoing (egress) interface. |
dynamic_shaping |
str
|
Enable/disable dynamic RADIUS defined traffic shaping. |
email_collect |
str
|
Enable/disable email collection. |
emailfilter_profile |
list[str]
|
Name of an existing email filter profile. |
fec |
str
|
Enable/disable Forward Error Correction on traffic matching this policy on a FEC device. |
file_filter_profile |
list[str]
|
Name of an existing file-filter profile. |
firewall_session_dirty |
str
|
How to handle sessions if the configuration of this firewall policy changes. |
fixedport |
str
|
Enable to prevent source NAT from changing a session's source port. |
fsso_agent_for_ntlm |
str
|
FSSO agent to use for NTLM authentication. |
fsso_groups |
List[str]
|
Names of FSSO groups. |
geoip_anycast |
str
|
Enable/disable recognition of anycast IP addresses using the geography IP database. |
geoip_match |
str
|
Match geography address based either on its physical location or registered location. |
global_label |
str
|
Label for the policy that appears when the GUI is in Global View mode. |
groups |
List[str]
|
Names of user groups that can authenticate with this policy. |
http_policy_redirect |
str
|
Redirect HTTP(S) traffic to matching transparent web proxy policy. |
icap_profile |
list[str]
|
Name of an existing ICAP profile. |
identity_based_route |
str
|
Name of identity-based routing rule. |
inbound |
str
|
Policy-based IPsec VPN: only traffic from the remote network can initiate a VPN. |
inspection_mode |
str
|
Policy inspection mode (Flow/proxy). Default is Flow mode. |
internet_service |
str
|
Enable/disable use of Internet Services for this policy. If enabled, destination address and service are not used. |
internet_service_custom |
List[str]
|
Custom Internet Service name. |
internet_service_custom_group |
List[str]
|
Custom Internet Service group name. |
internet_service_group |
List[str]
|
Internet Service group name. |
internet_service_name |
List[str]
|
Internet Service name. |
internet_service_negate |
str
|
When enabled internet-service specifies what the service must NOT be. |
internet_service_src |
str
|
Enable/disable use of Internet Services in source for this policy. If enabled, source address is not used. |
internet_service_src_custom |
List[str]
|
Custom Internet Service source name. |
internet_service_src_custom_group |
List[str]
|
Custom Internet Service source group name. |
internet_service_src_group |
List[str]
|
Internet Service source group name. |
internet_service_src_name |
List[str]
|
Internet Service source name. |
internet_service_src_negate |
str
|
When enabled internet-service-src specifies what the service must NOT be. |
internet_service6 |
str
|
Enable/disable use of IPv6 Internet Services for this policy. If enabled, destination address and service are not used. |
internet_service6_custom |
List[str]
|
Custom IPv6 Internet Service name. |
internet_service6_custom_group |
List[str]
|
Custom Internet Service6 group name. |
internet_service6_group |
List[str]
|
Internet Service group name. |
internet_service6_name |
List[str]
|
IPv6 Internet Service name. |
internet_service6_negate |
str
|
When enabled internet-service6 specifies what the service must NOT be. |
internet_service6_src |
str
|
Enable/disable use of IPv6 Internet Services in source for this policy. If enabled, source address is not used. |
internet_service6_src_custom |
List[str]
|
Custom IPv6 Internet Service source name. |
internet_service6_src_custom_group |
List[str]
|
Custom Internet Service6 source group name. |
internet_service6_src_group |
List[str]
|
Internet Service6 source group name. |
internet_service6_src_name |
List[str]
|
IPv6 Internet Service source name. |
internet_service6_src_negate |
str
|
When enabled internet-service6-src specifies what the service must NOT be. |
ip_version_type |
str
|
IP version of the policy. |
ippool |
str
|
Enable to use IP Pools for source NAT. |
ips_sensor |
list[str]
|
Name of an existing IPS sensor. |
ips_voip_filter |
list[str]
|
Name of an existing VoIP (ips) profile. |
label |
str
|
Label for the policy that appears when the GUI is in Section View mode. |
logtraffic |
str
|
Enable or disable logging. Log all sessions or security profile sessions. |
logtraffic_start |
str
|
Record logs when a session starts. |
match_vip |
str
|
Enable to match packets that have had their destination addresses changed by a VIP. |
match_vip_only |
str
|
Enable/disable matching of only those packets that have had their destination addresses changed by a VIP. |
name |
str
|
Policy name. |
nat |
str
|
Enable/disable source NAT. |
nat46 |
str
|
Enable/disable NAT46. |
nat64 |
str
|
Enable/disable NAT64. |
natinbound |
str
|
Policy-based IPsec VPN: apply destination NAT to inbound traffic. |
natip |
str
|
Policy-based IPsec VPN: source NAT IP address for outgoing traffic. |
natoutbound |
str
|
Policy-based IPsec VPN: apply source NAT to outbound traffic. |
network_service_dynamic |
List[str]
|
Dynamic Network Service name. |
network_service_src_dynamic |
List[str]
|
Dynamic Network Service source name. |
ntlm |
str
|
Enable/disable NTLM authentication. |
ntlm_enabled_browsers |
List[str]
|
HTTP-User-Agent value of supported browsers. |
ntlm_guest |
str
|
Enable/disable NTLM guest user access. |
outbound |
str
|
Policy-based IPsec VPN: only traffic from the internal network can initiate a VPN. |
passive_wan_health_measurement |
str
|
Enable/disable passive WAN health measurement. When enabled, auto-asic-offload is disabled. |
pcp_inbound |
str
|
Enable/disable PCP inbound DNAT. |
pcp_outbound |
str
|
Enable/disable PCP outbound SNAT. |
pcp_poolname |
List[str]
|
PCP pool names. |
per_ip_shaper |
str
|
Per-IP traffic shaper. |
permit_any_host |
str
|
Accept UDP packets from any host. |
permit_stun_host |
str
|
Accept UDP packets from any Session Traversal Utilities for NAT (STUN) host. |
policy_behaviour_type |
str
|
Behaviour of the policy. |
policy_expiry |
str
|
Enable/disable policy expiry. |
policy_expiry_date |
str
|
Policy expiry date (YYYY-MM-DD HH:MM:SS). |
policy_expiry_date_utc |
str
|
Policy expiry date and time, in epoch format. |
policyid |
int
|
Policy ID (0 - 4294967294). |
poolname |
List[str]
|
IP Pool names. |
poolname6 |
List[str]
|
IPv6 pool names. |
profile_group |
list[str]
|
Name of profile group. |
profile_protocol_options |
list[str]
|
Name of an existing Protocol options profile. |
profile_type |
str
|
Determine whether the firewall policy allows security profile groups or single profiles only. |
radius_mac_auth_bypass |
str
|
Enable MAC authentication bypass. The bypassed MAC address must be received from RADIUS server. |
redirect_url |
str
|
URL users are directed to after seeing and accepting the disclaimer or authenticating. |
replacemsg_override_group |
str
|
Override the default replacement message group for this policy. |
reputation_direction |
str
|
Direction of the initial traffic for reputation to take effect. |
reputation_direction6 |
str
|
Direction of the initial traffic for IPv6 reputation to take effect. |
reputation_minimum |
int
|
Minimum Reputation to take action. |
reputation_minimum6 |
int
|
IPv6 Minimum Reputation to take action. |
rtp_addr |
List[str]
|
Address names if this is an RTP NAT policy. |
rtp_nat |
str
|
Enable Real Time Protocol (RTP) NAT. |
schedule |
str
|
Schedule name. |
schedule_timeout |
str
|
Enable to force current sessions to end when the schedule object times out. Disable allows them to end from inactivity. |
sctp_filter_profile |
list[str]
|
Name of an existing SCTP filter profile. |
send_deny_packet |
str
|
Enable to send a reply to a blocked connection attempt. |
service |
List[str]
|
Service names and service group names. |
service_negate |
str
|
When enabled service specifies what the service must NOT be. |
session_ttl |
str
|
TTL in seconds for sessions accepted by this policy (0 means use the system default session TTL). |
sgt |
List[int]
|
Security group tags. |
sgt_check |
ENABLE_DISABLE
|
Enable/disable security group tags (SGT) check. |
src_vendor_mac |
List[str]
|
Vendor MAC source ID. |
gtp_profile |
list[str]
|
GTP profile. |
pfcp_profile |
list[str]
|
PFCP profile. |
ssh_filter_profile |
list[str]
|
Name of an existing SSH filter profile. |
ssl_ssh_profile |
list[str]
|
Name of an existing SSL SSH profile. |
videofilter_profile |
list[str]
|
Name of an existing VideoFilter profile. |
virtual_patch_profile |
list[str]
|
Name of an existing virtual-patch profile. |
voip_profile |
list[str]
|
Name of an existing VoIP (voipd) profile. |
waf_profile |
list[str]
|
Name of an existing Web application firewall profile. |
wanopt_profile |
list[str]
|
WAN optimization profile. |
webfilter_profile |
list[str]
|
Name of an existing Web filter profile. |
webproxy_profile |
list[str]
|
Webproxy profile name. |
get_url #
Construct API URL based on adom and pkg fields
Source code in pyfortinet/fmg_api/policy.py
member_names_only #
member_names_only(members: List[Union[str, Address, AddressGroup, ServiceCustom, ServiceGroup]]) -> List[str]
Ensure member names are passed to API as it is expected
Source code in pyfortinet/fmg_api/policy.py
standardize_profile_references #
Accept a profile name for convenience and use the API's string arrays.
Source code in pyfortinet/fmg_api/policy.py
PolicyPackage #
Bases: FMGObject
Policy Package class
Attributes:
| Name | Type | Description |
|---|---|---|
name |
Optional[str]
|
Package name (Does not include any parent folders) |
obj_ver |
Optional[int]
|
Package version |
oid |
Optional[int]
|
Internal package ID |
package_settings |
Optional[PackageSettings]
|
Package settings |
scope_member |
Optional[list[Scope]]
|
Assigned VDOMs |
subobj |
Optional[list[PolicyPackage]]
|
Packages and subfolders under a folder object. |
type |
Optional[POLICYPACKAGETYPE]
|
Package type. Default is pkg. |