fix: add missing ip_group_id to firewall zone policy to support firewall groups of address-group type (ipv4) (#39)

fixes #38
This commit is contained in:
Mateusz Filipowicz
2025-03-02 21:15:18 +01:00
committed by GitHub
parent 75015fcfaa
commit 4e6e9d97b7
3 changed files with 13 additions and 4 deletions

View File

@@ -355,6 +355,11 @@ customizations:
resourcePath: "firewall/zone-matrix" resourcePath: "firewall/zone-matrix"
FirewallZonePolicy: FirewallZonePolicy:
resourcePath: "firewall-policies" resourcePath: "firewall-policies"
fields:
IPGroupID:
omitEmpty: true
PortGroupID:
omitEmpty: true
Network: Network:
fields: fields:
InternetAccessEnabled: InternetAccessEnabled:

View File

@@ -9,6 +9,7 @@
"destination": { "destination": {
"app_category_ids": [""], "app_category_ids": [""],
"app_ids": [""], "app_ids": [""],
"ip_group_id": "",
"ips": ["^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"], "ips": ["^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"],
"match_mac": "true|false", "match_mac": "true|false",
"match_opposite_ips": "true|false", "match_opposite_ips": "true|false",
@@ -41,6 +42,7 @@
}, },
"source": { "source": {
"client_macs": ["^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$"], "client_macs": ["^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$"],
"ip_group_id": "",
"ips": ["^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"], "ips": ["^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$"],
"mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$", "mac": "^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$",
"match_mac": "true|false", "match_mac": "true|false",

View File

@@ -66,6 +66,7 @@ func (dst *FirewallZonePolicy) UnmarshalJSON(b []byte) error {
type FirewallZonePolicyDestination struct { type FirewallZonePolicyDestination struct {
AppCategoryIDs []string `json:"app_category_ids,omitempty"` AppCategoryIDs []string `json:"app_category_ids,omitempty"`
AppIDs []string `json:"app_ids,omitempty"` AppIDs []string `json:"app_ids,omitempty"`
IPGroupID string `json:"ip_group_id,omitempty"`
IPs []string `json:"ips,omitempty" validate:"omitempty,ipv4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$ IPs []string `json:"ips,omitempty" validate:"omitempty,ipv4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
MatchMAC bool `json:"match_mac"` MatchMAC bool `json:"match_mac"`
MatchOppositeIPs bool `json:"match_opposite_ips"` MatchOppositeIPs bool `json:"match_opposite_ips"`
@@ -73,7 +74,7 @@ type FirewallZonePolicyDestination struct {
MatchingTarget string `json:"matching_target,omitempty" validate:"omitempty,oneof=ANY APP APP_CATEGORY IP REGION WEB"` // ANY|APP|APP_CATEGORY|IP|REGION|WEB MatchingTarget string `json:"matching_target,omitempty" validate:"omitempty,oneof=ANY APP APP_CATEGORY IP REGION WEB"` // ANY|APP|APP_CATEGORY|IP|REGION|WEB
MatchingTargetType string `json:"matching_target_type,omitempty" validate:"omitempty,oneof=ANY OBJECT SPECIFIC"` // ANY|OBJECT|SPECIFIC MatchingTargetType string `json:"matching_target_type,omitempty" validate:"omitempty,oneof=ANY OBJECT SPECIFIC"` // ANY|OBJECT|SPECIFIC
Port int `json:"port,omitempty"` // ^[0-9][0-9]?$|^ Port int `json:"port,omitempty"` // ^[0-9][0-9]?$|^
PortGroupID string `json:"port_group_id"` PortGroupID string `json:"port_group_id,omitempty"`
PortMatchingType string `json:"port_matching_type,omitempty" validate:"omitempty,oneof=ANY SPECIFIC OBJECT"` // ANY|SPECIFIC|OBJECT PortMatchingType string `json:"port_matching_type,omitempty" validate:"omitempty,oneof=ANY SPECIFIC OBJECT"` // ANY|SPECIFIC|OBJECT
Regions []string `json:"regions,omitempty"` Regions []string `json:"regions,omitempty"`
WebDomains []string `json:"web_domains,omitempty"` WebDomains []string `json:"web_domains,omitempty"`
@@ -135,8 +136,9 @@ func (dst *FirewallZonePolicySchedule) UnmarshalJSON(b []byte) error {
type FirewallZonePolicySource struct { type FirewallZonePolicySource struct {
ClientMACs []string `json:"client_macs,omitempty" validate:"omitempty,mac"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$ ClientMACs []string `json:"client_macs,omitempty" validate:"omitempty,mac"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
IPs []string `json:"ips,omitempty" validate:"omitempty,ipv4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$ IPGroupID string `json:"ip_group_id,omitempty"`
MAC string `json:"mac,omitempty" validate:"omitempty,mac"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$ IPs []string `json:"ips,omitempty" validate:"omitempty,ipv4"` // ^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$|^$
MAC string `json:"mac,omitempty" validate:"omitempty,mac"` // ^([0-9A-Fa-f]{2}:){5}([0-9A-Fa-f]{2})$
MatchMAC bool `json:"match_mac"` MatchMAC bool `json:"match_mac"`
MatchOppositeIPs bool `json:"match_opposite_ips"` MatchOppositeIPs bool `json:"match_opposite_ips"`
MatchOppositeNetworks bool `json:"match_opposite_networks"` MatchOppositeNetworks bool `json:"match_opposite_networks"`
@@ -145,7 +147,7 @@ type FirewallZonePolicySource struct {
MatchingTargetType string `json:"matching_target_type,omitempty" validate:"omitempty,oneof=OBJECT SPECIFIC"` // OBJECT|SPECIFIC MatchingTargetType string `json:"matching_target_type,omitempty" validate:"omitempty,oneof=OBJECT SPECIFIC"` // OBJECT|SPECIFIC
NetworkIDs []string `json:"network_ids,omitempty"` NetworkIDs []string `json:"network_ids,omitempty"`
Port int `json:"port,omitempty"` // ^[0-9][0-9]?$|^ Port int `json:"port,omitempty"` // ^[0-9][0-9]?$|^
PortGroupID string `json:"port_group_id"` PortGroupID string `json:"port_group_id,omitempty"`
PortMatchingType string `json:"port_matching_type,omitempty" validate:"omitempty,oneof=ANY SPECIFIC OBJECT"` // ANY|SPECIFIC|OBJECT PortMatchingType string `json:"port_matching_type,omitempty" validate:"omitempty,oneof=ANY SPECIFIC OBJECT"` // ANY|SPECIFIC|OBJECT
ZoneID string `json:"zone_id"` ZoneID string `json:"zone_id"`
} }