我经营法尔科和猎鹰同伴与码头撰写,无k8s。
我需要检索aws实例元数据到falco规则输出。我找到了jevt字段类,但是在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 ]我该怎么做?谢谢
发布于 2021-11-29 14:05:23
Falco不查询AWS元数据,所以我用aws cli描述实例检索了元数据,并将元数据传递给Falco伴侣容器。
#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发布于 2021-11-25 22:59:47
有几件事要知道:
jevt.value的语法是jevt.value[/awsRegion] (无引号)的信息
致以敬意,
https://stackoverflow.com/questions/70019845
复制相似问题