Installing a scanner agent via dockerization
If you want to scan a website in a demilitarized zone (DMZ), internal networks that are not publicly accessible, you can install Invicti scanner agents in your network. You can install the Invicti Enterprise scanner agent on any operating system that has Docker.
Using Docker means you don't need to install redundant files like drivers or operating system kernels, for example.
This guide explains how to install the Invicti Enterprise scanner agent on Windows, Linux, or macOS operating systems using dockerization. The steps are the same for each operating system except for the steps for installing Docker (which are outside the scope of this article).
NOTE: To detect out-of-band vulnerabilities via Invicti Hawk, you need to allowlist the following ports on your agent server: TCP 80 and 443 and UDP 53. For more information about Invicti Hawk, refer to How Invicti Hawk Finds Vulnerabilities. |
PREREQUISITES:
|
Downloading and installing the agent
You need to download the installation files of the agent to a machine on your internal network.
There are four steps to this process:
- Download the Docker scanner agent
- Install the Docker scanner agent
- Install ClamAV for the Docker scanner agent (This step is optional)
- Run the Docker scanner agent
Step 1: How to download the Docker scanner agent
- Log in to Invicti Enterprise.
- From the main menu, go to Agents > Manage Agents > + Configure New Agent.
- From the Agent section, select Docker to download the installation file.
Step 2: How to install the scanner agent
- Extract the TAR file:
7z x Invicti_Enterprise_Scanner_Docker_Agent.tar |
- Navigate to the extracted file and run the following command to load the image file:
docker load < InvictiEnterprise_Scan_Agent.tar |
After entering this command, the system starts to load the image. It may take some time. Once the image has loaded, a welcome message is displayed.
- Create a user and a group called “invicti”. These are required because the Docker agent runs with a non-root user. Then, add this new user to the Docker group.
groupadd -g 1001 invicti useradd -u 1001 -r -g 1001 -d /home/invicti -s /bin/bash invicti mkdir -p /home/invicti chown -R invicti:invicti /home/invicti usermod -aG docker invicti |
- Switch to the invicti user and create a directory to always save the logs in the same path.
su - invicti mkdir invictiLogs # creates a folder to store agent logs |
Step 3: How to install ClamAV for the Docker scanner agent
NOTE: ClamAV is required if you want the Invicti Enterprise Docker scanner agent to run malware analysis. If you do not, you can skip this step. |
- To pull and run the latest ClamAV image, run the following command:
docker run --name clamav -d -p 3310:3310 clamav/clamav:latest |
Step 4: How to run the Docker scanner agent
- Execute the following command to create a container:
docker run -d --name {container name} --restart=always \ --volume "$(pwd)/invictiLogs:/app/Logs" \ -e "ApiRootUrl={api url}" \ -e "ApiToken={api token}" \ -e "AgentName={agent name}" \ -e "AgentMode=Scanner" \ -e "IgnoreSslCertificateErrors=false" \ -e "ClamAvServiceAddress={ClamAV container Host IP}" \ -e "ClamAvServicePort=3310" \ registry.invicti.com/ie-agent:latest |
The command docker run boots up a container. The table below lists and explains the parameters required to further configure the container:
Parameter | Description |
-d: | This denotes daemon mode. The container will work in the background. |
--name: | This gives a name to the container. |
--user | This instructs the container to run with this user. |
--restart=always: | This makes the container start automatically when the Docker service starts. |
--volume: | The parameters mount a directory in the container with a directory in the host. This setting allows you to see agent reports. |
-e: | This parameter is used to set the environment variable for the container. The ApiToken, ApiRootUrl, and AgentName settings will be used by the scanner agent. AgentName: This can be anything you want. This text will be displayed when you are starting a new Scan. (If you plan to install more than one instance of the agent, make sure you set a unique agentName value for each instance, as it will be needed later). ApiToken: In Invicti Enterprise, the Agent Token is displayed on the Configure New Agent page. Copy this value into the apiToken. (From the main menu, go to Agents > Manage Agents > Configure New Agent. In the Agent Token field, select Copy to clipboard.) ApiRootUrl: This would be the URL of Invicti Enterprise On-Demand or Invicti Enterprise Web On-Premises. ScanDataFolderPath: This would be your scan data folder. (This is optional). If you want to change the default folder for saving the scan data, add the following parameter before running the container: -e "ScanDataFolderPath={Scan data folder}"\ IgnoreSslCertificateErrors: This would ignore any SSL certificate errors on the scan target website. ClamAvServiceAddress: This is the IP Address of the ClamAV container host. (This is optional). ClamAvServicePort: This is the Port number that ClamAV listens to. (This is optional). |
agent:{tag}: | This is the image name from which the container will be created. The name of the image is agent, whereas {tag} is the version number of the image. We used latest in our example to pull the most recent version. |
- After the command is executed, the container is created. To see the result, you can execute the following command:
docker container ls |
- The scanner agent container is now installed. You can check its status in Invicti Enterprise by going to Agents > Manage Agents.
- Now, you can start a scan through the scanner agent you just installed. To do that, navigate to Scans > New Scan and select a website whose agent mode is Internal. Then, among other settings required to start a scan, you can also select which agent will scan the target.