Falco 输出 aws 实例元数据
Falco output aws instance metadata
我 运行 falco 和 falcosidekick docker 组成,没有 k8s。
我需要将 aws 实例元数据检索到 falco 规则输出。
我找到了 jevt 字段 class 但我在 falco 容器启动时遇到错误
Invalid output format 'command=%jevt.value[/awsRegion': 'invalid formatting token jevt.value[/awsRegion']
这是我的规则:
- rule: Terminal shell in container
desc: A shell was used as the entrypoint/exec point into a container with an attached terminal.
condition: >
spawned_process and container
and shell_procs and proc.tty != 0
and container_entrypoint
and not user_expected_terminal_shell_in_container_conditions
output: >
command=%jevt.value["/awsRegion"]
priority: NOTICE
tags: [ container, shell, mitre_execution ]
我该怎么办?
谢谢
需要知道的几件事:
jevt.value
的语法是 jevt.value[/awsRegion]
(无引号)
- 这些类型字段用于 json 格式的事件,它适用于 kubernetes 审计日志,但在您的规则基于系统调用的情况下
- falco 也不会查询 aws 元数据,您的输出中不会有这样的信息
此致,
Falco 不查询 AWS 元数据,因此我使用 aws cli describe-instances 检索元数据并将元数据传递给 falcosidekick 容器。
#loading EC2 metadata
INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
INSTANCE_IP=$(aws ec2 describe-instances --instance-id "$INSTANCE_ID" --region eu-west-1 --query 'Reservations[*].Instances[*].{InstanceIp:PublicIpAddress}' --output text)
CLUSTER_NAME=$(aws ec2 describe-instances --instance-id "$INSTANCE_ID" --region eu-west-1 --query 'Reservations[*].Instances[*].{ClusterName:Tags[?Key==`Name`]|[0].Value}' --output text)
docker run -d -p 2801:2801 -d \
-e CUSTOMFIELDS=INSTANCE_ID:"$INSTANCE_ID",INSTANCE_IP:"$INSTANCE_IP",CLUSTER_NAME:"$CLUSTER_NAME" \
--name falcosidekick \
falcosecurity/falcosidekick
我 运行 falco 和 falcosidekick docker 组成,没有 k8s。
我需要将 aws 实例元数据检索到 falco 规则输出。 我找到了 jevt 字段 class 但我在 falco 容器启动时遇到错误
Invalid output format 'command=%jevt.value[/awsRegion': 'invalid formatting token jevt.value[/awsRegion']
这是我的规则:
- rule: Terminal shell in container
desc: A shell was used as the entrypoint/exec point into a container with an attached terminal.
condition: >
spawned_process and container
and shell_procs and proc.tty != 0
and container_entrypoint
and not user_expected_terminal_shell_in_container_conditions
output: >
command=%jevt.value["/awsRegion"]
priority: NOTICE
tags: [ container, shell, mitre_execution ]
我该怎么办? 谢谢
需要知道的几件事:
jevt.value
的语法是jevt.value[/awsRegion]
(无引号)- 这些类型字段用于 json 格式的事件,它适用于 kubernetes 审计日志,但在您的规则基于系统调用的情况下
- falco 也不会查询 aws 元数据,您的输出中不会有这样的信息
此致,
Falco 不查询 AWS 元数据,因此我使用 aws cli describe-instances 检索元数据并将元数据传递给 falcosidekick 容器。
#loading EC2 metadata
INSTANCE_ID=$(curl http://169.254.169.254/latest/meta-data/instance-id)
INSTANCE_IP=$(aws ec2 describe-instances --instance-id "$INSTANCE_ID" --region eu-west-1 --query 'Reservations[*].Instances[*].{InstanceIp:PublicIpAddress}' --output text)
CLUSTER_NAME=$(aws ec2 describe-instances --instance-id "$INSTANCE_ID" --region eu-west-1 --query 'Reservations[*].Instances[*].{ClusterName:Tags[?Key==`Name`]|[0].Value}' --output text)
docker run -d -p 2801:2801 -d \
-e CUSTOMFIELDS=INSTANCE_ID:"$INSTANCE_ID",INSTANCE_IP:"$INSTANCE_IP",CLUSTER_NAME:"$CLUSTER_NAME" \
--name falcosidekick \
falcosecurity/falcosidekick