1

使用Trivy扫描你的镜像漏洞

 1 year ago
source link: https://www.bboy.app/2022/06/22/%E4%BD%BF%E7%94%A8Trivy%E6%89%AB%E6%8F%8F%E4%BD%A0%E7%9A%84%E9%95%9C%E5%83%8F%E6%BC%8F%E6%B4%9E/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
20220622-1.webp

Trivy是一个安全扫描器,使用Trivy你可以扫描你的容器镜像,文件系统,远程的git仓库,k8s集群

安装很简单,就一个二进制,下载下来直接扔到/bin就好

wget https://github.com/aquasecurity/trivy/releases/download/v0.29.1/trivy_0.29.1_Linux-64bit.tar.gz

tar -zxvf trivy_0.29.1_Linux-64bit.tar.gz

mv trivy /bin/

简单的扫描一下

trivy i nginx:latest

第一次运行的话会自动下载漏洞库

扫描k8s

trivy k8s -n default --report summary all

扫描git仓库

trivy repo https://github.com/aquasecurity/trivy

trivy 还有一个c/s模式,当你不想在每个位置都下载数据库的时候你就可以开启sever模式

trivy s --listen 0.0.0.0:4954

然后使用别的地方trivy去连接这个trivy

trivy image --server http://10.10.100.11:4954 alpine:3.10

默认情况下trivy扫描完成之后会以代码0退出,但是如果你想以别的比如代码1退出可以加上--exit-code

trivy i --exit-code 1 nginx:latest

这个在你配置cicd流水线的时候会非常的有用

trivy 还可以配置redis作为缓存后端

--cache-backend redis://localhost:6379

欢迎关注我的博客www.bboy.app

Have Fun


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK