首页
视频
资源
登录
原
Kubernetes Falco运行时安全
5861
人阅读
2022/6/28 21:29
总访问:
2645756
评论:
0
收藏:
0
手机
分类:
容器编排
![](https://img.tnblog.net/arcimg/hb/614d34a8a895477d940476f4298690f9.png) >#Kubernetes Falco运行时安全 [TOC] 简介 ------------ tn2>Falco,云原生运行时安全项目,是事实上是 Kubernetes 威胁检测引擎。 通过观察应用程序和容器的行为在运行时检测威胁。 使用 Falco 插件跨云环境扩展威胁检测。 ![](https://img.tnblog.net/arcimg/hb/25922c63734c42ac9342843124c9a2fb.png) 安装与启动 ------------ >### Debian/Ubuntu ```bash # 信任密钥 curl -s https://falco.org/repo/falcosecurity-3672BA8F.asc | apt-key add - echo "deb https://download.falco.org/packages/deb stable main" | tee -a /etc/apt/sources.list.d/falcosecurity.list apt-get update -y # 安装内核头文件 apt-get -y install linux-headers-$(uname -r) # 安装 Falco apt-get install -y falco # 卸载也很简单 apt-get remove falco ``` >### Centos7 ```bash # 信任密钥 curl -s https://falco.org/repo/falcosecurity-3672BA8F.asc | apt-key add - echo "deb https://download.falco.org/packages/deb stable main" | tee -a /etc/apt/sources.list.d/falcosecurity.list apt-get update -y # 安装内核头文件 apt-get -y install linux-headers-$(uname -r) # 安装 Falco apt-get install -y falco # 卸载也很简单 apt-get remove falco ``` >### 启动 ```bash systemctl enable falco systemctl start falco # 查看falco状态 service falco status ``` tn2>还可通过使用以下命令,查看Falco 日志 ```bash journalctl -fu falco ``` tn2>也会将日志记录到`/var/log/syslog`中 ```bash cat /var/log/syslog | grep falco ``` ![](https://img.tnblog.net/arcimg/hb/5ac65dea1df542149f39ac5d2a4380d6.png) >### Demo tn2>打开单独的一个窗口,我们可以通过创建pod,并通过`exec`连接到容器里面,将触发Falco的`shell in a container`规则,并且会记录下来。 然后在以前的端口进行日志shell的检查。 ```bash # 第二个窗口 kuberctl run pod --image=nginx:alpine kuberctl exec -it pod -- sh # 第一个窗口 cat /var/log/syslog | grep falco | grep shell ``` ![](https://img.tnblog.net/arcimg/hb/5311f0459e5e453ab73d98c21ea3e762.png) ![](https://img.tnblog.net/arcimg/hb/abceecf6171c4339b07651b7faabecb6.png) >### 自定义日志输出格式 tn2>这个格式可能看着没那么好看,我们可以自定义一个自己的格式。 首先规则在`/etc/falco/`目录下,我们先备份,在修改日志记录的规则。 ```bash cd /etc/falco/ cp falco_rules.yaml falco_rules.local.yaml # 修改日志记录 vim falco_rules.local.yaml ``` tn2>首先我们找到`Terminal shell in container`规则,更改`output`输出格式。 ```bash - 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: > Bob NEW SHELL!!! (user_id=%user.uid repo=%container.image.repository %user.uiduser=%user.name user_loginuid=%user.loginuid %container.info shell=%proc.name parent=%proc.pname cmdline=%proc.cmdline terminal=%proc.tty container_id=%container.id image=%container.image.repository) priority: NOTICE tags: [container, shell, mitre_execution] ``` tn2>然后我们重启falco,然后再次打开一个pod的shell。 ```bash # 重启falco service falco restart # 远程连接 k exec -it pod -- sh # 再次查询日志 cat /var/log/syslog | grep Bob ``` ![](https://img.tnblog.net/arcimg/hb/d51ce8956ea045d58678b0430655d41f.png) tn2>关于更多字段的设置请参考: https://falco.org/docs/rules/supported-fields/ 官网请参考: https://falco.org/
欢迎加群讨论技术,1群:677373950(满了,可以加,但通过不了),2群:656732739
👈{{preArticle.title}}
👉{{nextArticle.title}}
评价
{{titleitem}}
{{titleitem}}
{{item.content}}
{{titleitem}}
{{titleitem}}
{{item.content}}
尘叶心繁
这一世以无限游戏为使命!
博主信息
排名
6
文章
6
粉丝
16
评论
8
文章类别
.net后台框架
171篇
linux
17篇
linux中cve
1篇
windows中cve
0篇
资源分享
10篇
Win32
3篇
前端
28篇
传说中的c
4篇
Xamarin
9篇
docker
15篇
容器编排
101篇
grpc
4篇
Go
15篇
yaml模板
1篇
理论
2篇
更多
Sqlserver
4篇
云产品
39篇
git
3篇
Unity
1篇
考证
2篇
RabbitMq
23篇
Harbor
1篇
Ansible
8篇
Jenkins
17篇
Vue
1篇
Ids4
18篇
istio
1篇
架构
2篇
网络
7篇
windbg
4篇
AI
18篇
threejs
2篇
人物
1篇
嵌入式
3篇
python
13篇
HuggingFace
8篇
pytorch
9篇
opencv
6篇
Halcon
4篇
最新文章
最新评价
{{item.articleTitle}}
{{item.blogName}}
:
{{item.content}}
关于我们
ICP备案 :
渝ICP备18016597号-1
网站信息:
2018-2024
TNBLOG.NET
技术交流:
群号656732739
联系我们:
contact@tnblog.net
欢迎加群
欢迎加群交流技术