Scanning

In most cases, you can scan objects with Kaspersky Scan Engine, when it is deployed in Kubernetes or Docker, in the same way that you would with Kaspersky Scan Engine installed on your computer. However, there are several exceptions.

Scanning files in HTTP mode

Kaspersky Scan Engine scans files by using the scanfile API method (/api/v3.0/scanfile in KAV protocol version 3 and /api/v1.0/scanfile KAV protocol versions 1 and 2). In a Docker container, this method works only if you configure the environment appropriately.

To scan files in an individual Docker container:

  1. On the host computer, find the directory that contains the files that you want to scan.
  2. Open kavhttpd.xml on the host computer.
  3. In the <ScanningPath> element, specify the path to the container directory where the directory from step 1 will be mounted to the container:

    <ScanningPaths>

    <ScanningPath>%path to the container directory with the files to scan%</ScanningPath>

    </ScanningPaths>

  4. Save and close kavhttpd.xml.
  5. Run the Kaspersky Scan Engine Docker container:

    docker run -d -p 8080:8443 -p 8085:9998 -v %host_scan_dir%:%cont_scan_dir% -v %host_conf_dir%:/tmp/scanengine/mounted --name ScanEngineHTTPD kaspersky/scanengine_httpd:%KSE_VERSION%

    In the command above:

    • %host_scan_dir% is the host directory containing the objects to scan.
    • %cont_scan_dir% is the container directory containing the objects to scan.
    • %host_conf_dir% is the host directory containing the configuration files (must be located in the /configs directory) and the key file or activation code (must be located in the /lic directory).
    • %KSE_VERSION% is the version of Kaspersky Scan Engine used in Docker images. For example, 2.0.0.1157.
  6. Scan the files by making an HTTP request. Notice that you must specify the path to the container directory with the files to scan.

If you want to use the scanfile API method in a Docker container deployed in Kubernetes, follow the steps below.

To scan files in Kubernetes:

  1. Open kaspersky_httpd_kubernetes.yaml.
  2. Under the volumes field add the following strings:

    - name: %PersistentVolumeClaim name%

    PersistentVolumeClaim:

    claimName: %PersistentVolumeClaim%

    In the strings above:

    %PersistentVolumeClaim name% is the custom name of this setting (for example, kl_scandir).

    %PersistentVolumeClaim% is the name of the PersistentVolumeClaim that contains the directory above.

  3. Under the containers/volumeMounts field add the following strings:

    - mountPath: %Pod directory with the files to scan%

    name: %PersistentVolumeClaim name%

    In the strings above:

    • %Pod directory with the files to scan% is the path to the directory in the Kaspersky Scan Engine pod that contains the objects to scan.
    • %PersistentVolumeClaim name% is the name of the setting specified in step 2.
  4. Save and close kaspersky_httpd_kubernetes.yaml.
  5. Open the kavhttpd.xml configuration file.
  6. In the <ScanningPath> element, specify the path to the directory that was specified in the mountPath in step 3:

    <ScanningPaths>

    <ScanningPath>%POD directory with the files to scan%</ScanningPath>

    </ScanningPaths>

  7. Save and close kavhttpd.xml.
  8. Update kavhttpd.xml in Kubernetes:

    kubectl delete configmap kl-configuration-file -n kaspersky

    kubectl create configmap kl-configuration-file -n kaspersky --from-file=%path to the directory with the configuration files%

  9. Load the configuration from the Kubernetes YAML file:

    kubectl apply -f kaspersky_httpd_kubernetes.yaml

  10. Scan the files by making an HTTP request.

    Notice that you must specify the path to the container directory with the files to scan.

Page top