mirror of
https://github.com/gravitl/netmaker.git
synced 2025-09-06 21:24:16 +08:00
allow single devices in the acl policies
This commit is contained in:
parent
1bc60df02c
commit
021023d999
3 changed files with 14 additions and 5 deletions
|
@ -46,9 +46,11 @@ func aclPolicyTypes(w http.ResponseWriter, r *http.Request) {
|
|||
models.UserAclID,
|
||||
models.UserGroupAclID,
|
||||
models.DeviceAclID,
|
||||
models.DeviceID,
|
||||
},
|
||||
DstGroupTypes: []models.AclGroupType{
|
||||
models.DeviceAclID,
|
||||
models.DeviceID,
|
||||
// models.NetmakerIPAclID,
|
||||
// models.NetmakerSubNetRangeAClID,
|
||||
},
|
||||
|
@ -117,6 +119,13 @@ func aclPolicyTypes(w http.ResponseWriter, r *http.Request) {
|
|||
},
|
||||
PortRange: "",
|
||||
},
|
||||
{
|
||||
Name: models.SSH,
|
||||
AllowedProtocols: []models.Protocol{
|
||||
models.TCP,
|
||||
},
|
||||
PortRange: "22",
|
||||
},
|
||||
{
|
||||
Name: models.Custom,
|
||||
AllowedProtocols: []models.Protocol{
|
||||
|
|
|
@ -267,7 +267,7 @@ func IsAclPolicyValid(acl models.Acl) bool {
|
|||
if dstI.ID == "" || dstI.Value == "" {
|
||||
return false
|
||||
}
|
||||
if dstI.ID != models.DeviceAclID {
|
||||
if dstI.ID != models.DeviceAclID && dstI.ID != models.DeviceID {
|
||||
return false
|
||||
}
|
||||
if dstI.Value == "*" {
|
||||
|
@ -284,7 +284,7 @@ func IsAclPolicyValid(acl models.Acl) bool {
|
|||
if srcI.ID == "" || srcI.Value == "" {
|
||||
return false
|
||||
}
|
||||
if srcI.ID != models.DeviceAclID {
|
||||
if srcI.ID != models.DeviceAclID && srcI.ID != models.DeviceID {
|
||||
return false
|
||||
}
|
||||
if srcI.Value == "*" {
|
||||
|
@ -301,7 +301,7 @@ func IsAclPolicyValid(acl models.Acl) bool {
|
|||
if dstI.ID == "" || dstI.Value == "" {
|
||||
return false
|
||||
}
|
||||
if dstI.ID != models.DeviceAclID {
|
||||
if dstI.ID != models.DeviceAclID && dstI.ID != models.DeviceID {
|
||||
return false
|
||||
}
|
||||
if dstI.Value == "*" {
|
||||
|
|
|
@ -25,14 +25,13 @@ const (
|
|||
ICMP Protocol = "icmp"
|
||||
)
|
||||
|
||||
type ServiceType string
|
||||
|
||||
const (
|
||||
Http = "HTTP"
|
||||
Https = "HTTPS"
|
||||
AllTCP = "All TCP"
|
||||
AllUDP = "All UDP"
|
||||
ICMPService = "ICMP"
|
||||
SSH = "SSH"
|
||||
Custom = "Custom"
|
||||
Any = "Any"
|
||||
)
|
||||
|
@ -59,6 +58,7 @@ const (
|
|||
UserAclID AclGroupType = "user"
|
||||
UserGroupAclID AclGroupType = "user-group"
|
||||
DeviceAclID AclGroupType = "tag"
|
||||
DeviceID AclGroupType = "device"
|
||||
NetmakerIPAclID AclGroupType = "ip"
|
||||
NetmakerSubNetRangeAClID AclGroupType = "ipset"
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue