容器镜像安全漏洞扫描工具Trivy

概述
最近做镜像分析扫描工作,需要扫描镜像的安全漏洞,评估镜像安全性,调研了几款漏洞扫描工具,最后决定使用Trivy 工具,Trivy是一家以色列安全公司开源的一个漏洞扫描工具,支持容器镜像、虚机镜像、文件系统的安全扫描。
官网地址: https://aquasecurity.github.io/trivy/v0.42/
github地址: https://github.com/aquasecurity/trivy

安装
可以通过添加软件源的方式,也可以在github的发布页下载安装包,下面展示软件源方式安装。

RHEL/CentOS
通过新增yum仓库源的方式安装


RELEASE_VERSION=(grepPo(?<=VERSIONID=")[09]/etc/osrelease)cat<<EOF|sudoteea/etc/yum.repos.d/trivy.repo[trivy]name=Trivyrepositorybaseurl=https://aquasecurity.github.io/trivyrepo/rpm/releases/RELEASE_VERSION/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://aquasecurity.github.io/trivy-repo/rpm/public.key
EOF
sudo yum -y update
sudo yum -y install trivy
1
2
3
4
5
6
7
8
9
10
11
12
Debian/Ubuntu
添加apt软件源

sudo apt-get install wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install trivy

1
2
3
4
5
6
MacOS
brew install trivy
1
使用
安装完成后直接输入 trivy 命令就可以使用了
例如,扫描nginx镜像的安全漏洞,默认扫描所有的级别的漏洞

trivy image nginx
1
也可以只扫描高危漏洞

trivy image --severity CRITICAL nginx
1
输出如下,可以看到存在的高危漏洞,和漏洞说明的URL

————————————————
版权声明:本文为CSDN博主「俞兆鹏」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/zhaopeng_yu/article/details/131132455

posted @   GaoYanbing  阅读(197)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示