赞
踩
tags: 安全,trivy
{% youtube %}
https://www.youtube.com/watch?v=bgYrhQ6rTXA
{% endyoutube %}
Trivy 是一个简单而全面的漏洞/错误配置/秘密扫描器,用于容器和其他工件。 检测操作系统包(Alpine、RHEL、CentOS 等)和特定语言包(Bundler、Composer、npm、yarn 等)的漏洞。此外,扫描Terraform 和 Kubernetes 等基础架构即代码 (IaC) 文件,以检测使您的部署面临攻击风险的潜在配置问题。 还扫描硬编码的秘密vyTrivyTrivyTrivy比如密码、API 密钥和令牌。 Trivy易于使用。只需安装二进制文件,您就可以扫描了。扫描所需要做的就是指定一个目标,例如容器的image名称
Trivy 检测到两种类型的安全问题:
Trivy 可以扫描四种不同的工件:
Trivy 可以在两种不同的模式下运行:
Trivy 可以作为 Kubernetes Operator 运行:
全面的漏洞检测
检测 IaC 错误配置
开箱即用地提供了多种内置策略:
支持自定义策略
简单
快速
简易安装
高准确率
DevSecOps
支持多种格式
SBOM(软件物料清单)支持
yum
RELEASE_VERSION=$(grep -Po '(?<=VERSION_ID=")[0-9]' /etc/os-release)
cat << EOF | sudo tee -a /etc/yum.repos.d/trivy.repo
[trivy]
name=Trivy repository
baseurl=https://aquasecurity.github.io/trivy-repo/rpm/releases/$RELEASE_VERSION/\$basearch/
gpgcheck=0
enabled=1
EOF
sudo yum -y update
sudo yum -y install trivy
rpm
rpm -ivh https://github.com/aquasecurity/trivy/releases/download/v0.30.4/trivy_0.30.4_Linux-64bit.rpm
apt源
sudo 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
sudo apt-get update
sudo apt-get install trivy
deb包
wget https://github.com/aquasecurity/trivy/releases/download/v0.30.4/trivy_0.30.4_Linux-64bit.deb
sudo dpkg -i trivy_0.30.4_Linux-64bit.deb
pikaur
pikaur -Sy trivy-bin
yay
yay -Sy trivy-bin
brew install aquasecurity/trivy/trivy
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.30.4
docker pull aquasec/trivy:0.30.4
docker pull ghcr.io/aquasecurity/trivy:0.30.4
docker pull public.ecr.aws/aquasecurity/trivy:0.30.4
linux
docker run --rm -v [YOUR_CACHE_DIR]:/root/.cache/ aquasec/trivy:0.30.4 image [YOUR_IMAGE_NAME]
macOS
docker run --rm -v $HOME/Library/Caches:/root/.cache/ aquasec/trivy:0.30.4 image [YOUR_IMAGE_NAME
实例
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock \
-v $HOME/Library/Caches:/root/.cache/ aquasec/trivy:0.30.4 python:3.4-alpine
helm repo add aquasecurity https://aquasecurity.github.io/helm-charts/
helm repo update
helm search repo trivy
helm install my-trivy aquasecurity/trivy
使用发布名称安装图表my-release:
helm install my-release .
该命令以默认配置在 Kubernetes 集群上部署 Trivy。参数 部分列出了可以在安装期间配置的参数。
示例
$ helm install my-release . \
--namespace my-namespace \
--set "service.port=9090" \
--set "trivy.vulnType=os\,library"
下一篇我们开始讲:trivy【2】工具漏洞扫描
参考:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。