Documentation
¶
Overview ¶
Package resolver turns the cluster's WAF objects into bundle policies (0004 §4.5): each WAFPolicy's targets are expanded into concrete host / path matches, its rule sets resolved, and conflicts between policies settled. It is pure: the same objects always give the same result.
A policy that can't be resolved (a missing rule set, rules that don't compile, a conflict) keeps the version it has in the previous bundle, so a bad edit never removes or weakens protection already in force; a policy that was never resolved is left out until it is fixed. Its Accepted condition says why.
Index ¶
Constants ¶
const ( ReasonAccepted = "Accepted" ReasonInvalidRef = "InvalidRef" ReasonConflict = "Conflict" ReasonRuleCompileError = "RuleCompileError" ReasonTargetUnsupported = "TargetUnsupported" )
Condition reasons for Accepted.
const PolicyValid = "the policy is valid"
PolicyValid is the Accepted message of a policy that resolved with nothing to report.
const RulesLabel = "waf.inkwall.dev/rules"
RulesLabel must be set to "true" on a ConfigMap a rule set reads rules from: the operator only watches labeled ConfigMaps.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Input ¶
type Input struct {
Policies []wafv1alpha1.WAFPolicy
Ingresses []networkingv1.Ingress
// IngressRoutes are Traefik's (traefik.io/v1alpha1); none when its
// CRD isn't installed.
IngressRoutes []unstructured.Unstructured
// HTTPRoutes are Gateway API's; none when its CRDs aren't installed.
HTTPRoutes []gatewayv1.HTTPRoute
// VirtualServices are Istio's (networking.istio.io); none when its
// CRD isn't installed.
VirtualServices []unstructured.Unstructured
RuleSets []wafv1alpha1.WAFRuleSet
ClusterRuleSets []wafv1alpha1.ClusterWAFRuleSet
// IPLists are the WAFIPLists policies name in spec.ipLists.
IPLists []wafv1alpha1.WAFIPList
// ConfigMaps rule sets read rules from (labeled RulesLabel).
ConfigMaps []corev1.ConfigMap
// Previous is the bundle in force; nil when there is none.
Previous *bundlev1.Bundle
// CheckRules checks SecLang read from a ConfigMap
// (coraza.CheckUserRules); inline rules were checked at admission.
CheckRules func(string) error
}
Input is the cluster state to resolve.
type Result ¶
type Result struct {
// Policies sorted by id; RuleSets are the ones they use, sorted by id.
Policies []*bundlev1.Policy
RuleSets []*bundlev1.RuleSet
// PolicyStatus is keyed by the WAFPolicy.
PolicyStatus map[types.NamespacedName]Status
// RuleSetStatus is keyed by RuleSet id (RuleSetID), for every rule set.
RuleSetStatus map[string]Status
}
Result is what goes into the bundle, and the status of each object.