warn at start if body reading is disabled

This commit is contained in:
bui 2023-10-26 12:45:59 +02:00
parent 6cbeefead6
commit f18b554177

View file

@ -51,6 +51,11 @@ func (r *WaapRunner) Init(datadir string) error {
return fmt.Errorf("unable to initialize inband engine : %w", err) return fmt.Errorf("unable to initialize inband engine : %w", err)
} }
tx := r.WaapInbandEngine.NewTransaction()
if !tx.IsRequestBodyAccessible() {
runnerLogger.Warningf("request body is not accessible, inband rules won't be able to match on it")
}
r.WaapOutbandEngine, err = coraza.NewWAF( r.WaapOutbandEngine, err = coraza.NewWAF(
coraza.NewWAFConfig().WithDirectives(outOfBandRules).WithRootFS(fs).WithDebugLogger(NewCrzLogger(runnerLogger)), coraza.NewWAFConfig().WithDirectives(outOfBandRules).WithRootFS(fs).WithDebugLogger(NewCrzLogger(runnerLogger)),
) )
@ -59,6 +64,11 @@ func (r *WaapRunner) Init(datadir string) error {
return fmt.Errorf("unable to initialize outband engine : %w", err) return fmt.Errorf("unable to initialize outband engine : %w", err)
} }
tx = r.WaapOutbandEngine.NewTransaction()
if !tx.IsRequestBodyAccessible() {
runnerLogger.Warningf("request body is not accessible, outband rules won't be able to match on it")
}
return nil return nil
} }