-
Notifications
You must be signed in to change notification settings - Fork 85
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
extending filtering options for karmor #40
Comments
Hi @nyrahul, I was going through the existing code and it seems that some commands like |
Handling In general, the task at hand is to enable filtering options based on json fields supported and pass this filtering option to the server so that they can be filtered on the kubearmor server itself. (This also means code changes in the base kubearmor code). (This seems to be a good point to discuss during our next community call.) Attaching sample telemetry herewith: {
"Timestamp": 1643954983,
"UpdatedTime": "2022-02-04T06:09:43.832838Z",
"ClusterName": "default",
"HostName": "ubuntu2004-vagrants",
"NamespaceName": "explorer",
"PodName": "mysql-0",
"ContainerID": "bddbbdb1c00c2092d8b47f3284624cc22e678934d026f300780ee282979e7094",
"ContainerName": "mysql",
"HostPID": 934399,
"PPID": 934391,
"PID": 177937,
"UID": 1001,
"Type": "ContainerLog",
"Source": "/opt/bitnami/mysql/bin/mysqladmin status -uroot -ppassword",
"Operation": "File",
"Resource": "/lib/x86_64-linux-gnu/libnss_files-2.28.so",
"Data": "syscall=SYS_OPENAT fd=-100 flags=/lib/x86_64-linux-gnu/libnss_files.so.2",
"Result": "Passed"
}
{
"Timestamp": 1643954983,
"UpdatedTime": "2022-02-04T06:09:43.832856Z",
"ClusterName": "default",
"HostName": "ubuntu2004-vagrants",
"NamespaceName": "explorer",
"PodName": "mysql-0",
"ContainerID": "bddbbdb1c00c2092d8b47f3284624cc22e678934d026f300780ee282979e7094",
"ContainerName": "mysql",
"HostPID": 934399,
"PPID": 934391,
"PID": 177937,
"UID": 1001,
"Type": "ContainerLog",
"Source": "/opt/bitnami/mysql/bin/mysqladmin status -uroot -ppassword",
"Operation": "File",
"Resource": "/opt/bitnami/mysql/conf/my.cnf",
"Data": "syscall=SYS_OPENAT fd=-100 flags=/opt/bitnami/mysql/conf/my.cnf",
"Result": "Passed"
}
{
"Timestamp": 1643954983,
"UpdatedTime": "2022-02-04T06:09:43.832878Z",
"ClusterName": "default",
"HostName": "ubuntu2004-vagrants",
"NamespaceName": "explorer",
"PodName": "mysql-0",
"ContainerID": "bddbbdb1c00c2092d8b47f3284624cc22e678934d026f300780ee282979e7094",
"ContainerName": "mysql",
"HostPID": 934399,
"PPID": 934391,
"PID": 177937,
"UID": 1001,
"Type": "ContainerLog",
"Source": "/opt/bitnami/mysql/bin/mysqladmin status -uroot -ppassword",
"Operation": "Network",
"Resource": "domain=AF_UNIX type=SOCK_STREAM protocol=0",
"Data": "syscall=SYS_SOCKET",
"Result": "Passed"
}
{
"Timestamp": 1643954983,
"UpdatedTime": "2022-02-04T06:09:43.832901Z",
"ClusterName": "default",
"HostName": "ubuntu2004-vagrants",
"NamespaceName": "explorer",
"PodName": "mysql-0",
"ContainerID": "bddbbdb1c00c2092d8b47f3284624cc22e678934d026f300780ee282979e7094",
"ContainerName": "mysql",
"HostPID": 934399,
"PPID": 934391,
"PID": 177937,
"UID": 1001,
"Type": "ContainerLog",
"Source": "/opt/bitnami/mysql/bin/mysqladmin status -uroot -ppassword",
"Operation": "Network",
"Resource": "sa_family=AF_UNIX sun_path=/opt/bitnami/mysql/tmp/mysql.sock",
"Data": "syscall=SYS_CONNECT fd=3",
"Result": "Passed"
}
{
"Timestamp": 1643954983,
"UpdatedTime": "2022-02-04T06:09:43.832925Z",
"ClusterName": "default",
"HostName": "ubuntu2004-vagrants",
"NamespaceName": "explorer",
"PodName": "mysql-0",
"ContainerID": "bddbbdb1c00c2092d8b47f3284624cc22e678934d026f300780ee282979e7094",
"ContainerName": "mysql",
"HostPID": 45821,
"PPID": 45667,
"PID": 1,
"UID": 1001,
"Type": "ContainerLog",
"Source": "mysqld",
"Operation": "Network",
"Resource": "sa_family=AF_UNIX sun_path=\n",
"Data": "syscall=SYS_ACCEPT fd=25",
"Result": "Passed"
}
{
"Timestamp": 1643954987,
"UpdatedTime": "2022-02-04T06:09:47.006139Z",
"ClusterName": "default",
"HostName": "ubuntu2004-vagrants",
"NamespaceName": "explorer",
"PodName": "knoxautopolicy-684854b4f4-s7vxm",
"ContainerID": "47143ff0f01752aec2d98d376cbee668e365de4a37629fa83876397614bf4ce2",
"ContainerName": "knoxautopolicy",
"HostPID": 48560,
"PPID": 48478,
"PID": 1,
"Type": "ContainerLog",
"Source": "knoxAutoPolicy",
"Operation": "File",
"Resource": "/run/secrets/kubernetes.io/serviceaccount/..2022_02_04_05_24_40.153181384/token",
"Data": "syscall=SYS_OPENAT fd=-100 flags=/var/run/secrets/kubernetes.io/serviceaccount/token",
"Result": "Passed"
} |
/assign |
Hey @slayer321, There's a pull request in KubeArmor - kubearmor/KubeArmor#683 to support Labels field in telemetry. This should ease things out implementing the labels filter here. Wdyt? |
Following filtering options are needed with karmor:
--since=1h
--namespace=default
--log=hostlog/containerlog
--operation=process/file/network
--limit=n
... where n is a positive integer-l | --selector
): E.g.karmor log --logFilter all --json --selector "app: checkoutservice,name=xyz" --selector "app: emailservice"
... Check if we can use the regex filters as well.Sample:
Syntax should be similar to k8s kubectl syntax where ever applicable.
Label filter
karmor log --logFilter all --json --selector "app: checkoutservice,name=xyz" --selector "app: emailservice"
if multiple
--selector | -l
options are present they should be considered asor
clause.The text was updated successfully, but these errors were encountered: