Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NET-1784: Adv Acl Rules #3239

Merged
merged 40 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
4097060
define direction on acl req
abhishek9686 Nov 15, 2024
6710e24
define protocol types and rule model
abhishek9686 Nov 16, 2024
58b6d54
get rules for node
abhishek9686 Nov 18, 2024
81e5d86
fetch acl rule for a node
abhishek9686 Nov 18, 2024
031a0c1
redine acl firewall model
abhishek9686 Nov 20, 2024
f514574
add json tags
abhishek9686 Nov 20, 2024
b14525b
update port,protocol, and direction
abhishek9686 Nov 22, 2024
db4d723
add json tags to acl options
abhishek9686 Nov 22, 2024
53bb4c5
Merge branch 'develop' of https://github.com/gravitl/netmaker into NE…
abhishek9686 Nov 24, 2024
2a106b4
convert protocol to string
abhishek9686 Nov 24, 2024
edfa180
simplify acl map
abhishek9686 Nov 25, 2024
5e240c2
add json tags to acl rules
abhishek9686 Nov 25, 2024
2084ca6
resolve merge conflicts
abhishek9686 Nov 25, 2024
376d7c0
Merge pull request #3221 from gravitl/NET-1784-v1
abhishek9686 Nov 25, 2024
a11bbd9
add networks to fw update
abhishek9686 Nov 26, 2024
6ba91aa
add acls rules
abhishek9686 Nov 27, 2024
3101d29
Merge branch 'acls_cache_fix' of https://github.com/gravitl/netmaker …
abhishek9686 Nov 27, 2024
7b84e18
Merge branch 'develop' of https://github.com/gravitl/netmaker into NE…
abhishek9686 Nov 28, 2024
52f6529
NET-1784: add allow all field
abhishek9686 Nov 28, 2024
a91bf81
add allow all field on fw udpate
abhishek9686 Nov 28, 2024
442f1cd
remove debug logs
abhishek9686 Nov 28, 2024
2c854ec
fix port and protocol types
abhishek9686 Nov 28, 2024
a3cfecc
migrate default acl policies
abhishek9686 Nov 28, 2024
0f3b3ac
define constants for service types
abhishek9686 Dec 1, 2024
e2265ea
add adv options for user rules on ingress gw
abhishek9686 Dec 2, 2024
8de858d
debug log
abhishek9686 Dec 3, 2024
e47baab
Merge pull request #3238 from gravitl/NET-1784-userRules
abhishek9686 Dec 3, 2024
e24d171
Merge branch 'develop' of https://github.com/gravitl/netmaker into NE…
abhishek9686 Dec 3, 2024
4914681
allow whole network
abhishek9686 Dec 5, 2024
aa10e2e
add static nodes to acl rules
abhishek9686 Dec 5, 2024
7dcabb5
replace peers on acl updates
abhishek9686 Dec 6, 2024
7e42456
initiliase rule map
abhishek9686 Dec 8, 2024
602a8ec
resolve merge conflicts
abhishek9686 Dec 8, 2024
9944dda
add user acl rules on target node
abhishek9686 Dec 8, 2024
07f0181
revert acl check on extclient
abhishek9686 Dec 8, 2024
8f935e8
handle static node rules on ingress gw
abhishek9686 Dec 9, 2024
dfe978f
update multiple policies for users
abhishek9686 Dec 9, 2024
7779505
check allowed direction
abhishek9686 Dec 9, 2024
33a598a
remove debug logs
abhishek9686 Dec 10, 2024
44e7b4d
resolve merge conflicts
abhishek9686 Dec 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 71 additions & 9 deletions controllers/acls.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,73 @@ func aclPolicyTypes(w http.ResponseWriter, r *http.Request) {
// models.NetmakerIPAclID,
// models.NetmakerSubNetRangeAClID,
},
ProtocolTypes: []models.ProtocolType{
{
Name: models.Http,
AllowedProtocols: []models.Protocol{
models.TCP,
},
PortRange: "80",
},
{
Name: models.Https,
AllowedProtocols: []models.Protocol{
models.TCP,
},
PortRange: "443",
},
// {
// Name: "MySQL",
// AllowedProtocols: []models.Protocol{
// models.TCP,
// },
// PortRange: "3306",
// },
// {
// Name: "DNS TCP",
// AllowedProtocols: []models.Protocol{
// models.TCP,
// },
// PortRange: "53",
// },
// {
// Name: "DNS UDP",
// AllowedProtocols: []models.Protocol{
// models.UDP,
// },
// PortRange: "53",
// },
{
Name: models.AllTCP,
AllowedProtocols: []models.Protocol{
models.TCP,
},
PortRange: "All ports",
},
{
Name: models.AllUDP,
AllowedProtocols: []models.Protocol{
models.UDP,
},
PortRange: "All ports",
},
{
Name: models.ICMPService,
AllowedProtocols: []models.Protocol{
models.ICMP,
},
PortRange: "",
},
{
Name: models.Custom,
AllowedProtocols: []models.Protocol{
models.UDP,
models.TCP,
},
PortRange: "All ports",
AllowPortSetting: true,
},
},
}
logic.ReturnSuccessResponseWithJson(w, r, resp, "fetched acls types")
}
Expand All @@ -69,7 +136,7 @@ func aclDebug(w http.ResponseWriter, r *http.Request) {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
return
}
allowed := logic.IsNodeAllowedToCommunicate(node, peer, true)
allowed, _ := logic.IsNodeAllowedToCommunicate(node, peer, true)
logic.ReturnSuccessResponseWithJson(w, r, allowed, "fetched all acls in the network ")
}

Expand Down Expand Up @@ -132,11 +199,6 @@ func createAcl(w http.ResponseWriter, r *http.Request) {
acl.CreatedBy = user.UserName
acl.CreatedAt = time.Now().UTC()
acl.Default = false
if acl.RuleType == models.DevicePolicy {
acl.AllowedDirection = models.TrafficDirectionBi
} else {
acl.AllowedDirection = models.TrafficDirectionUni
}
// validate create acl policy
if !logic.IsAclPolicyValid(acl) {
logic.ReturnErrorResponse(w, r, logic.FormatError(errors.New("invalid policy"), "badrequest"))
Expand All @@ -152,7 +214,7 @@ func createAcl(w http.ResponseWriter, r *http.Request) {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "internal"))
return
}
go mq.PublishPeerUpdate(false)
go mq.PublishPeerUpdate(true)
logic.ReturnSuccessResponseWithJson(w, r, acl, "created acl successfully")
}

Expand Down Expand Up @@ -194,7 +256,7 @@ func updateAcl(w http.ResponseWriter, r *http.Request) {
logic.ReturnErrorResponse(w, r, logic.FormatError(err, "badrequest"))
return
}
go mq.PublishPeerUpdate(false)
go mq.PublishPeerUpdate(true)
logic.ReturnSuccessResponse(w, r, "updated acl "+acl.Name)
}

Expand Down Expand Up @@ -225,6 +287,6 @@ func deleteAcl(w http.ResponseWriter, r *http.Request) {
logic.FormatError(errors.New("cannot delete default policy"), "internal"))
return
}
go mq.PublishPeerUpdate(false)
go mq.PublishPeerUpdate(true)
logic.ReturnSuccessResponse(w, r, "deleted acl "+acl.Name)
}
Loading
Loading