Documentation
¶
Overview ¶
Package v1alpha1 holds the Inkwall Kubernetes API (group waf.inkwall.dev): the cluster configuration, the policies app teams attach to their routes, and the rule sets those policies use. Design: docs/design/0002 §4.2 and docs/design/0004 §3.
+kubebuilder:object:generate=true +groupName=waf.inkwall.dev
Index ¶
- Constants
- Variables
- type AdapterKind
- type BodySpec
- type BootstrapMode
- type BuiltinRuleSet
- type ClusterMode
- type ClusterRuleSetSource
- type ClusterWAFRuleSet
- type ClusterWAFRuleSetList
- type ClusterWAFRuleSetSpec
- type ConfigMapKeyRef
- type ControlPlane
- type EngineSpec
- type Exclusion
- type ExclusionMatch
- type FailureMode
- type InkwallConfig
- type InkwallConfigList
- type InkwallConfigSpec
- type InkwallConfigStatus
- type IntegrationSpec
- type NamespacedConfigMapKeyRef
- type OversizeAction
- type PathPattern
- type PolicyMode
- type RuleSetBinding
- type RuleSetRef
- type RuleSetSource
- type RuleSetStatus
- type SecretReference
- type SkipSpec
- type TargetRef
- type WAFPolicy
- type WAFPolicyList
- type WAFPolicySpec
- type WAFPolicyStatus
- type WAFRuleSet
- type WAFRuleSetList
- type WAFRuleSetSpec
Constants ¶
const ( // ConditionAccepted is True when the spec is valid and its references // resolve. ConditionAccepted = "Accepted" // ConditionProgrammed is True when every targeted route's proxy sends // traffic to Inkwall. ConditionProgrammed = "Programmed" // ConditionEnforced is True when every engine serving the targets has // applied a bundle containing the current generation. ConditionEnforced = "Enforced" // ConditionReady is True when Accepted, Programmed and Enforced are. ConditionReady = "Ready" )
Condition types. Every WAFPolicy reports all four (0004 §3.2); the other kinds report Accepted.
Variables ¶
var ( // GroupVersion is the API group and version of these types. GroupVersion = schema.GroupVersion{Group: "waf.inkwall.dev", Version: "v1alpha1"} // SchemeBuilder registers the types with a runtime.Scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) // AddToScheme adds the types to a runtime.Scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
This section is empty.
Types ¶
type AdapterKind ¶
type AdapterKind string
AdapterKind is how a proxy hands requests to the engine (0006). +kubebuilder:validation:Enum=ExtProc;ExtAuthz;LuaPlugin;AuthURL;ForwardAuth;SPOE;Module
const ( AdapterExtProc AdapterKind = "ExtProc" AdapterExtAuthz AdapterKind = "ExtAuthz" AdapterLuaPlugin AdapterKind = "LuaPlugin" AdapterAuthURL AdapterKind = "AuthURL" AdapterForwardAuth AdapterKind = "ForwardAuth" AdapterSPOE AdapterKind = "SPOE" AdapterModule AdapterKind = "Module" )
The adapter kinds.
type BodySpec ¶
type BodySpec struct {
// Inspect turns body inspection on or off.
// +kubebuilder:default=true
// +optional
Inspect *bool `json:"inspect,omitempty"`
// MaxBytes is how much of a body is inspected, at most 10 MiB. Unset:
// the engine's default (64 KiB).
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=10485760
// +optional
MaxBytes *int64 `json:"maxBytes,omitempty"`
// OnOversize is what happens to a body over maxBytes: Deny (413 in
// Block mode) or Allow (forwarded uninspected, and logged). Unset: Deny
// in Block mode, Allow in Detect mode.
// +optional
OnOversize OversizeAction `json:"onOversize,omitempty"`
}
BodySpec configures request body inspection.
func (*BodySpec) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BodySpec.
func (*BodySpec) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type BootstrapMode ¶
type BootstrapMode string
BootstrapMode is what an engine does with requests before it has a policy bundle (0004 §4.6). +kubebuilder:validation:Enum=AllowAll;DenyAll
const ( // BootstrapAllowAll lets requests through uninspected: availability // first. BootstrapAllowAll BootstrapMode = "AllowAll" // BootstrapDenyAll rejects them with 503. BootstrapDenyAll BootstrapMode = "DenyAll" )
The bootstrap modes.
type BuiltinRuleSet ¶
type BuiltinRuleSet string
BuiltinRuleSet names a rule set shipped inside the engine image, pinned to the engine's version. +kubebuilder:validation:Enum=crs-v4
const BuiltinCRSv4 BuiltinRuleSet = "crs-v4"
BuiltinCRSv4 is the OWASP Core Rule Set v4.
type ClusterMode ¶
type ClusterMode string
ClusterMode is where a cluster's policy comes from (0002 §4.1). +kubebuilder:validation:Enum=Standalone;GitOps;Managed
const ( // ModeStandalone takes policy from the CRDs, with no control plane. ModeStandalone ClusterMode = "Standalone" // ModeGitOps takes policy from the CRDs and mirrors it, read-only, to // the control plane. ModeGitOps ClusterMode = "GitOps" // ModeManaged takes policy from the control plane, which the operator // writes as CRDs; edits by anyone else are rejected. ModeManaged ClusterMode = "Managed" )
type ClusterRuleSetSource ¶
type ClusterRuleSetSource struct {
// Builtin is a rule set shipped in the engine image.
// +optional
Builtin BuiltinRuleSet `json:"builtin,omitempty"`
// SecLang holds the rules inline, at most 256 KiB.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=262144
// +optional
SecLang string `json:"seclang,omitempty"`
// ConfigMapRef reads the rules from a ConfigMap.
// +optional
ConfigMapRef *NamespacedConfigMapKeyRef `json:"configMapRef,omitempty"`
}
ClusterRuleSetSource is where a ClusterWAFRuleSet's rules come from: exactly one of builtin, seclang or configMapRef. +kubebuilder:validation:XValidation:rule="[has(self.builtin), has(self.seclang), has(self.configMapRef)].filter(x, x).size() == 1",message="set exactly one of builtin, seclang or configMapRef"
func (*ClusterRuleSetSource) DeepCopy ¶
func (in *ClusterRuleSetSource) DeepCopy() *ClusterRuleSetSource
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterRuleSetSource.
func (*ClusterRuleSetSource) DeepCopyInto ¶
func (in *ClusterRuleSetSource) DeepCopyInto(out *ClusterRuleSetSource)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ClusterWAFRuleSet ¶
type ClusterWAFRuleSet struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ClusterWAFRuleSetSpec `json:"spec"`
// +optional
Status RuleSetStatus `json:"status,omitempty"`
}
ClusterWAFRuleSet is a set of rules that policies in any namespace can use.
+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=inkwall,shortName=cwafrs +kubebuilder:printcolumn:name="Builtin",type=string,JSONPath=`.spec.source.builtin` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
func (*ClusterWAFRuleSet) DeepCopy ¶
func (in *ClusterWAFRuleSet) DeepCopy() *ClusterWAFRuleSet
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterWAFRuleSet.
func (*ClusterWAFRuleSet) DeepCopyInto ¶
func (in *ClusterWAFRuleSet) DeepCopyInto(out *ClusterWAFRuleSet)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ClusterWAFRuleSet) DeepCopyObject ¶
func (in *ClusterWAFRuleSet) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ClusterWAFRuleSetList ¶
type ClusterWAFRuleSetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterWAFRuleSet `json:"items"`
}
ClusterWAFRuleSetList is a list of ClusterWAFRuleSet.
+kubebuilder:object:root=true
func (*ClusterWAFRuleSetList) DeepCopy ¶
func (in *ClusterWAFRuleSetList) DeepCopy() *ClusterWAFRuleSetList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterWAFRuleSetList.
func (*ClusterWAFRuleSetList) DeepCopyInto ¶
func (in *ClusterWAFRuleSetList) DeepCopyInto(out *ClusterWAFRuleSetList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ClusterWAFRuleSetList) DeepCopyObject ¶
func (in *ClusterWAFRuleSetList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ClusterWAFRuleSetSpec ¶
type ClusterWAFRuleSetSpec struct {
// Source of the rules.
Source ClusterRuleSetSource `json:"source"`
}
ClusterWAFRuleSetSpec defines a cluster-wide rule set.
func (*ClusterWAFRuleSetSpec) DeepCopy ¶
func (in *ClusterWAFRuleSetSpec) DeepCopy() *ClusterWAFRuleSetSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ClusterWAFRuleSetSpec.
func (*ClusterWAFRuleSetSpec) DeepCopyInto ¶
func (in *ClusterWAFRuleSetSpec) DeepCopyInto(out *ClusterWAFRuleSetSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ConfigMapKeyRef ¶
type ConfigMapKeyRef struct {
// Name of the ConfigMap.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name"`
// Key holding the SecLang rules.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Key string `json:"key"`
}
ConfigMapKeyRef names a key of a ConfigMap in the rule set's namespace.
func (*ConfigMapKeyRef) DeepCopy ¶
func (in *ConfigMapKeyRef) DeepCopy() *ConfigMapKeyRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConfigMapKeyRef.
func (*ConfigMapKeyRef) DeepCopyInto ¶
func (in *ConfigMapKeyRef) DeepCopyInto(out *ConfigMapKeyRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ControlPlane ¶
type ControlPlane struct {
// Endpoint is the control plane's gRPC address, as grpcs://host:port.
// +kubebuilder:validation:Pattern=`^grpcs://[^/\s]+$`
// +kubebuilder:validation:MaxLength=512
Endpoint string `json:"endpoint"`
// EnrollmentSecretRef is the Secret holding the enrollment token.
EnrollmentSecretRef SecretReference `json:"enrollmentSecretRef"`
}
ControlPlane is the connection to the optional control plane.
func (*ControlPlane) DeepCopy ¶
func (in *ControlPlane) DeepCopy() *ControlPlane
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ControlPlane.
func (*ControlPlane) DeepCopyInto ¶
func (in *ControlPlane) DeepCopyInto(out *ControlPlane)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type EngineSpec ¶
type EngineSpec struct {
// Image is the engine image. Empty means the image released with this
// operator version.
// +kubebuilder:validation:MaxLength=512
// +optional
Image string `json:"image,omitempty"`
// Resources of the engine container. Setting no CPU limit is
// recommended: CPU throttling shows up as tail latency on every request.
// +optional
Resources *corev1.ResourceRequirements `json:"resources,omitempty"`
// SocketDir is the directory, shared with the proxy container, that
// holds the engine's Unix sockets.
// +kubebuilder:default="/var/run/inkwall"
// +kubebuilder:validation:MaxLength=64
// +kubebuilder:validation:XValidation:rule="self.startsWith('/')",message="socketDir must be an absolute path"
// +optional
SocketDir string `json:"socketDir,omitempty"`
// BootstrapMode is what a new engine does with requests when it has no
// bundle yet: no cached bundle, the bundle Secret unreadable and the
// operator unreachable. It waits up to 10 seconds for one before its
// proxy takes traffic, then allows (AllowAll) or rejects (DenyAll) the
// requests until a bundle arrives. Applies to pods injected from then
// on.
// +kubebuilder:default=AllowAll
// +optional
BootstrapMode BootstrapMode `json:"bootstrapMode,omitempty"`
}
EngineSpec configures the engine sidecars.
func (*EngineSpec) DeepCopy ¶
func (in *EngineSpec) DeepCopy() *EngineSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EngineSpec.
func (*EngineSpec) DeepCopyInto ¶
func (in *EngineSpec) DeepCopyInto(out *EngineSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type Exclusion ¶
type Exclusion struct {
// RuleIDs are the rules to turn off.
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=64
// +kubebuilder:validation:items:Minimum=1
RuleIDs []int32 `json:"ruleIDs"`
// When narrows the exclusion. Unset: the rules are off for every request
// this policy covers.
// +optional
When *ExclusionMatch `json:"when,omitempty"`
}
Exclusion turns rules off, everywhere or only for one path or argument.
func (*Exclusion) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Exclusion.
func (*Exclusion) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ExclusionMatch ¶
type ExclusionMatch struct {
// Path the exclusion applies to.
// +optional
Path PathPattern `json:"path,omitempty"`
// Argument is a query or body argument the rules stop looking at.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=256
// +kubebuilder:validation:Pattern=`^[A-Za-z0-9_.\-\[\]]+$`
// +optional
Argument string `json:"argument,omitempty"`
}
ExclusionMatch narrows an exclusion to a path, an argument, or both. +kubebuilder:validation:XValidation:rule="has(self.path) || has(self.argument)",message="when needs a path, an argument, or both"
func (*ExclusionMatch) DeepCopy ¶
func (in *ExclusionMatch) DeepCopy() *ExclusionMatch
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ExclusionMatch.
func (*ExclusionMatch) DeepCopyInto ¶
func (in *ExclusionMatch) DeepCopyInto(out *ExclusionMatch)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type FailureMode ¶
type FailureMode string
FailureMode is what happens to a request that can't be inspected in time (timeout, error, overload). +kubebuilder:validation:Enum=Open;Closed
const ( // FailOpen lets the request through uninspected. FailOpen FailureMode = "Open" // FailClosed rejects the request with 503. FailClosed FailureMode = "Closed" )
type InkwallConfig ¶
type InkwallConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec InkwallConfigSpec `json:"spec,omitempty"`
// +optional
Status InkwallConfigStatus `json:"status,omitempty"`
}
InkwallConfig is the cluster-wide Inkwall configuration. There is one, named default.
+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:scope=Cluster,categories=inkwall +kubebuilder:validation:XValidation:rule="self.metadata.name == 'default'",message="the InkwallConfig must be named default" +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode` +kubebuilder:printcolumn:name="Suspended",type=boolean,JSONPath=`.spec.suspend` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
func (*InkwallConfig) DeepCopy ¶
func (in *InkwallConfig) DeepCopy() *InkwallConfig
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfig.
func (*InkwallConfig) DeepCopyInto ¶
func (in *InkwallConfig) DeepCopyInto(out *InkwallConfig)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*InkwallConfig) DeepCopyObject ¶
func (in *InkwallConfig) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type InkwallConfigList ¶
type InkwallConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []InkwallConfig `json:"items"`
}
InkwallConfigList is a list of InkwallConfig.
+kubebuilder:object:root=true
func (*InkwallConfigList) DeepCopy ¶
func (in *InkwallConfigList) DeepCopy() *InkwallConfigList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfigList.
func (*InkwallConfigList) DeepCopyInto ¶
func (in *InkwallConfigList) DeepCopyInto(out *InkwallConfigList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*InkwallConfigList) DeepCopyObject ¶
func (in *InkwallConfigList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type InkwallConfigSpec ¶
type InkwallConfigSpec struct {
// Mode is where policy comes from: Standalone (the CRDs), GitOps (the
// CRDs, mirrored to the control plane) or Managed (the control plane).
// +kubebuilder:default=Standalone
// +optional
Mode ClusterMode `json:"mode,omitempty"`
// ControlPlane is the control plane to connect to. Required in GitOps
// and Managed mode, ignored in Standalone.
// +optional
ControlPlane *ControlPlane `json:"controlPlane,omitempty"`
// Engine configures the engine sidecars the operator injects.
// +optional
Engine EngineSpec `json:"engine,omitempty"`
// Integrations pins how a proxy controller is wired. Controllers are
// discovered without an entry here; an entry overrides the workload
// selector or the adapter for one controller.
// +listType=map
// +listMapKey=controller
// +kubebuilder:validation:MaxItems=32
// +optional
Integrations []IntegrationSpec `json:"integrations,omitempty"`
// Suspend switches every engine to allow-all within seconds, without
// removing anything: the emergency switch (0004 §5).
// +optional
Suspend bool `json:"suspend,omitempty"`
}
InkwallConfigSpec is the cluster-wide configuration. +kubebuilder:validation:XValidation:rule="!has(self.mode) || self.mode == 'Standalone' || has(self.controlPlane)",message="controlPlane is required in GitOps and Managed mode"
func (*InkwallConfigSpec) DeepCopy ¶
func (in *InkwallConfigSpec) DeepCopy() *InkwallConfigSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfigSpec.
func (*InkwallConfigSpec) DeepCopyInto ¶
func (in *InkwallConfigSpec) DeepCopyInto(out *InkwallConfigSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type InkwallConfigStatus ¶
type InkwallConfigStatus struct {
// ObservedGeneration is the generation the status describes.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Conditions describe the configuration's state.
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
InkwallConfigStatus is the cluster view.
func (*InkwallConfigStatus) DeepCopy ¶
func (in *InkwallConfigStatus) DeepCopy() *InkwallConfigStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InkwallConfigStatus.
func (*InkwallConfigStatus) DeepCopyInto ¶
func (in *InkwallConfigStatus) DeepCopyInto(out *InkwallConfigStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type IntegrationSpec ¶
type IntegrationSpec struct {
// Controller is the integration name, such as traefik or ingress-nginx.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
Controller string `json:"controller"`
// Selector matches the controller's proxy pods, when they don't carry
// the controller's default labels. It must select by something (an
// empty selector would match every pod). The operator restarts to
// apply a change; pods already running are injected when they restart.
// +kubebuilder:validation:XValidation:rule="(has(self.matchLabels) && size(self.matchLabels) > 0) || (has(self.matchExpressions) && size(self.matchExpressions) > 0)",message="selector must not be empty: it would select every pod"
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
// Adapter is how the proxy hands requests to the engine, when the
// controller supports several.
// +optional
Adapter AdapterKind `json:"adapter,omitempty"`
}
IntegrationSpec overrides discovery for one proxy controller.
func (*IntegrationSpec) DeepCopy ¶
func (in *IntegrationSpec) DeepCopy() *IntegrationSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IntegrationSpec.
func (*IntegrationSpec) DeepCopyInto ¶
func (in *IntegrationSpec) DeepCopyInto(out *IntegrationSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type NamespacedConfigMapKeyRef ¶
type NamespacedConfigMapKeyRef struct {
ConfigMapKeyRef `json:",inline"`
// Namespace of the ConfigMap.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
Namespace string `json:"namespace"`
}
NamespacedConfigMapKeyRef names a key of a ConfigMap in any namespace.
func (*NamespacedConfigMapKeyRef) DeepCopy ¶
func (in *NamespacedConfigMapKeyRef) DeepCopy() *NamespacedConfigMapKeyRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespacedConfigMapKeyRef.
func (*NamespacedConfigMapKeyRef) DeepCopyInto ¶
func (in *NamespacedConfigMapKeyRef) DeepCopyInto(out *NamespacedConfigMapKeyRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type OversizeAction ¶
type OversizeAction string
OversizeAction is what happens to a body larger than body.maxBytes. +kubebuilder:validation:Enum=Allow;Deny
const ( // OversizeAllow forwards the request with the body uninspected, and logs // it. OversizeAllow OversizeAction = "Allow" // OversizeDeny rejects the request with 413 in Block mode. OversizeDeny OversizeAction = "Deny" )
type PathPattern ¶
type PathPattern string
PathPattern is an exact path ("/healthz") or a prefix ending in "*" ("/static/*"), using only plain ASCII path characters, as the engine matches paths (pkg/router). +kubebuilder:validation:MaxLength=1024 +kubebuilder:validation:Pattern=`^/[A-Za-z0-9._~/:@!$&'()+,=-]*\*?$`
type PolicyMode ¶
type PolicyMode string
PolicyMode is what the engine does with a request the rules flag. +kubebuilder:validation:Enum=Detect;Block
const ( // PolicyDetect logs the verdict and lets the request through. PolicyDetect PolicyMode = "Detect" // PolicyBlock rejects the request. PolicyBlock PolicyMode = "Block" )
type RuleSetBinding ¶
type RuleSetBinding struct {
// Ref is the rule set.
Ref RuleSetRef `json:"ref"`
// ParanoiaLevel is the OWASP CRS paranoia level, 1 to 4. Only used by
// the built-in CRS.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=4
// +optional
ParanoiaLevel *int32 `json:"paranoiaLevel,omitempty"`
// InboundAnomalyThreshold is the OWASP CRS anomaly score at which a
// request is flagged. Only used by the built-in CRS.
// +kubebuilder:validation:Minimum=1
// +kubebuilder:validation:Maximum=10000
// +optional
InboundAnomalyThreshold *int32 `json:"inboundAnomalyThreshold,omitempty"`
}
RuleSetBinding uses a rule set in a policy.
func (*RuleSetBinding) DeepCopy ¶
func (in *RuleSetBinding) DeepCopy() *RuleSetBinding
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetBinding.
func (*RuleSetBinding) DeepCopyInto ¶
func (in *RuleSetBinding) DeepCopyInto(out *RuleSetBinding)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RuleSetRef ¶
type RuleSetRef struct {
// Kind is WAFRuleSet or ClusterWAFRuleSet.
// +kubebuilder:validation:Enum=WAFRuleSet;ClusterWAFRuleSet
Kind string `json:"kind"`
// Name of the rule set.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name"`
// Namespace of a WAFRuleSet. Unset: the policy's namespace.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +optional
Namespace string `json:"namespace,omitempty"`
}
RuleSetRef names a WAFRuleSet or a ClusterWAFRuleSet. +kubebuilder:validation:XValidation:rule="self.kind == 'WAFRuleSet' || !has(self.__namespace__)",message="namespace is only allowed for a WAFRuleSet"
func (*RuleSetRef) DeepCopy ¶
func (in *RuleSetRef) DeepCopy() *RuleSetRef
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetRef.
func (*RuleSetRef) DeepCopyInto ¶
func (in *RuleSetRef) DeepCopyInto(out *RuleSetRef)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RuleSetSource ¶
type RuleSetSource struct {
// Builtin is a rule set shipped in the engine image.
// +optional
Builtin BuiltinRuleSet `json:"builtin,omitempty"`
// SecLang holds the rules inline, at most 256 KiB.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=262144
// +optional
SecLang string `json:"seclang,omitempty"`
// ConfigMapRef reads the rules from a ConfigMap in the rule set's
// namespace.
// +optional
ConfigMapRef *ConfigMapKeyRef `json:"configMapRef,omitempty"`
}
RuleSetSource is where a WAFRuleSet's rules come from: exactly one of builtin, seclang or configMapRef. +kubebuilder:validation:XValidation:rule="[has(self.builtin), has(self.seclang), has(self.configMapRef)].filter(x, x).size() == 1",message="set exactly one of builtin, seclang or configMapRef"
func (*RuleSetSource) DeepCopy ¶
func (in *RuleSetSource) DeepCopy() *RuleSetSource
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetSource.
func (*RuleSetSource) DeepCopyInto ¶
func (in *RuleSetSource) DeepCopyInto(out *RuleSetSource)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type RuleSetStatus ¶
type RuleSetStatus struct {
// ObservedGeneration is the generation the status describes.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Conditions describe the rule set's state.
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
RuleSetStatus reports whether a rule set is usable.
func (*RuleSetStatus) DeepCopy ¶
func (in *RuleSetStatus) DeepCopy() *RuleSetStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RuleSetStatus.
func (*RuleSetStatus) DeepCopyInto ¶
func (in *RuleSetStatus) DeepCopyInto(out *RuleSetStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SecretReference ¶
type SecretReference struct {
// Name of the Secret.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name"`
// Namespace of the Secret.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
Namespace string `json:"namespace"`
}
SecretReference names a Secret in a given namespace.
func (*SecretReference) DeepCopy ¶
func (in *SecretReference) DeepCopy() *SecretReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SecretReference.
func (*SecretReference) DeepCopyInto ¶
func (in *SecretReference) DeepCopyInto(out *SecretReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type SkipSpec ¶
type SkipSpec struct {
// Paths that are never inspected.
// +kubebuilder:validation:MaxItems=64
// +optional
Paths []PathPattern `json:"paths,omitempty"`
// BodyPaths are paths whose body is not inspected; their headers and URI
// still are.
// +kubebuilder:validation:MaxItems=64
// +optional
BodyPaths []PathPattern `json:"bodyPaths,omitempty"`
}
SkipSpec lists requests that are never inspected.
func (*SkipSpec) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SkipSpec.
func (*SkipSpec) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type TargetRef ¶
type TargetRef struct {
// Group of the target: networking.k8s.io (the default, for Ingress) or
// gateway.networking.k8s.io (for HTTPRoute).
// +kubebuilder:validation:MaxLength=253
// +optional
Group string `json:"group,omitempty"`
// Kind of the target: Ingress or HTTPRoute.
// +kubebuilder:validation:Enum=Ingress;HTTPRoute
Kind string `json:"kind"`
// Name of the target.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name"`
// SectionName narrows an HTTPRoute target to one named rule.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +optional
SectionName string `json:"sectionName,omitempty"`
}
TargetRef names a route in the policy's namespace. +kubebuilder:validation:XValidation:rule="(self.kind == 'Ingress' && (!has(self.group) || self.group == 'networking.k8s.io')) || (self.kind == 'HTTPRoute' && has(self.group) && self.group == 'gateway.networking.k8s.io')",message="target must be a networking.k8s.io Ingress or a gateway.networking.k8s.io HTTPRoute" +kubebuilder:validation:XValidation:rule="!has(self.sectionName) || self.kind == 'HTTPRoute'",message="sectionName is only allowed for an HTTPRoute"
func (*TargetRef) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TargetRef.
func (*TargetRef) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type WAFPolicy ¶
type WAFPolicy struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec WAFPolicySpec `json:"spec"`
// +optional
Status WAFPolicyStatus `json:"status,omitempty"`
}
WAFPolicy protects routes: which rules run, in which mode, and what happens when inspection fails.
+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=inkwall,shortName=wafp +kubebuilder:printcolumn:name="Mode",type=string,JSONPath=`.spec.mode` +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status` +kubebuilder:printcolumn:name="Bundle",type=integer,JSONPath=`.status.bundleVersion` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
func (*WAFPolicy) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicy.
func (*WAFPolicy) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*WAFPolicy) DeepCopyObject ¶
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type WAFPolicyList ¶
type WAFPolicyList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []WAFPolicy `json:"items"`
}
WAFPolicyList is a list of WAFPolicy.
+kubebuilder:object:root=true
func (*WAFPolicyList) DeepCopy ¶
func (in *WAFPolicyList) DeepCopy() *WAFPolicyList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicyList.
func (*WAFPolicyList) DeepCopyInto ¶
func (in *WAFPolicyList) DeepCopyInto(out *WAFPolicyList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*WAFPolicyList) DeepCopyObject ¶
func (in *WAFPolicyList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type WAFPolicySpec ¶
type WAFPolicySpec struct {
// TargetRefs are the routes this policy protects, in the policy's
// namespace.
// +kubebuilder:validation:MinItems=1
// +kubebuilder:validation:MaxItems=16
// +kubebuilder:validation:XValidation:rule="self.all(a, self.exists_one(b, b.kind == a.kind && b.name == a.name && (has(b.sectionName) ? b.sectionName : ”) == (has(a.sectionName) ? a.sectionName : ”)))",message="targetRefs must not repeat a target"
TargetRefs []TargetRef `json:"targetRefs"`
// Mode is Detect (log, let through) or Block (reject).
// +kubebuilder:default=Detect
// +optional
Mode PolicyMode `json:"mode,omitempty"`
// FailureMode is what happens to a request that can't be inspected in
// time. Unset: Closed in Block mode, Open in Detect mode.
// +optional
FailureMode FailureMode `json:"failureMode,omitempty"`
// Timeout is the inspection deadline per request, at most 1s. Unset:
// the engine's default (250ms).
// +kubebuilder:validation:XValidation:rule="duration(self) > duration('0s') && duration(self) <= duration('1s')",message="timeout must be more than 0s and at most 1s"
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty"`
// Skip lists requests that are never inspected.
// +optional
Skip *SkipSpec `json:"skip,omitempty"`
// RuleSets are the rules to run, in order. Empty: the built-in OWASP CRS
// with its default paranoia level and threshold.
// +kubebuilder:validation:MaxItems=8
// +optional
RuleSets []RuleSetBinding `json:"ruleSets,omitempty"`
// Exclusions turn rules off where they cause false positives.
// +kubebuilder:validation:MaxItems=128
// +optional
Exclusions []Exclusion `json:"exclusions,omitempty"`
// Body configures request body inspection.
// +optional
Body *BodySpec `json:"body,omitempty"`
}
WAFPolicySpec is what to enforce on which routes.
func (*WAFPolicySpec) DeepCopy ¶
func (in *WAFPolicySpec) DeepCopy() *WAFPolicySpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicySpec.
func (*WAFPolicySpec) DeepCopyInto ¶
func (in *WAFPolicySpec) DeepCopyInto(out *WAFPolicySpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type WAFPolicyStatus ¶
type WAFPolicyStatus struct {
// ObservedGeneration is the generation the status describes.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// BundleVersion is the newest bundle that contains this generation.
// +optional
BundleVersion int64 `json:"bundleVersion,omitempty"`
// Conditions are Accepted, Programmed, Enforced and Ready.
// +listType=map
// +listMapKey=type
// +optional
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
WAFPolicyStatus reports how far the policy got: accepted, programmed into the proxy, enforced by every engine (0004 §3.2).
func (*WAFPolicyStatus) DeepCopy ¶
func (in *WAFPolicyStatus) DeepCopy() *WAFPolicyStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFPolicyStatus.
func (*WAFPolicyStatus) DeepCopyInto ¶
func (in *WAFPolicyStatus) DeepCopyInto(out *WAFPolicyStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type WAFRuleSet ¶
type WAFRuleSet struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec WAFRuleSetSpec `json:"spec"`
// +optional
Status RuleSetStatus `json:"status,omitempty"`
}
WAFRuleSet is a set of rules that policies in its namespace can use.
+kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:categories=inkwall,shortName=wafrs +kubebuilder:printcolumn:name="Builtin",type=string,JSONPath=`.spec.source.builtin` +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
func (*WAFRuleSet) DeepCopy ¶
func (in *WAFRuleSet) DeepCopy() *WAFRuleSet
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFRuleSet.
func (*WAFRuleSet) DeepCopyInto ¶
func (in *WAFRuleSet) DeepCopyInto(out *WAFRuleSet)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*WAFRuleSet) DeepCopyObject ¶
func (in *WAFRuleSet) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type WAFRuleSetList ¶
type WAFRuleSetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []WAFRuleSet `json:"items"`
}
WAFRuleSetList is a list of WAFRuleSet.
+kubebuilder:object:root=true
func (*WAFRuleSetList) DeepCopy ¶
func (in *WAFRuleSetList) DeepCopy() *WAFRuleSetList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFRuleSetList.
func (*WAFRuleSetList) DeepCopyInto ¶
func (in *WAFRuleSetList) DeepCopyInto(out *WAFRuleSetList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*WAFRuleSetList) DeepCopyObject ¶
func (in *WAFRuleSetList) DeepCopyObject() runtime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type WAFRuleSetSpec ¶
type WAFRuleSetSpec struct {
// Source of the rules.
Source RuleSetSource `json:"source"`
}
WAFRuleSetSpec defines a namespaced rule set.
func (*WAFRuleSetSpec) DeepCopy ¶
func (in *WAFRuleSetSpec) DeepCopy() *WAFRuleSetSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WAFRuleSetSpec.
func (*WAFRuleSetSpec) DeepCopyInto ¶
func (in *WAFRuleSetSpec) DeepCopyInto(out *WAFRuleSetSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.