KubeArmor: Visibility logs with `Result: Unknown error` for network operations
Bug Report
General Information
- Environment description (GKE, VM-Kubeadm, vagrant-dev-env, minikube, microk8s, …) - any
- Kernel version (run
uname -a
) - 5.15.0-46-generic - Orchestration system version in use (e.g.
kubectl version
, …) - 1.23.17 - Link to relevant artifacts (policies, deployments scripts, …) - NA
- Target containers/pods - NA
To Reproduce
- Deploy kubearmor
- Deploy multiubuntu (or any other server of your choice).
- Try to see
Network
operation logs usingkarmor logs --logFilter=all --operation=Network
. - Exec into one of the ubuntu containers and try to
curl localhost:8000
which would create aTCP_ACCEPT
syscall by the running python server - You’ll find a log with
Result: Unknown error
in logs even though the request passes.
Expected behavior
The log should have Result: Passed
instead.
Logs
{
"Timestamp": 1678430968,
"UpdatedTime": "2023-03-10T06:49:28.840099Z",
"ClusterName": "default",
"HostName": "kubearmor-dev-next",
"NamespaceName": "multiubuntu",
"PodName": "ubuntu-1-deployment-5bd4dff469-fwn2v",
"Labels": "container=ubuntu-1,group=group-1",
"ContainerID": "1584076e2121453ceae9de662c834d73c6bd9a2357432d77bf9527d441b00c13",
"ContainerName": "ubuntu-1-container",
"ContainerImage": "docker.io/kubearmor/ubuntu-w-utils:0.1@sha256:b4693b003ed1fbf7f5ef2c8b9b3f96fd853c30e1b39549cf98bd772fbd99e260",
"ParentProcessName": "/bin/bash",
"ProcessName": "/usr/bin/python2.7",
"HostPPID": 8858,
"HostPID": 8962,
"PPID": 1,
"PID": 7,
"Type": "ContainerLog",
"Source": "/usr/bin/python2.7",
"Operation": "Network",
"Resource": "remoteip=127.0.0.1 port=8000 protocol=TCP",
"Data": "kprobe=tcp_accept domain=AF_INET",
"Result": "Unknown error"
}
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 24 (24 by maintainers)
/assign
I know nothing about ebpf,Please ask @stefin9898 to help solve this problem.I hope my previous comments can help you.
I try exec
curl localhost:8000
at multiubuntu pod inside,but get tcp_connect and passed result.For this very big retva number I found some regularity. If you convert them to binary, they have 48 bits, the first 16 bits are same.I am not familar with BPF and the c code.So it’s hard for me to solve the problem single. I found the code about accopt, found
context.retval = PT_REGS_RC(ctx);
,retval is set byPT_REGS_RC(ctx)
func ,but I not found the PT_REGS_RC func info, so could you please give me some help for the c code and BPF. @DelusionalOptimist code in system_monitor.cThank you for your suggestion,i will try it now.
yes sure, I will first try to see what happens in my system.