diff --git a/docs/docs.json b/docs/docs.json index 21f65e027f..3b89e17a2a 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -274,7 +274,8 @@ { "group": "Image", "pages": [ - "user-guide/providers/image/getting-started-image" + "user-guide/providers/image/getting-started-image", + "user-guide/providers/image/authentication" ] }, { diff --git a/docs/user-guide/img/add-registry-url.png b/docs/user-guide/img/add-registry-url.png new file mode 100644 index 0000000000..df1319ea15 Binary files /dev/null and b/docs/user-guide/img/add-registry-url.png differ diff --git a/docs/user-guide/img/image-authentication-filters.png b/docs/user-guide/img/image-authentication-filters.png new file mode 100644 index 0000000000..da56306e83 Binary files /dev/null and b/docs/user-guide/img/image-authentication-filters.png differ diff --git a/docs/user-guide/img/image-verify-connection.png b/docs/user-guide/img/image-verify-connection.png new file mode 100644 index 0000000000..26bd900062 Binary files /dev/null and b/docs/user-guide/img/image-verify-connection.png differ diff --git a/docs/user-guide/img/select-container-registry.png b/docs/user-guide/img/select-container-registry.png new file mode 100644 index 0000000000..50fd9c3177 Binary files /dev/null and b/docs/user-guide/img/select-container-registry.png differ diff --git a/docs/user-guide/providers/image/authentication.mdx b/docs/user-guide/providers/image/authentication.mdx new file mode 100644 index 0000000000..78dcd8318c --- /dev/null +++ b/docs/user-guide/providers/image/authentication.mdx @@ -0,0 +1,50 @@ +--- +title: "Image Authentication in Prowler" +--- + +Prowler's Image provider enables container image security scanning using [Trivy](https://trivy.dev/). No authentication is required for public images. Prowler supports the following authentication methods for private registries: + +* [**Basic Authentication (Environment Variables)**](https://trivy.dev/latest/docs/advanced/private-registries/docker-hub/): `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` +* [**Token-Based Authentication**](https://distribution.github.io/distribution/spec/auth/token/): `REGISTRY_TOKEN` +* [**Manual Docker Login**](https://docs.docker.com/reference/cli/docker/login/): Existing credentials in Docker's credential store + +Prowler uses the first available method in this priority order. + +## Basic Authentication (Environment Variables) + +To authenticate with a username and password, set the `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` environment variables. Prowler passes these credentials to Trivy, which handles authentication with the registry transparently: + +```bash +export REGISTRY_USERNAME="myuser" +export REGISTRY_PASSWORD="mypassword" + +prowler image -I myregistry.io/myapp:v1.0 +``` + +Both variables must be set for this method to activate. + +## Token-Based Authentication + +To authenticate using a registry token (such as a bearer or OAuth2 token), set the `REGISTRY_TOKEN` environment variable. Prowler passes the token directly to Trivy: + +```bash +export REGISTRY_TOKEN="my-registry-token" + +prowler image -I myregistry.io/myapp:v1.0 +``` + +This method is useful for registries that support token-based access without requiring a username and password. + +## Manual Docker Login (Fallback) + +If no environment variables are set, Prowler relies on existing credentials in Docker's credential store (`~/.docker/config.json`). To configure credentials manually before scanning: + +```bash +docker login myregistry.io + +prowler image -I myregistry.io/myapp:v1.0 +``` + + +This method is available in Prowler CLI only. In Prowler Cloud, use basic authentication or token-based authentication instead. + diff --git a/docs/user-guide/providers/image/getting-started-image.mdx b/docs/user-guide/providers/image/getting-started-image.mdx index 821478efa6..9a3d67258d 100644 --- a/docs/user-guide/providers/image/getting-started-image.mdx +++ b/docs/user-guide/providers/image/getting-started-image.mdx @@ -9,18 +9,69 @@ Prowler's Image provider enables comprehensive container image security scanning ## How It Works * **Trivy integration:** Prowler leverages [Trivy](https://trivy.dev/) to scan container images for vulnerabilities, secrets, misconfigurations, and license issues. -* **Trivy required:** Trivy must be installed and available in the system PATH before running any scan. * **Authentication:** No registry authentication is required for public images. For private registries, credentials can be provided via environment variables or manual `docker login`. + * Check the [Image Authentication](/user-guide/providers/image/authentication) page for more details. +* **Mutelist logic:** [Filtering](https://trivy.dev/latest/docs/configuration/filtering/) is handled by Trivy, not Prowler. * **Output formats:** Results are output in the same formats as other Prowler providers (CSV, JSON, HTML, etc.). + + + Scan container images using Prowler Cloud + + + Scan container images using Prowler CLI + + + +## Prowler Cloud + + + +### Supported Scanners + +Prowler Cloud does not support scanner selection. The vulnerability, secret, and misconfiguration scanners run automatically during each scan. + +### Step 1: Access Prowler Cloud + +1. Navigate to [Prowler Cloud](https://cloud.prowler.com/) or launch [Prowler App](/user-guide/tutorials/prowler-app) +2. Navigate to "Configuration" > "Cloud Providers" + + ![Cloud Providers Page](/images/prowler-app/cloud-providers-page.png) + +3. Click "Add Cloud Provider" + + ![Add a Cloud Provider](/images/prowler-app/add-cloud-provider.png) + +4. Select "Container Registry" + + ![Select Container Registry](/user-guide/img/select-container-registry.png) + +5. Enter the container registry URL (e.g., `docker.io/myorg` or `myregistry.io`) and an optional alias, then click "Next" + + ![Add Container Registry URL](/user-guide/img/add-registry-url.png) + +### Step 2: Enter Authentication and Scan Filters + +6. Optionally provide [authentication](/user-guide/providers/image/authentication) credentials for private registries, then configure the following scan filters to control which images are scanned: + + * **Image filter:** A regex pattern to filter repositories by name (e.g., `^prod/.*`) + * **Tag filter:** A regex pattern to filter tags within repositories (e.g., `^(latest|v\d+\.\d+\.\d+)$`) + + Then click "Next" + + ![Image Authentication and Filters](/user-guide/img/image-authentication-filters.png) + +### Step 3: Verify Connection & Start Scan + +7. Review the provider configuration and click "Launch scan" to initiate the scan + + ![Verify Connection & Start Scan](/user-guide/img/image-verify-connection.png) + + ## Prowler CLI - -The Image provider is currently available in Prowler CLI only. - - ### Install Trivy Install Trivy using one of the following methods: @@ -55,7 +106,7 @@ Prowler CLI supports the following scanners: * [Misconfiguration](https://trivy.dev/docs/latest/guide/scanner/misconfiguration/) * [License](https://trivy.dev/docs/latest/guide/scanner/license/) -By default, only vulnerability and secret scanners run during a scan. To specify which scanners to use, refer to the [Specify Scanners](#specify-scanners) section below. +By default, vulnerability, secret, and misconfiguration scanners run during a scan. To specify which scanners to use, refer to the [Specify Scanners](#specify-scanners) section below. ### Scan Container Images @@ -112,7 +163,7 @@ Valid examples: #### Specify Scanners -To select which scanners Trivy runs, use the `--scanners` option. By default, Prowler enables `vuln` and `secret` scanners: +To select which scanners Trivy runs, use the `--scanners` option: ```bash # Vulnerability scanning only @@ -272,7 +323,7 @@ To scan images from private registries, the Image provider supports three authen #### 1. Basic Authentication (Environment Variables) -To authenticate with a username and password, set the `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` environment variables. Prowler automatically runs `docker login`, pulls the image, and performs a `docker logout` after the scan completes: +To authenticate with a username and password, set the `REGISTRY_USERNAME` and `REGISTRY_PASSWORD` environment variables. Prowler passes these credentials to Trivy, which handles authentication with the registry transparently: ```bash export REGISTRY_USERNAME="myuser" @@ -281,7 +332,7 @@ export REGISTRY_PASSWORD="mypassword" prowler image -I myregistry.io/myapp:v1.0 ``` -Both variables must be set for this method to activate. Prowler handles the full lifecycle — login, pull, scan, and cleanup — without any manual Docker commands. +Both variables must be set for this method to activate. #### 2. Token-Based Authentication @@ -306,7 +357,7 @@ prowler image -I myregistry.io/myapp:v1.0 ``` -When basic authentication is active (method 1), Prowler automatically logs out from all authenticated registries after the scan completes. Manual `docker login` sessions (method 3) are not affected by this cleanup. +Credentials provided via environment variables are only passed to the Trivy subprocess and are not persisted beyond the scan. ### Troubleshooting Common Scan Errors