[CKS] 利用falco进行容器日志捕捉和安全监控

最近准备花一周的时间准备CKS考试,在准备考试中发现有一个题目关于使用falco处理日志和安全监控的题目。

​ 专栏其他文章:

What’s th falco

Falco是一种开源的云原生安全工具,它是一个运行在Linux内核层的容器运行时安全监控系统。Falco可以实时监测容器和宿主机的活动,并根据预定义的规则进行安全警报和响应。它可以检测并报告容器内的异常行为、恶意活动和潜在的安全风险,帮助管理员及时发现和应对安全威胁。Falco能够提供对容器环境的实时可观察性,帮助用户更好地管理和保护容器化应用的安全。

Question 1

There is a Pod on the worker node called monitor in the default namespace. Its only container is also called monitor.

  • On the worker node, create a Falco rules file at /home/cloud_user/monitor_rules.yml.

  • Configure a rule to detect spawning processes within the container. The output should be in the format [timestamp],[container id],[container image name],[uid],[process name]. (The priority should be NOTICE; no [ ] are needed in the output).

本题是要求你创建一个falco的rule,并且配置这个role,能够输出[timestamp],[container id],[container image name],[uid],[process name]

Practice

  • 创建一个yml文件monitor_rules.yml用于存储falco的规则, 具体文件内容如下
- rule: spawned_process_in_monitor_container
  desc: "A rule for monitor container"
  condition: container.name="monitor" and evt.type=execve
  output: "%evt.time,%container.id,%container.image,%user.uid,%proc.name"
  priority: NOTICE

Question 2

Run Falco for 45 seconds or so to check for activity in the container.
Save the output to a file located at /home/cloud_user/falco_output.log on the worker node.

本题要求你运行falco 45s,并输出日志到falco_output.log

Practice

运行falco命令:

sudo falco -M 45 -r monitor_rules.yml > /home/cloud_user/falco_output.log

怎么验证结果?

当任务完成后,你需要查看falco_output.log文件,如果里面有内容,则代表本题已完成

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

葡萄皮Apple

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值