Skip to content

Commit e0af221

Browse files
authored
Merge pull request #127 from telekom-mms/fix/forti-7.6
fix: since fortios 7.6 tcp/udp service protocol is 'TCP/UDP/UDP-Lite/…
2 parents c4f8dae + 89a57dd commit e0af221

6 files changed

Lines changed: 14 additions & 94 deletions

File tree

.github/workflows/main.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ jobs:
1212
strategy:
1313
matrix:
1414
python:
15-
- "3.9"
16-
- "3.10"
1715
- "3.11"
1816
- "3.12"
1917
steps:

fortilib/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
__version__ = "1.0.7"
22

3+
from enum import StrEnum
34
from typing import (
45
Dict,
56
List,
67
)
78

89

10+
class FortigateTCPUDPServiceProtocol(StrEnum):
11+
TCP_UDP_SCTP = "TCP/UDP/SCTP"
12+
TCP_UDP_UDP_Lite_SCTP = "TCP/UDP/UDP-Lite/SCTP"
13+
14+
915
class FortilibSettings:
1016
strict_address_group_member_matching: bool = True
17+
tcp_udp_service_protocol = FortigateTCPUDPServiceProtocol.TCP_UDP_SCTP
1118

1219

1320
def get_by(attrname, attrvalue, haystack):

fortilib/firewall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ def get_services(self) -> List[FortigateService]:
269269
service = FortigateICMPService.from_dict(raw)
270270
if raw["protocol"] == "ICMP6":
271271
service = FortigateICMP6Service.from_dict(raw)
272-
elif raw["protocol"] in "TCP/UDP/SCTP":
272+
elif raw["protocol"].startswith("TCP/UDP"):
273273
service = FortigateTCPUDPService.from_dict(raw)
274274
elif raw["protocol"] == "IP":
275275
service = FortigateIPService.from_dict(raw)

fortilib/service.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from fortilib import FortilibSettings
12
from fortilib.base import FortigateNamedObject
23

34

@@ -38,7 +39,7 @@ class FortigateTCPUDPService(FortigateService):
3839
def __init__(self):
3940
super().__init__()
4041

41-
self.protocol = "TCP/UDP/SCTP"
42+
self.protocol = str(FortilibSettings.tcp_udp_service_protocol)
4243
self.tcp_portrange: str = ""
4344
self.udp_portrange: str = ""
4445

poetry.lock

Lines changed: 3 additions & 89 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ keywords = ["firewall", "fortinet", "fortigate"]
2020
Changelog = "https://github.com/telekom-mms/fortilib/blob/master/CHANGELOG.md"
2121

2222
[tool.poetry.dependencies]
23-
python = ">=3.9,<4.0"
23+
python = ">=3.11,<4.0"
2424
httpx = ">=0.23.0"
2525

2626
[tool.poetry.dev-dependencies]

0 commit comments

Comments
 (0)