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:
kavhttpd.xml on the host computer.<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>
kavhttpd.xml.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.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:
kaspersky_httpd_kubernetes.yaml.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.
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.kaspersky_httpd_kubernetes.yaml.kavhttpd.xml configuration file.<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>
kavhttpd.xml.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%
kubectl apply -f kaspersky_httpd_kubernetes.yaml
Notice that you must specify the path to the container directory with the files to scan.