-
Notifications
You must be signed in to change notification settings - Fork 3
CNAPP-24034 Kong #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
CNAPP-24034 Kong #23
Conversation
Fix race condition nginx
…ller-issues Fix nginx ingress controller issues
Add buffer for channel
Enhance helm hooks and add readme
Signed-off-by: avithe-great <avinash.maurya@accuknox.com>
updated proto for sentryflow
…add sentryflow changes and github actions Fix unit tests and add unit tests for gateway Fix typo in values
…io-gateway-receiver FEAT: CNAPP-23269 Add wasm-plugin support for istio-ingressgateway ,…
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
docs/kong-integration.md
Outdated
| Deploy SentryFlow with Kong receiver enabled. | ||
|
|
||
| ```shell | ||
| helm upgrade --install sentryflow \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change this to install an actual helm chart from ECR. We can update this section after we merge and create a new release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| sidecarTag: {{ .Values.config.receivers.istio.sidecarTag | default "latest-sidecar" }} | ||
| {{- end }} | ||
| {{- if .Values.config.receivers.kongGateway.enabled }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also update the default.yaml config and comment the configs out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please explain this more
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theres a file called default.yaml where we need to update this
sentryflow/pkg/core/server.go
Outdated
| return | ||
| } | ||
|
|
||
| m.Logger.Infof("Received API Event from %s", apiEvent.Metadata.ReceiverName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please change this to a debug log
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
docs/kong-integration.md
Outdated
| **Create ConfigMap from plugin files:** | ||
|
|
||
| ```shell | ||
| # Create ConfigMap |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package these lua files with helm. Have helm create config map with these files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
| }, | ||
| response = { | ||
| headers = res_headers, | ||
| body = "", -- Response body capture requires buffering |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do need the body regardless. We can have a limit of say 1mb and capture the body
| }, | ||
| request = { | ||
| headers = req_headers, | ||
| body = "", -- Kong doesn't easily provide request body in log phase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we tap into a different phase in that case? We need the body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i have updated it to capture using kong.request.get_raw_body() and kong.service.response.get_raw_body().
| headers = res_headers, | ||
| body = "", -- Response body capture requires buffering | ||
| }, | ||
| protocol = var.server_protocol or "HTTP/1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will almost never be empty. But even if it is we cannot assume it will be "HTTP/1.1". Could you please confirm this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have changed the default protocol fallback to an empty string instead of "HTTP/1.1".
| fields = { | ||
| { http_endpoint = typedefs.url({ | ||
| required = true, | ||
| description = "SentryFlow HTTP endpoint URL (e.g., http://sentryflow.sentryflow:8081/api/v1/events)" -- { sentryflow.sentryflow is default name of sentryflow deployment.namespace update if its different for the setup} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be configured through helm install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Signed-off-by: Sanskarzz <sanskar.gur@gmail.com>
Description
Kong Gateway Integration with SentryFlow
This guide describes how to integrate Kong Gateway with SentryFlow for API security monitoring.
Steps
1. Install Kong Gateway
helm repo add kong https://charts.konghq.com helm repo update # Install Kong with default settings (CRDs disabled for kind if preferred) helm install kong kong/kong \ --namespace kong \ --create-namespace \ --set ingressController.installCRDs=false \ --set admin.enabled=true \ --set admin.type=NodePort2. Install SentryFlow Custom Plugin
We need to mount the
sentryflow-logplugin into the Kong proxy container.Create ConfigMap from plugin files:
# Create ConfigMap kubectl create configmap sentryflow-log-plugin \ --from-file=handler.lua=filter/kong/sentryflow-log/handler.lua \ --from-file=schema.lua=filter/kong/sentryflow-log/schema.lua \ -n kongPatch Kong Deployment:
Mount the plugin into the proxy container (usually index 1) and the ingress-controller (index 0).
3. Deploy SentryFlow
Deploy SentryFlow with Kong receiver enabled.
4. Enable sentryflow-log Plugin Globally
Create a
KongClusterPluginto enable logging for all routes.5. Patch Discovery Engine
Update the discovery-engine ConfigMap (
discovery-engine-sumengine) to use SentryFlow and restart the deployment.Verification Guide
1. Deploy Sample Application
Deploy the Google Microservices Demo
frontendservice (or any HTTP service).# Verify frontend service exists kubectl get svc2. Create Ingress Resource
Create an Ingress to route traffic through Kong to your service.
3. Generate Traffic
Port-forward the Kong proxy and send requests.
4. Verify SentryFlow Logs
Check SentryFlow logs to confirm it received the events.
You should see logs indicating receipt of events:
Related ticket CNAPP-24034