Trivy is an open-source tool by aqua security to scan for vulnerabilities and misconfiguration errors. This tool works at various levels: it can evaluate Infrastructure as Code, inspect container images, deliver configuration file assistance, analyze Kubernetes implementations, and review the code in a Git repository. With the ease of usage, trivy can be simply be integrated in CI/CD pipeline (DevSecOps) by installing and adding binary to the project. Trivy offers complete visibility across programming language and operating system packages and has a wide database of vulnerabilities which allows quick scans of critical CVEs. With various new advancements in the tool, it has helped pen-testers and cybersecurity researchers to ensure continuous scans making the process of DevSecOps faster and more efficient.
Installation
The installation is quite simple. Follow the below-given commands to install Trivy from the official repository on your ubuntu machine.
Once the tool has been installed and updated, you are ready to scan files.
Scanning Git Repository
As I have described above, we can use trivy for scanning security loopholes among multiple platforms.
If you are using Git Repository and you can scan git file directly without downloading the entire package.
Scanning Container Image
With the ever-growing threats to docker security, Trivy is one of the best tools available in the market for scanning Container Images.
You can easily run a quick scan on the docker images to report any vulnerabilities by following the below-given steps.
Step1: Check the Image ID of the Container image you want to scan.
Step2: Use the below-given command to scan the container image.
You can also scan the images for a particular severity of vulnerabilities and save the report in text format using the below-given command.
Scanning Filesystem
Trivy can be used to scan a filesystem (such as a host machine, a virtual machine image, or an unpacked container image filesystem).
(Note: We are using vulnerable-node from Filesystem for this practical.)
Use the below-given command to scan any filesystem for vulnerabilities.
Scanning the running Containers
You can quickly scan the running container from inside. Follow the below-given steps to scan a docker file.
Step1: Run the docker file that you want to scan.
Step2: Add Trivy scanner to the file and run it.
Embed Trivy in Dockerfile
You can also scan the image as part of the build process by embedding Trivy in the Dockerfile. This approach can be used to update Dockerfiles currently using Aqua’s Micro scanner. Follow the below-given steps to scan the docker file while building it.
Step1: Add trivy to the docker file.
Step2 : Build the image.
It will scan the docker file while the image is being built and give the report as shown below.
Thanks for reading the article.
Comments
Post a Comment