service
Custom firewall services, port ranges, and service groups.
HELPER
module-attribute
#
HELPER = Literal[
"disable",
"auto",
"ftp",
"tftp",
"ras",
"h323",
"tns",
"mms",
"sip",
"pptp",
"rtsp",
"dns-udp",
"dns-tcp",
"pmap",
"rsh",
"dcerpc",
"mgcp",
"gtp-c",
"gtp-u",
"gtp-b",
"pfcp",
]
PORT_RANGE_TYPE
module-attribute
#
PROTOCOL
module-attribute
#
PROTOCOL = Literal[
"ICMP", "IP", "TCP/UDP/SCTP", "ICMP6", "HTTP", "FTP", "CONNECT", "SOCKS", "ALL", "SOCKS-TCP", "SOCKS-UDP"
]
PortRange #
Bases: BaseModel
Port range class
This dataclass is to hold source_start:source_end and destination_start:destination_end port data. For a single source or destination port, either the start or end endpoint can be supplied. The missing endpoint is normalized to the supplied value.
standardize_port_handling #
Ensure start and end are either None or the same if not different
Source code in pyfortinet/fmg_api/firewall/service.py
ServiceCategory #
Bases: FMGObject
ServiceCustom #
Bases: FMGObject
Custom service class
Attributes:
| Name | Type | Description |
|---|---|---|
app_category |
Optional[list[int]]
|
Application category ID |
app_service_type |
Optional[APP_SERVICE_TYPE]
|
Application service type |
application |
Optional[list[int]]
|
Application name ID |
category |
Optional[list[Union[ServiceCategory, str]]]
|
Service category |
check_reset_range |
Optional[CHECK_RESET_RANGE]
|
Enable to reset session if service does not match |
color |
Optional[int]
|
Color of icon on the GUI |
comment |
Optional[str]
|
Comment |
fabric_object |
Optional[ENABLE_DISABLE]
|
Security Fabric global object setting |
fqdn |
Optional[str]
|
Fully Qualified Domain Name (FQDN) |
helper |
Optional[HELPER]
|
Name of helper |
icmpcode |
Optional[int]
|
ICMP code |
icmptype |
Optional[int]
|
ICMP type |
iprange |
Optional[str]
|
Start and end IP addresses for the range |
name |
Optional[str]
|
Service name |
protocol |
Optional[PROTOCOL]
|
Protocol type: TCP/UDP/SCTP/ICMP/ICMP6 |
protocol_number |
Optional[int]
|
IP protocol number |
proxy |
Optional[ENABLE_DISABLE]
|
Enable to use this service for proxy |
sctp_portrange |
Optional[PORT_RANGE_TYPE]
|
SCTP port range |
session_ttl |
Optional[str]
|
Session TTL (Timeout) in seconds |
tcp_halfclose_timer |
Optional[int]
|
TCP half-close timer, in seconds |
tcp_halfopen_timer |
Optional[int]
|
TCP half-open timer, in seconds |
tcp_portrange |
Optional[PORT_RANGE_TYPE]
|
TCP port range |
tcp_rst_timer |
Optional[int]
|
TCP RST timer, in seconds |
tcp_timewait_timer |
Optional[int]
|
TCP time-wait timer, in seconds |
udp_idle_timer |
Optional[int]
|
UDP idle timer, in seconds |
udp_portrange |
Optional[PORT_RANGE_TYPE]
|
UDP port range |
visibility |
Optional[ENABLE_DISABLE]
|
Enable/disable visibility on FortiGate GUI |
ensure_port_ranges #
ensure_port_ranges(v) -> Optional[list[PortRange]]
Create PortRange object from string to standardize portrange handling
Source code in pyfortinet/fmg_api/firewall/service.py
member_names_only #
member_names_only(categories: list[Union[str, ServiceCategory]]) -> list[str]
Ensure member names are passed to API as it is expected
Source code in pyfortinet/fmg_api/firewall/service.py
portranges_to_string #
portranges_to_string(ranges: list[PortRange]) -> list[str]
Ensure portranges are passed to API as it is expected
input format is string as follows:
[dst_start-]dst_end:[src_start-]src_end
Examples:
513:512-1023 means: dst 500 and source range of 512-1023
Source code in pyfortinet/fmg_api/firewall/service.py
ServiceGroup #
Bases: FMGObject
Service group class
Attributes:
member_names_only #
member_names_only(members: list[Union[str, ServiceCustom, ServiceGroup]]) -> list[str]
Ensure member names are passed to API as it is expected