### Install Trivy using Install Script Source: https://trivy.dev/latest/getting-started/installation This section details how to install Trivy using an official installation script. It's a straightforward method for getting Trivy up and running quickly. ```Shell # Example command (actual script content not provided in the text) curl -sfL https://aquasecurity.github.io/trivy-installer/installer.sh | bash -s -- --version "$(< VERSION)" ``` -------------------------------- ### Trivy Plugins: Developer Guide Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo_init A guide for developers interested in creating their own Trivy plugins. It covers the plugin architecture, APIs, development environment setup, and best practices for building robust plugins. ```go package main import ( "github.com/aquasecurity/trivy/pkg/plugin" ) func main() { plugin.Register(&plugin.PluginInfo{ Name: "my-custom-plugin", Version: "1.0.0", Run: myCustomScanFunc, }) } func myCustomScanFunc(ctx plugin.ScanContext, opts plugin.ScanOptions) ([]plugin.Result, error) { // Custom scanning logic here return []plugin.Result{}, nil } ``` -------------------------------- ### Searching and Installing Plugins via Trivy Plugin Index Source: https://trivy.dev/latest/docs/plugin/developer-guide Shows how to search for and install plugins using the Trivy plugin index, facilitating easier discovery and installation of community plugins. ```bash trivy plugin search trivy plugin install kubectl ``` -------------------------------- ### Trivy Plugins: User Guide Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo_init Provides instructions for end-users on how to discover, install, and utilize Trivy plugins to extend its scanning capabilities. Covers common use cases and basic plugin management. ```markdown To use a plugin, first install it using `trivy plugin install `. Then, you can run it using `trivy plugin run --args ...`. ``` -------------------------------- ### Testing Trivy Plugin Installation Locally Source: https://trivy.dev/latest/docs/plugin/developer-guide Instructions on how to test the installation of a Trivy plugin on your local development environment before publishing. ```Shell # Example command to test plugin installation locally (conceptual) trivy plugin install /path/to/your/plugin/directory ``` -------------------------------- ### Installing a Trivy Plugin from GitHub Source: https://trivy.dev/latest/docs/plugin/developer-guide Demonstrates the command to install a Trivy plugin directly from a GitHub repository, assuming the `plugin.yaml` file is located in the root directory. ```bash trivy plugin install github.com/org/repo ``` -------------------------------- ### Trivy Plugin Manifest Example (plugin.yaml) Source: https://trivy.dev/latest/docs/plugin/developer-guide An example of a `plugin.yaml` file for the `trivy-plugin-kubectl` project, demonstrating how to define plugin metadata, usage, and platform-specific download URIs and binaries. ```yaml name:"kubectl" version:"0.1.0" repository:github.com/aquasecurity/trivy-plugin-kubectl maintainer:aquasecurity output:false summary:Scan kubectl resources description:|- A Trivy plugin that scans the images of a kubernetes resource. Usage: trivy kubectl TYPE[.VERSION][.GROUP] NAME platforms: -selector:# optional os:darwin arch:amd64 uri:./trivy-kubectl# where the execution file is (local file, http, git, etc.) bin:./trivy-kubectl# path to the execution file -selector:# optional os:linux arch:amd64 uri:https://github.com/aquasecurity/trivy-plugin-kubectl/releases/download/v0.1.0/trivy-kubectl.tar.gz bin:./trivy-kubectl ``` -------------------------------- ### Install Trivy with mise Source: https://trivy.dev/latest/getting-started/installation This snippet demonstrates how to install Trivy using the mise version manager. It includes installing the plugin and latest version, setting a global version, and verifying the installation. ```Bash # Install plugin and install latest version mise plugin add trivy mise install trivy # Set a version globally (on your ~/.tool-versions file) mise global trivy latest # Now trivy commands are available trivy --version ``` -------------------------------- ### Install Trivy via Install Script Source: https://trivy.dev/latest/getting-started/installation A convenient method to install Trivy using a provided script that automates the download and installation process from GitHub releases. ```bash curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy-repo/main/install.sh | sh -s -- -b /usr/local/bin v0.47.0 ``` -------------------------------- ### Trivy CLI: Module Install Command Usage Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo_init Provides specific examples and syntax for using the `trivy module install` command to add new modules to Trivy's configuration. ```bash trivy module install vuln-db-custom trivy module install policy-set-enterprise ``` -------------------------------- ### Trivy Plugin Structure Example Source: https://trivy.dev/latest/docs/plugin/developer-guide Illustrates the basic directory structure for a Trivy plugin, including the required plugin.yaml file and an optional executable script. ```Shell your-plugin/ | |- |-- plugin.yaml |-- your-plugin.sh ``` -------------------------------- ### Trivy CLI: Plugin Info Command Usage Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo_init Shows how to get detailed information about an installed Trivy plugin, including its version, description, and available commands. ```bash trivy plugin info my-custom-plugin ``` -------------------------------- ### Trivy Plugin Management Commands Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_kubernetes This documentation outlines the commands for managing Trivy plugins, including listing, installing, and getting information about plugins. It covers 'trivy plugin list', 'trivy plugin install', and 'trivy plugin info'. ```bash trivy plugin list ``` ```bash trivy plugin install ``` ```bash trivy plugin info ``` -------------------------------- ### Install Trivy Plugins Source: https://trivy.dev/latest/docs/plugin/user-guide Installs Trivy plugins using the `trivy plugin install` command. Supports installation from the plugin index, direct URLs, file paths, and Git repositories with version tags. Trivy uses go-getter for downloads, supporting OCI, local files, Git, HTTP/S, Mercurial, S3, and GCS. ```bash $ trivy plugin install $ trivy plugin install $ trivy plugin install $ trivy plugin install @ ``` -------------------------------- ### Install and Run Trivy Plugins On-the-Fly Source: https://trivy.dev/latest/docs/plugin/user-guide The `trivy plugin run` command installs a plugin and executes it immediately. If the plugin is already cached, the installation step is skipped. ```bash trivy plugin run ``` -------------------------------- ### Install Trivy with asdf Source: https://trivy.dev/latest/getting-started/installation This snippet shows how to install Trivy using the asdf version manager. It includes installing the plugin, setting a global version, and verifying the installation. ```Bash # Install plugin asdf plugin add trivy # Install latest version asdf install trivy # Set a version globally (on your ~/.tool-versions file) asdf global trivy latest # Now trivy commands are available trivy --version ``` -------------------------------- ### Install Trivy with Nix/NixOS Source: https://trivy.dev/latest/getting-started/installation Guidance on installing Trivy using the Nix package manager for Linux and macOS, covering command-line installation and Home Manager configuration. ```bash nix-env --install -A nixpkgs.trivy ``` -------------------------------- ### Trivy Plugins: User Guide Source: https://trivy.dev/latest/docs/configuration/filtering Provides guidance for users on how to install, configure, and utilize Trivy plugins to extend its scanning capabilities. This includes information on available plugins and their specific functionalities. ```bash # Example: Installing a custom plugin trivy plugin install custom-scanner ``` -------------------------------- ### Trivy Plugin Management Commands Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo_list This documentation outlines the commands for managing Trivy plugins, including listing, installing, uninstalling, updating, and searching for plugins. It also covers commands for getting information about a plugin and running a plugin. ```CLI trivy plugin info trivy plugin install trivy plugin list trivy plugin run trivy plugin uninstall trivy plugin update trivy plugin upgrade trivy plugin search ``` -------------------------------- ### Tagging Plugin Repositories with Semantic Versioning Source: https://trivy.dev/latest/docs/plugin/developer-guide Instructions on how to tag Git repository releases for Trivy plugins using Semantic Versioning, ensuring compatibility and allowing users to install specific versions. ```bash $v1.2.3 ``` -------------------------------- ### Trivy CLI: Plugin Install Command Reference Source: https://trivy.dev/latest/tutorials/additional-resources/cks This documentation describes the 'trivy plugin install' command, used to install new plugins for Trivy. Plugins can add new scanning capabilities or integrate with external services. ```bash trivy plugin install custom-scanner trivy plugin install --url https://example.com/plugin.tar.gz ``` -------------------------------- ### Trivy CLI - Plugin Install Command Source: https://trivy.dev/latest/getting-started/faq The `trivy plugin install` command is used to install Trivy plugins, which add new scanning capabilities or integrate with external services. ```bash trivy plugin install https://github.com/trivy/plugin-example ``` -------------------------------- ### Trivy CLI: Module Install Command Reference Source: https://trivy.dev/latest/tutorials/additional-resources/cks This documentation describes the 'trivy module install' command, used to download and install Trivy modules, which can extend its functionality or provide custom scanning capabilities. ```bash trivy module install vuln-db trivy module install --all ``` -------------------------------- ### Install Trivy on FreeBSD Source: https://trivy.dev/latest/getting-started/installation This snippet demonstrates how to install Trivy on FreeBSD using the pkg package manager. ```Shell pkg install trivy ``` -------------------------------- ### Install Trivy with Homebrew Source: https://trivy.dev/latest/getting-started/installation Instructions for installing Trivy on macOS and Linux using the Homebrew package manager. ```bash brew install trivy ``` -------------------------------- ### Trivy CLI Plugin Install Example Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_plugin_install This example demonstrates how to install a Trivy plugin named 'custom-scanner'. Ensure the plugin name is correct and available. ```bash trivy plugin install custom-scanner ``` -------------------------------- ### Example: Scan Filesystem from Inside a Container with Trivy Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_rootfs Illustrates scanning a filesystem from within a running container. It starts an Alpine container, installs Trivy inside it, and then runs 'trivy rootfs /' to scan the container's root filesystem. ```bash # Scan from inside a container $ docker run --rm -it alpine:3.11 / # curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin / # trivy rootfs / ``` -------------------------------- ### Trivy CLI: Plugin List Command Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo_init Lists all installed Trivy plugins. This command helps users manage their installed plugins and check for available updates or verify installation status. It's useful for auditing the Trivy environment. ```bash trivy plugin list ``` -------------------------------- ### Install Trivy on RHEL/CentOS Source: https://trivy.dev/latest/getting-started/installation Instructions for installing Trivy on RHEL and CentOS systems by adding the official Trivy RPM repository configuration. ```bash cat<< EOF | sudo tee -a /etc/yum.repos.d/trivy.repo [trivy] name=Trivy repository baseurl=https://aquasecurity.github.io/trivy-repo/rpm/releases/\$basearch/ gpgcheck=1 enabled=1 gpgkey=https://aquasecurity.github.io/trivy-repo/rpm/public.key EOF sudo yum install -y trivy ``` -------------------------------- ### Trivy CLI: CLI Overview Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo_init A general overview of the Trivy command-line interface, explaining its structure, common commands, and how to get help. ```bash trivy --help trivy image --help trivy fs --help ``` -------------------------------- ### Install Trivy via GitHub Release Source: https://trivy.dev/latest/getting-started/installation Steps to install Trivy from a GitHub release. This involves downloading the appropriate archive for your operating system and architecture, unpacking it, and ensuring the binary has execute permissions. ```bash tar -xzf ./trivy.tar.gz chmod +x ./trivy ``` -------------------------------- ### Trivy CLI Plugin Install SEE ALSO Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_plugin_install This section provides references to related commands or documentation for the Trivy plugin installation process. ```bash # SEE ALSO # trivy plugin list, trivy plugin run ``` -------------------------------- ### Scan PHP Installed JSON with Trivy Source: https://trivy.dev/latest/docs/coverage/language/php This example shows how to scan PHP projects using the 'installed.json' file, which lists installed packages and their versions. Trivy can identify vulnerabilities in these installed PHP packages. ```bash trivy fs --security-checks vuln --scanners vuln --input /path/to/your/php/project/installed.json ``` -------------------------------- ### Trivy Plugin Install Command Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_filesystem Installs a specific Trivy plugin. This command requires the plugin name as an argument. ```bash trivy plugin install ``` -------------------------------- ### Trivy CLI: Module Install Source: https://trivy.dev/latest/docs/supply-chain/attestation/rekor Installs a Trivy module, which can extend its functionality, for example, by adding custom scanning capabilities or integrating with external data sources. ```bash # Install a Trivy module by name trivy module install ``` -------------------------------- ### Trivy CLI Overview Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_plugin_install This command provides an overview of the Trivy command-line interface, listing available commands and their basic usage. ```bash trivy --help ``` -------------------------------- ### Install Trivy with MacPorts Source: https://trivy.dev/latest/getting-started/installation Instructions for installing Trivy on macOS using the MacPorts package manager, with a link to the port details. ```bash sudo port install trivy ``` -------------------------------- ### Trivy FAQ: Air-gapped Environment Source: https://trivy.dev/latest/getting-started/faq Explains how to run Trivy in an air-gapped environment, directing users to a specific resource for detailed instructions. ```English See here for how to run Trivy under an air-gapped environment. ``` -------------------------------- ### Trivy Plugin Management Commands Source: https://trivy.dev/latest/getting-started Illustrates how to manage Trivy plugins using the CLI, including installing, listing, updating, and running plugins. ```bash trivy plugin list trivy plugin install aquasecurity/trivy-plugin-example trivy plugin run trivy-plugin-example --input /path/to/scan ``` -------------------------------- ### Trivy Config Command Example Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_filesystem Demonstrates the use of the 'trivy config' command, likely for managing Trivy's configuration settings or applying configurations to scans. ```bash trivy config ``` -------------------------------- ### Trivy General Usage Examples Source: https://trivy.dev/latest/getting-started Demonstrates common Trivy commands for scanning container images, filesystems, and Kubernetes clusters. These examples showcase basic scanning operations and common flags. ```bash trivy image alpine:latest trivy fs /path/to/your/app trivy k8s --all-namespaces ``` -------------------------------- ### Trivy CLI: Plugin Management Source: https://trivy.dev/latest/docs/configuration/db Commands for managing Trivy plugins, including listing, installing, and getting information about available plugins. Plugins add new scanning capabilities. ```bash trivy plugin trivy plugin info trivy plugin list trivy plugin install ``` -------------------------------- ### Scan Kubernetes Cluster with Trivy Source: https://trivy.dev/latest/docs/target/container_image This guide covers scanning Kubernetes clusters for security vulnerabilities and misconfigurations. It explains how to target cluster resources and provides examples for different scanning scenarios. ```Shell # Example command to scan a Kubernetes cluster trivy k8s --cluster ``` -------------------------------- ### Serve Trivy Documentation Locally Source: https://trivy.dev/latest/community/contribute/pr Build the documentation and serve it locally at http://localhost:8000 for preview. ```Shell $ mage docs:serve ``` -------------------------------- ### Install Trivy on OpenSUSE Source: https://trivy.dev/latest/getting-started/installation Details for installing Trivy on OpenSUSE systems using the OpenSUSE Package Repository, including a reference to the package details page. ```bash sudo zypper install trivy ``` -------------------------------- ### Trivy CLI Plugin Management Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_module This documentation outlines the commands for managing Trivy plugins via the CLI. It covers how to get information about plugins, install, list, run, uninstall, and update them. ```bash trivy plugin --help trivy plugin info trivy plugin install trivy plugin list trivy plugin run [args...] trivy plugin uninstall trivy plugin update ``` -------------------------------- ### Trivy Plugin Management Source: https://trivy.dev/latest/docs/coverage/os/ubuntu Documentation on how to manage Trivy plugins, including commands to list, install, uninstall, and get information about available plugins. This allows extending Trivy's functionality. ```bash trivy plugin info --help trivy plugin install --help trivy plugin list --help trivy plugin uninstall --help trivy plugin run --help ``` -------------------------------- ### Trivy CLI Plugin Management Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_plugin Commands for managing Trivy plugins, including installing, uninstalling, listing, updating, and getting information about plugins. These commands are essential for extending Trivy's functionality. ```bash trivy plugin list trivy plugin install trivy plugin uninstall trivy plugin update trivy plugin info ``` -------------------------------- ### Trivy CLI: Plugin Management Source: https://trivy.dev/latest/community/maintainer/backporting This section details the command-line interface commands for managing Trivy plugins. It covers listing, installing, uninstalling, updating, and searching for plugins, as well as getting information about them. ```bash trivy plugin list trivy plugin install trivy plugin uninstall trivy plugin update trivy plugin search trivy plugin info trivy plugin upgrade ``` -------------------------------- ### Start Trivy Server Source: https://trivy.dev/latest/docs/references/modes/client-server Starts the Trivy server listening on a specified host and port, requiring an authentication token for secure operation. ```bash trivy server --listen localhost:8080 --token dummy ``` -------------------------------- ### Trivy CLI Configuration Options Source: https://trivy.dev/latest/getting-started/installation Lists common Trivy CLI commands for managing configuration, cleaning cache, and converting reports. ```Shell # Example: Clean Trivy cache trivy config --cache-clean # Example: Convert report format trivy convert --input report.json --output report.sarif --format sarif ``` -------------------------------- ### Trivy Plugin Management Source: https://trivy.dev/latest/docs/coverage/os/debian This documentation covers the management of Trivy plugins, including commands to get information about plugins, install, list, run, and uninstall them. It's essential for extending Trivy's functionality. ```bash trivy plugin info --help trivy plugin install --help trivy plugin list --help trivy plugin run --help trivy plugin uninstall --help ``` -------------------------------- ### Trivy Plugin Management Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy Provides examples of how to manage Trivy plugins using the CLI, including installing, listing, updating, and running plugins. Plugins extend Trivy's functionality for custom scanning or reporting needs. ```bash trivy plugin list trivy plugin install aquasecurity/trivy-plugin-example trivy plugin run trivy-plugin-example --input /path/to/file ``` -------------------------------- ### Trivy Module Management Commands Source: https://trivy.dev/latest/getting-started Shows how to manage Trivy modules, including installing and uninstalling them. ```bash trivy module install trivy module uninstall ``` -------------------------------- ### Trivy Plugin Management Source: https://trivy.dev/latest/tutorials/kubernetes/cluster-scanning This documentation covers the management of Trivy plugins, including how to list available plugins, install new ones, get information about a specific plugin, run a plugin, and update or uninstall existing plugins. ```Shell trivy plugin list trivy plugin info trivy plugin install trivy plugin run [args...] trivy plugin update trivy plugin upgrade trivy plugin uninstall ``` -------------------------------- ### List Trivy Plugins Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_plugin_install This command lists all available Trivy plugins. It helps users discover and manage installed plugins. ```bash trivy plugin list ``` -------------------------------- ### Trivy Plugin Management Source: https://trivy.dev/latest/docs/scanner/misconfiguration/custom/contribute-checks This documentation outlines the commands for managing Trivy plugins, including listing available plugins, installing, uninstalling, updating, and searching for plugins. It also covers how to get information about a specific plugin and run it. ```cli trivy plugin list trivy plugin install trivy plugin uninstall trivy plugin update trivy plugin search trivy plugin info trivy plugin run ``` -------------------------------- ### Trivy Kubernetes Scan Example Source: https://trivy.dev/latest/docs/target/kubernetes A basic example of invoking the Trivy command, likely for a default Kubernetes scan. This demonstrates the simplest way to initiate a scan. ```bash trivy ``` -------------------------------- ### Trivy CLI Usage Examples Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy Demonstrates common command-line interface (CLI) usage patterns for Trivy, including scanning container images, filesystems, and Kubernetes clusters. These examples showcase basic commands and options for initiating scans. ```bash trivy image alpine:latest trivy fs /path/to/your/app trivy k8s --namespace default cluster ``` -------------------------------- ### Trivy Plugin Management Commands Source: https://trivy.dev/latest/docs/coverage/os/minimos This snippet details the Trivy CLI commands for managing plugins, including listing available plugins, installing, uninstalling, updating, and running them. It also covers commands for getting information about specific plugins. ```bash trivy plugin --help trivy plugin info --help trivy plugin install --help trivy plugin list --help trivy plugin run --help trivy plugin uninstall --help trivy plugin update --help trivy plugin upgrade --help ``` -------------------------------- ### Run Trivy Server Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_server This snippet shows the basic command to run the Trivy server. It starts the server in its default configuration. ```bash trivy server [flags] ``` -------------------------------- ### Trivy Scan Results for pom.xml Source: https://trivy.dev/latest/docs/references/modes/client-server This example shows the output of a Trivy scan on a pom.xml file, listing detected vulnerabilities. It includes the library name, vulnerability ID, severity, installed version, fixed version, and a brief title for each vulnerability. ```text pom.xml (pom) ============= Total: 24 (CRITICAL: 24) +---------------------------------------------+------------------+----------+-------------------+--------------------------------+---------------------------------------+ | LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE | +---------------------------------------------+------------------+----------+-------------------+--------------------------------+---------------------------------------+ | com.fasterxml.jackson.core:jackson-databind | CVE-2017-17485 | CRITICAL | 2.9.1 | 2.8.11, 2.9.4 | jackson-databind: Unsafe | | | | | | | deserialization due to | | | | | | | incomplete black list (incomplete | | | | | | | fix for CVE-2017-15095)... | | | | | | -->avd.aquasec.com/nvd/cve-2017-17485 | + +------------------+ + +--------------------------------+---------------------------------------+ | | CVE-2018-11307 | | | 2.7.9.4, 2.8.11.2, 2.9.6 | jackson-databind: Potential | | | | | | | information exfiltration with | | | | | | | default typing, serialization | | | | | | | gadget from MyBatis | | | | | | | -->avd.aquasec.com/nvd/cve-2018-11307 | + +------------------+ + +--------------------------------+---------------------------------------+ | | CVE-2018-14718 | | | 2.6.7.2, 2.9.7 | jackson-databind: arbitrary code | | | | | | | execution in slf4j-ext class | | | | | | | -->avd.aquasec.com/nvd/cve-2018-14718 | + +------------------+ + + +---------------------------------------+ | | CVE-2018-14719 | | | | jackson-databind: arbitrary | | | | | | | code execution in blaze-ds-opt | | | | | | | and blaze-ds-core classes | | | | | | | -->avd.aquasec.com/nvd/cve-2018-14719 | + +------------------+ + + +---------------------------------------+ | | CVE-2018-14720 | | | | jackson-databind: exfiltration/XXE | | | | | | | in some JDK classes | | | | | | | -->avd.aquasec.com/nvd/cve-2018-14720 | + ``` -------------------------------- ### Use Wildcards in Trivy Ignore Rules (Terraform) Source: https://trivy.dev/latest/docs/scanner/misconfiguration/config/config This example illustrates the use of wildcards in Trivy ignore rules for Terraform. The rule `# trivy:ignore:aws-s3-*:ws:dev-*` ignores all checks starting with `aws-s3-` for workspaces matching the pattern `dev-*`, providing flexible exclusion patterns. ```HCL # trivy:ignore:aws-s3-*:ws:dev-* ``` -------------------------------- ### Trivy CLI Commands Reference Source: https://trivy.dev/latest/docs/coverage/iac/terraform This section lists various command-line interface (CLI) commands for Trivy, including options for cleaning, configuration, converting formats, scanning filesystems, images, Kubernetes resources, and managing modules and plugins. It details how to install, uninstall, and get information about plugins. ```CLI trivy clean trivy config trivy convert trivy filesystem trivy image trivy kubernetes trivy module trivy module install trivy module uninstall trivy plugin trivy plugin info trivy plugin install ``` -------------------------------- ### Install Trivy on Arch Linux Source: https://trivy.dev/latest/getting-started/installation Information on installing Trivy on Arch Linux via the community package repository, with references to the Arch Linux package details and PKGBUILD. ```bash sudo pacman -S trivy ``` -------------------------------- ### Trivy CLI Configuration Commands Source: https://trivy.dev/latest/getting-started Provides examples of using Trivy's command-line interface (CLI) for managing configurations, including cleaning the cache and converting scan results. ```bash trivy config --reset trivy convert --input results.json --output results.sarif ``` -------------------------------- ### Install Trivy on Debian/Ubuntu Source: https://trivy.dev/latest/getting-started/installation Steps to install Trivy on Debian and Ubuntu systems by adding the official Trivy APT repository and its GPG key. ```bash sudo apt-get install wget apt-transport-https://aquasecurity.github.io/trivy-repo/deb/public.key -O /usr/share/keyrings/trivy.gpg echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb generic main" | sudo tee -a /etc/apt/sources.list.d/trivy.list sudo apt-get update sudo apt-get install trivy ``` -------------------------------- ### Trivy CLI Plugin Install Options Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_plugin_install This shows the available options when installing a Trivy plugin, such as specifying a version or a source URL. ```bash trivy plugin install --version 1.2.3 --source https://example.com/plugin.tar.gz ``` -------------------------------- ### Install a Trivy Module Source: https://trivy.dev/latest/docs/advanced/modules Demonstrates how to install a WebAssembly module for Trivy using the `trivy module install` command. It specifies the command to download and install modules into the Trivy cache, adhering to XDG specifications for cache location. ```bash $ trivy module install ``` -------------------------------- ### Trivy CLI: Plugin Install Command Source: https://trivy.dev/latest/docs/configuration/others The 'trivy plugin install' command is used to install plugins that extend Trivy's capabilities, such as custom scanners or reporting formats. This command requires the name or path of the plugin to be installed. ```bash trivy plugin install ``` -------------------------------- ### Trivy Filesystem Scan Example Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_filesystem Demonstrates how to perform a filesystem scan using the Trivy CLI. This command scans the specified directory for vulnerabilities and misconfigurations. ```bash trivy filesystem /path/to/your/filesystem ``` -------------------------------- ### Trivy Module Install Command Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_module_install This snippet shows the basic command structure for installing a Trivy module. It specifies the repository from which the module should be installed. ```bash trivy module install [flags] REPOSITORY ``` -------------------------------- ### Trivy CLI Examples Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy Demonstrates practical usage of the Trivy CLI for common security scanning tasks. Examples cover scanning container images directly, from tar archives, local file systems, and initiating the server mode. ```bash # Scan a container image $ trivy image python:3.4-alpine # Scan a container image from a tar archive $ trivy image --input ruby-3.1.tar # Scan local filesystem $ trivy fs . # Run in server mode $ trivy server ``` -------------------------------- ### Build a Trivy Module (Go) Source: https://trivy.dev/latest/docs/advanced/modules Provides an overview of building Trivy modules using Go. It outlines key steps such as initializing a module, defining interfaces for analyzers and post-scanners, and the build process. ```Go // Initialize your module // Module interface // Analyzer interface // PostScanner interface // Build ``` -------------------------------- ### Trivy CLI: Plugin Install Command Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex The 'trivy plugin install' command is used to install plugins that extend Trivy's scanning capabilities. These plugins can add support for new languages, frameworks, or security checks. Installation typically involves specifying the plugin name or a repository URL. ```bash trivy plugin install misconf trivy plugin install https://github.com/aquasecurity/trivy-plugin-template ``` -------------------------------- ### Launch Trivy Server Source: https://trivy.dev/latest/docs/references/modes/client-server Starts the Trivy server, which automatically downloads and updates the vulnerability database. It listens on the specified address and port. To accept external connections, use '0.0.0.0' instead of 'localhost'. ```bash $ trivy server --listen localhost:8080 2019-12-12T15:17:06.551+0200 INFO Need to update DB 2019-12-12T15:17:56.706+0200 INFO Reopening DB... 2019-12-12T15:17:56.707+0200 INFO Listening localhost:8080... ``` ```bash $ trivy server --listen 0.0.0.0:8080 ``` -------------------------------- ### Trivy VEX Repo Command Options Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo Provides common options for the 'trivy vex repo' command, including help flags and configuration settings. ```bash trivy vex repo -h, --help ``` -------------------------------- ### Trivy Module Install Options Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_module_install This snippet lists the specific options available for the 'trivy module install' command, including a help flag. ```bash -h, --help help for install ``` -------------------------------- ### Trivy CLI: Module Uninstall Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_server Uninstalls a previously installed Trivy module. This helps in managing installed extensions and freeing up resources. Use the exact module name as installed. ```bash trivy module uninstall github.com/owner/repo/module ``` -------------------------------- ### Trivy CLI: Plugin Install Command Source: https://trivy.dev/latest/docs/scanner/misconfiguration/custom/schema The 'trivy plugin install' command allows users to install third-party plugins that extend Trivy's functionality. These plugins can add support for new languages, scanners, or reporting formats. Installation typically involves providing the plugin's name or a URL. ```bash trivy plugin install trivy-plugin-example ``` -------------------------------- ### Trivy Registry Login Example Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_registry_login An example demonstrating how to log in to a registry by piping a password from a file to the 'trivy registry login' command using the '--password-stdin' flag. This is a secure way to provide credentials. ```bash cat ~/my_password.txt | trivy registry login --username foo --password-stdin reg.example.com ``` -------------------------------- ### Install Trivy Plugin Source: https://trivy.dev/latest/tutorials/integrations/aws-security-hub This command installs a Trivy plugin. Ensure you have Trivy installed and the plugin name is correct. This is useful for extending Trivy's functionality with custom scanners or integrations. ```bash trivy plugin install ``` -------------------------------- ### Trivy CLI: Plugin List Source: https://trivy.dev/latest/tutorials/integrations/travis-ci Lists all installed Trivy plugins. This command helps you manage your installed plugins and check their versions. It's useful for verifying that plugins have been installed correctly. ```bash trivy plugin list ``` -------------------------------- ### List VEX Repositories Source: https://trivy.dev/latest/docs/references/configuration/cli/trivy_vex_repo Lists all configured VEX repositories. This command helps in viewing the current VEX repository setup. ```bash trivy vex repo list ``` -------------------------------- ### Example go.mod File Structure Source: https://trivy.dev/latest/docs/coverage/language/golang An example of a `go.mod` file, showing the module declaration, the Go version used, and the project's dependencies. Trivy parses this file to identify project modules and their versions for scanning. ```go module github.com/aquasecurity/trivy go 1.18 require ( github.com/CycloneDX/cyclonedx-go v0.5.0 ... ) ``` -------------------------------- ### Trivy CLI - Module Install Command Source: https://trivy.dev/latest/getting-started/faq The `trivy module install` command is used to install Trivy modules, which extend its functionality. Modules can provide custom scanning logic or integrations. ```bash trivy module install /path/to/module.tar.gz ``` -------------------------------- ### Trivy CLI: Module Install Command Source: https://trivy.dev/latest/docs/advanced/modules The 'module install' command is used to download and install Trivy modules, which extend Trivy's scanning capabilities with custom logic or data. ```bash trivy module install custom-analyzer ``` -------------------------------- ### Trivy CLI: Plugin Install Source: https://trivy.dev/latest/docs/coverage/others This command installs a Trivy plugin, which can add new scanning capabilities or modify existing ones. Plugins are typically distributed as archives and need to be installed before they can be used. ```bash trivy plugin install ./my-custom-scanner.tar.gz ```