https://github.com/aquasecurity/trivy/releases
-centos
rpm -ivh https://github.com/aquasecurity/trivy/releases/download/v0.44.1/trivy_0.44.1_Linux-64bit.rpm
-Debian/Ubuntu
apt-get install wget apt-transport-https gnupg lsb-release
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main | sudo tee -a /etc/apt/sources.list.d/trivy.list
apt-get update
apt-get install trivy
-检测
trivy image hub.htmltoo.com:5000/http:nginx1.22.1
-隐藏未修复得漏洞
trivy image --ignore-unfixed hub.htmltoo.com:5000/http:nginx1.22.1
-按严重程度, 使用--severity选项
trivy image --severity HIGH,CRITICAL hub.htmltoo.com:5000/http:nginx1.22.1
-按漏洞ID, 使用.trivyignore
cat .trivyignore# Accept the riskCVE-2018-14618# No impact in our settingsCVE-2019-1543# trivy image hub.htmltoo.com:5000/http:nginx1.22.1
-按类型, 使用--vuln-type选项
trivy image --vuln-type os hub.htmltoo.com:5000/http:nginx1.22.1
-Trivy 漏洞报告格式
-指定输出格式为表格(默认)
trivy image --severity HIGH,CRITICAL --vuln-type os -f table -o nginx.txt hub.htmltoo.com:5000/http:nginx1.22.1
-指定输出格式为 json
trivy image -f json -o results.json hub.htmltoo.com:5000/http:nginx1.22.1
---Trivy 检测两种类型的安全问题 :
漏洞
配置错误
---Trivy 可以扫描三种不同的对象:
容器镜像
文件系统
Git 仓库
---Trivy 是什么
Trivy 是一个简单而全面的漏洞/错误配置扫描器,用于容器和 K8s 环境。
软件漏洞是软件或操作系统中存在的故障、缺陷或弱点。
Trivy 检测操作系统包(Alpine、RHEL、CentOS 等)和特定语言包(Bundler、Composer、npm、yarn 等)的漏洞。
此外,Trivy 会扫描基础设施即代码 (IaC) 文件,例如 Terraform 和 Kubernetes,以检测使您的部署面临攻击风险的潜在配置问题。
Trivy 易于使用。只需安装二进制文件,您就可以开始扫描了。扫描所需要做的就是指定一个目标,例如容器的镜像名称。