fix the reload process for appsec (#2750)

This commit is contained in:
Thibault "bui" Koechlin 2024-01-17 11:54:44 +01:00 committed by GitHub
parent f156f178cd
commit 685cda545b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 1 deletions

View file

@ -268,6 +268,8 @@ func (w *AppsecSource) StreamingAcquisition(out chan types.Event, t *tomb.Tomb)
})
<-t.Dying()
w.logger.Infof("Stopping Appsec server on %s%s", w.config.ListenAddr, w.config.Path)
//xx let's clean up the appsec runners :)
appsec.AppsecRulesDetails = make(map[int]appsec.RulesDetails)
w.server.Shutdown(context.TODO())
return nil
})

View file

@ -43,7 +43,7 @@ type RulesDetails struct {
Name string
}
// Should it be a global ?
// FIXME: this shouldn't be a global
// Is using the id is a good idea ? might be too specific to coraza and not easily reusable
var AppsecRulesDetails = make(map[int]RulesDetails)

View file

@ -15,6 +15,7 @@ var hub *cwhub.Hub //FIXME: this is a temporary hack to make the hub available i
func LoadAppsecRules(hubInstance *cwhub.Hub) error {
hub = hubInstance
appsecRules = make(map[string]AppsecCollectionConfig)
for _, hubAppsecRuleItem := range hub.GetItemMap(cwhub.APPSEC_RULES) {
if !hubAppsecRuleItem.State.Installed {