@@ -1041,7 +1041,8 @@ func (p *policiesCfg) addWAFConfig(
1041
1041
}
1042
1042
}
1043
1043
1044
- if waf .SecurityLog != nil {
1044
+ if waf .SecurityLog != nil && waf .SecurityLogs == nil {
1045
+ glog .V (2 ).Info ("the field securityLog is deprecated nad will be removed in future releases. Use field securityLogs instead" )
1045
1046
p .WAF .ApSecurityLogEnable = true
1046
1047
1047
1048
logConfKey := waf .SecurityLog .ApLogConf
@@ -1052,13 +1053,31 @@ func (p *policiesCfg) addWAFConfig(
1052
1053
1053
1054
if logConfPath , ok := apResources .LogConfs [logConfKey ]; ok {
1054
1055
logDest := generateString (waf .SecurityLog .LogDest , "syslog:server=localhost:514" )
1055
- p .WAF .ApLogConf = fmt .Sprintf ("%s %s" , logConfPath , logDest )
1056
+ p .WAF .ApLogConf = [] string { fmt .Sprintf ("%s %s" , logConfPath , logDest )}
1056
1057
} else {
1057
1058
res .addWarningf ("WAF policy %s references an invalid or non-existing log config %s" , polKey , logConfKey )
1058
1059
res .isError = true
1059
1060
}
1060
1061
}
1061
1062
1063
+ if waf .SecurityLogs != nil {
1064
+ p .WAF .ApSecurityLogEnable = true
1065
+ p .WAF .ApLogConf = []string {}
1066
+ for _ , loco := range waf .SecurityLogs {
1067
+ logConfKey := loco .ApLogConf
1068
+ hasNamepace := strings .Contains (logConfKey , "/" )
1069
+ if ! hasNamepace {
1070
+ logConfKey = fmt .Sprintf ("%v/%v" , polNamespace , logConfKey )
1071
+ }
1072
+ if logConfPath , ok := apResources .LogConfs [logConfKey ]; ok {
1073
+ logDest := generateString (loco .LogDest , "syslog:server=localhost:514" )
1074
+ p .WAF .ApLogConf = append (p .WAF .ApLogConf , fmt .Sprintf ("%s %s" , logConfPath , logDest ))
1075
+ } else {
1076
+ res .addWarningf ("WAF policy %s references an invalid or non-existing log config %s" , polKey , logConfKey )
1077
+ res .isError = true
1078
+ }
1079
+ }
1080
+ }
1062
1081
return res
1063
1082
}
1064
1083
@@ -1575,7 +1594,8 @@ type errorPageDetails struct {
1575
1594
func generateLocation (path string , upstreamName string , upstream conf_v1.Upstream , action * conf_v1.Action ,
1576
1595
cfgParams * ConfigParams , errorPages errorPageDetails , internal bool , proxySSLName string ,
1577
1596
originalPath string , locSnippets string , enableSnippets bool , retLocIndex int , isVSR bool , vsrName string ,
1578
- vsrNamespace string , vscWarnings Warnings ) (version2.Location , * version2.ReturnLocation ) {
1597
+ vsrNamespace string , vscWarnings Warnings ,
1598
+ ) (version2.Location , * version2.ReturnLocation ) {
1579
1599
locationSnippets := generateSnippets (enableSnippets , locSnippets , cfgParams .LocationSnippets )
1580
1600
1581
1601
if action .Redirect != nil {
@@ -1674,7 +1694,8 @@ func generateProxyAddHeaders(proxy *conf_v1.ActionProxy) []version2.AddHeader {
1674
1694
1675
1695
func generateLocationForProxying (path string , upstreamName string , upstream conf_v1.Upstream ,
1676
1696
cfgParams * ConfigParams , errorPages []conf_v1.ErrorPage , internal bool , errPageIndex int ,
1677
- proxySSLName string , proxy * conf_v1.ActionProxy , originalPath string , locationSnippets []string , isVSR bool , vsrName string , vsrNamespace string ) version2.Location {
1697
+ proxySSLName string , proxy * conf_v1.ActionProxy , originalPath string , locationSnippets []string , isVSR bool , vsrName string , vsrNamespace string ,
1698
+ ) version2.Location {
1678
1699
return version2.Location {
1679
1700
Path : generatePath (path ),
1680
1701
Internal : internal ,
@@ -1741,7 +1762,8 @@ func generateLocationForRedirect(
1741
1762
}
1742
1763
1743
1764
func generateLocationForReturn (path string , locationSnippets []string , actionReturn * conf_v1.ActionReturn ,
1744
- retLocIndex int ) (version2.Location , * version2.ReturnLocation ) {
1765
+ retLocIndex int ,
1766
+ ) (version2.Location , * version2.ReturnLocation ) {
1745
1767
defaultType := actionReturn .Type
1746
1768
if defaultType == "" {
1747
1769
defaultType = "text/plain"
@@ -1873,7 +1895,8 @@ func generateDefaultSplitsConfig(
1873
1895
1874
1896
func generateMatchesConfig (route conf_v1.Route , upstreamNamer * upstreamNamer , crUpstreams map [string ]conf_v1.Upstream ,
1875
1897
variableNamer * variableNamer , index int , scIndex int , cfgParams * ConfigParams , errorPages errorPageDetails ,
1876
- locSnippets string , enableSnippets bool , retLocIndex int , isVSR bool , vsrName string , vsrNamespace string , vscWarnings Warnings ) routingCfg {
1898
+ locSnippets string , enableSnippets bool , retLocIndex int , isVSR bool , vsrName string , vsrNamespace string , vscWarnings Warnings ,
1899
+ ) routingCfg {
1877
1900
// Generate maps
1878
1901
var maps []version2.Map
1879
1902
@@ -2101,7 +2124,8 @@ func getNameForSourceForMatchesRouteMapFromCondition(condition conf_v1.Condition
2101
2124
}
2102
2125
2103
2126
func (vsc * virtualServerConfigurator ) generateSSLConfig (owner runtime.Object , tls * conf_v1.TLS , namespace string ,
2104
- secretRefs map [string ]* secrets.SecretReference , cfgParams * ConfigParams ) * version2.SSL {
2127
+ secretRefs map [string ]* secrets.SecretReference , cfgParams * ConfigParams ,
2128
+ ) * version2.SSL {
2105
2129
if tls == nil {
2106
2130
return nil
2107
2131
}
0 commit comments