Skip to content

Commit

Permalink
Merge pull request #458 from untangle/MFW-6154
Browse files Browse the repository at this point in the history
MFW-6154: Support trial/license for DoS - device enforcement
version: bug
  • Loading branch information
sumedha-game authored Feb 4, 2025
2 parents 7fcdf72 + e18f07f commit f6729df
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
14 changes: 14 additions & 0 deletions services/licensemanager/licensesmanager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func TestGetLicenseDefaults(t *testing.T) {
"untangle-node-captiveportal",
"untangle-node-dynamic-lists",
"untangle-node-dns-filter",
"untangle-node-dos-filter",
}

assert.ElementsMatch(t, expectedKeys, serviceKeys)
Expand Down Expand Up @@ -154,6 +155,7 @@ func TestGetLicenseDetails(t *testing.T) {
"Captive Portal",
"DNS Filter",
"Dynamic Blocklists",
"Denial of Service Protection",
}

actualDisplayNames := []string{}
Expand Down Expand Up @@ -390,6 +392,7 @@ func (suite *LicenseManagerTestSuite) SetupSuite() {
"untangle-node-captiveportal": {Name: "untangle-node-captiveportal", State: ServiceState{AllowedState: 0}},
"untangle-node-dynamic-lists": {Name: "untangle-node-dynamic-lists", State: ServiceState{AllowedState: 0}},
"untangle-node-dns-filter": {Name: "untangle-node-dns-filter", State: ServiceState{AllowedState: 0}},
"untangle-node-dos-filter": {Name: "untangle-node-dos-filter", State: ServiceState{AllowedState: 0}},
}

if startupErr := suite.lm.Startup(); startupErr != nil {
Expand Down Expand Up @@ -508,6 +511,12 @@ func getTestConfig() *Config {
Enabled: nil,
Disabled: disableDnsFilter,
},
"untangle-node-dos-filter": {
Start: func() {},
Stop: func() {},
Enabled: nil,
Disabled: disableDosFilter,
},
}

return &Config{
Expand Down Expand Up @@ -559,6 +568,11 @@ func disableDnsFilter() (interface{}, []string, error) {
return false, []string{"dnsfilter", "enabled"}, nil
}

// DisableDosFilter
func disableDosFilter() (interface{}, []string, error) {
return false, []string{"dosfilter", "enabled"}, nil
}

func TestSetServices(t *testing.T) {
config := getTestConfig()
config.ServiceStateLocation = setServicesStatesMixedFile
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"name":"untangle-node-dos-filter","allowedState":1}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"untangle-node-sitefilter","allowedState":1},{"name":"untangle-node-geoip","allowedState":1},{"name":"untangle-node-discovery","allowedState":1},{"name":"untangle-node-classd","allowedState":1},{"name":"untangle-node-dynamic-lists","allowedState":1},{"name":"untangle-node-threat-prevention","allowedState":1},{"name":"untangle-node-captiveportal","allowedState":1},{"name":"untangle-node-dns-filter","allowedState":1}]
[{"name":"untangle-node-sitefilter","allowedState":1},{"name":"untangle-node-geoip","allowedState":1},{"name":"untangle-node-discovery","allowedState":1},{"name":"untangle-node-classd","allowedState":1},{"name":"untangle-node-dynamic-lists","allowedState":1},{"name":"untangle-node-threat-prevention","allowedState":1},{"name":"untangle-node-captiveportal","allowedState":1},{"name":"untangle-node-dns-filter","allowedState":1},{"name":"untangle-node-dos-filter","allowedState":1}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"untangle-node-sitefilter","allowedState":0},{"name":"untangle-node-geoip","allowedState":0},{"name":"untangle-node-discovery","allowedState":0},{"name":"untangle-node-classd","allowedState":0},{"name":"untangle-node-dynamic-lists","allowedState":0},{"name":"untangle-node-threat-prevention","allowedState":0},{"name":"untangle-node-captiveportal","allowedState":0},{"name":"untangle-node-dns-filter","allowedState":0}]
[{"name":"untangle-node-sitefilter","allowedState":0},{"name":"untangle-node-geoip","allowedState":0},{"name":"untangle-node-discovery","allowedState":0},{"name":"untangle-node-classd","allowedState":0},{"name":"untangle-node-dynamic-lists","allowedState":0},{"name":"untangle-node-threat-prevention","allowedState":0},{"name":"untangle-node-captiveportal","allowedState":0},{"name":"untangle-node-dns-filter","allowedState":0},{"name":"untangle-node-dos-filter","allowedState":0}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"untangle-node-threat-prevention","allowedState":1},{"name":"untangle-node-sitefilter","allowedState":0},{"name":"untangle-node-geoip","allowedState":0},{"name":"untangle-node-discovery","allowedState":0},{"name":"untangle-node-classd","allowedState":1},{"name":"untangle-node-dynamic-lists","allowedState":0},{"name":"untangle-node-captiveportal","allowedState":0},{"name":"untangle-node-dns-filter","allowedState":0}]
[{"name":"untangle-node-threat-prevention","allowedState":1},{"name":"untangle-node-sitefilter","allowedState":0},{"name":"untangle-node-geoip","allowedState":0},{"name":"untangle-node-discovery","allowedState":0},{"name":"untangle-node-classd","allowedState":1},{"name":"untangle-node-dynamic-lists","allowedState":0},{"name":"untangle-node-captiveportal","allowedState":0},{"name":"untangle-node-dns-filter","allowedState":0},{"name":"untangle-node-dos-filter","allowedState":0}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"name":"untangle-node-captiveportal","allowedState":0},{"name":"untangle-node-threat-prevention","allowedState":1},{"name":"untangle-node-sitefilter","allowedState":0},{"name":"untangle-node-geoip","allowedState":0},{"name":"untangle-node-discovery","allowedState":0},{"name":"untangle-node-classd","allowedState":1},{"name":"untangle-node-dynamic-lists","allowedState":0},{"name":"untangle-node-dns-filter","allowedState":0}]
[{"name":"untangle-node-captiveportal","allowedState":0},{"name":"untangle-node-threat-prevention","allowedState":1},{"name":"untangle-node-sitefilter","allowedState":0},{"name":"untangle-node-geoip","allowedState":0},{"name":"untangle-node-discovery","allowedState":0},{"name":"untangle-node-classd","allowedState":1},{"name":"untangle-node-dynamic-lists","allowedState":0},{"name":"untangle-node-dns-filter","allowedState":0},{"name":"untangle-node-dos-filter","allowedState":0}]
12 changes: 12 additions & 0 deletions services/licensemanager/testdata/licenses/licenses.json
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,18 @@
"keyVersion": 3,
"name": "untangle-node-dynamic-lists",
"javaClass": "com.untangle.uvm.node.License"
},
{
"UID": "686ee777-3755-4626-af7f-a3ae6891c9be",
"type": "Subscription",
"end": 1755932400,
"start": 1724050800,
"seats": 1000000,
"displayName": "Denial of Service Protection",
"key": "994f36f13076688d9058830b53e3f071",
"keyVersion": 3,
"name": "untangle-node-dos-filter",
"javaClass": "com.untangle.uvm.node.License"
}
]
}

0 comments on commit f6729df

Please sign in to comment.