The main scanning functionality on a UNIX-based platform is provided by the kavehost service. It is an ELF binary that exposes the KAV Engine for external use and by default resides in the /opt/kav/sdk8l3/bin/ directory within the KAV SDK distribution package.
The settings of the kavehost service are stored in a configuration file. The file is written in XML and by default has the same name as the service—kavehost.xml.
The configuration file, which should be located in the /etc directory, contains settings used by the KAV Engine at the kavehost runtime. These settings provide information about service connection settings, location of the anti-virus database, the licensing mode that should be enabled at the start, initialization settings for the KAV Engine, and performance configuration.
If you are running the kavehost service executable directly from the terminal (that is without using the service init script), make sure the kavehost.xml file is located in the same folder with the kavehost service. Alternatively, specify the kavehost.xml configuration file right at the command prompt, when starting the service: ./kavehost –с /usr/bin/kavehost.xml. The service init script should be located in, for example, the SDK_FOLDER/init.d directory.
The XML configuration file contains a root <Settings> element that contains several child elements. Each of the child elements corresponds to a particular setting for the KAV Engine and contains values for each the specific setting.
The default configuration file looks as follows:
<?xml version="1.0"?>
<Settings>
<Required>
<ConnectionSettings>
<!--Connection settings used when your client application and
the kavehost service are located on different computers.
In this example both run on the same computer and the
kavehost service listens for incoming TCP connections on all
interfaces present on the local PC (current network, see RFC 5735).
These settings are commented because UNIX sockets are used.
-->
<!--
<ComConnectionString>0.0.0.0:7776</ComConnectionString>
<ScanConnectionString>0.0.0.0:7777</ScanConnectionString>
<EventConnectionString>0.0.0.0:7778</EventConnectionString>
-->
<!--Connection settings used when your client application and
the kavehost service are located on the same computer.
The service listens for incoming connections on
a UNIX domain socket.
-->
<ScanConnectionString>/tmp/.kavcom</ScanConnectionString>
<ComConnectionString>/tmp/.kavcom</ComConnectionString>
<EventConnectionString>/tmp/.kavcom</EventConnectionString>
<!--Number of instances of the kavehost process spawned for
simultaneous processing of scanning tasks.
-->
<MaxScannersCount>10</MaxScannersCount>
<!--Types of scanning engines (scanning host type, see the
dwScannerHostType parameter of the kaveIntializeEx function)
that will be used for scanning.
-->
<Flags>KAV_SHT_ENGINE_KLAV|KAV_SHT_ENGINE_KLAVEMU</Flags>
</ConnectionSettings>
<DirectorySettings>
<!--A temporary directory used by kavehost service to store
files created at the runtime. This directory will be used for
storing archive contents when scanning multipacked archives.
-->
<TempPath>/tmp</TempPath>
<!--A path to the directory storing the anti-virus database.
Please change this placeholder to an actual path in your
environment before starting the kavehost service.
-->
<BasePath>/path/to/bases</BasePath>
<!--A full path to PID-file for the kavehost service.
The file is automatically created by the service on
the startup and used at the runtime to distinguish
between the instances of the service.
-->
<PidPath>/var/run/kavehost.pid</PidPath>
<!--A path to the *.key and *.kli files used by
licensing subsystem and the licensing mode; simplified
licensing mode is used by default (the value of 1).
The block of settings is commented, the following block
is used instead.
-->
<!--
<LicensePath>/path/to/license</LicensePath>
<LicensingMode>1</LicensingMode>
-->
<!--Alternative setting for licensing subsystem. The path
is empty; the kavehost service seeks for *.key and *.kli files
in its program directory.
-->
<LicensePath></LicensePath>
<LicensingMode>1</LicensingMode>
</DirectorySettings>
<!--Configuration details to connect to KSN cloud services.
<KSNSettings>
<UrlCheckTimeoutMs></UrlCheckTimeoutMs>
<ObjectCheckOnDemandTimeoutMs></ObjectCheckOnDemandTimeoutMs>
<CacheSizeKb></CacheSizeKb>
</KSNSettings>
-->
<!--Configuration details to connect through a proxy.
<ProxySettings>
<Host></Host>
<Port></Port>
<User></User>
<Pass></Pass>
</ProxySettings>
-->
</Required>
</Settings>
The child elements of the configuration file are grouped into two parts, each of which is exposed in XML as a unique parent element. The parent elements logically split settings necessary for configuring different functionality of the kavehost service. These parent elements include sub-elements that serve as containers for other configuration settings specific to each of the parent elements.
The XML file contains the following parent elements:
ConnectionSettingsThis element contains connection settings. The settings determine service sockets, used by your application to connect to the kavehost service, and KAV Engine options, which define symmetric processing and KAV Engine initialization flags.
When using local Unix domain sockets, always make sure to specify full paths to files that you pass for scanning by KAV Engine. When your application calculates a relative path, it is calculated based on the working directory of your application. The kavehost service calculates paths relative to its own working directory; it will not be able to locate files passed from your application because the paths will have different base paths on the client and service sides.
Note that your application always connects to the KAV Engine, which is wrapped by the kavehost service, via the communication provider implemented in the libsdk8l3.so library.
DirectorySettingsThe element includes settings that define environmental settings for the kavehost service. Here you specify the location path for the anti-virus database, location of the PID file, where the kavehost service stores its process identifier that helps the operating system distinguish between the different kavehost instances. Also in this element you define the path to license key (*.key) and application info file (*.kli), necessary for the licensing subsystem, and a path to the temporary directory that can be used by kavehost to store temporary files, created at the runtime.
The following table lists settings that configure connection to the kavehost service. These elements are nested within the ConnectionSettings element.
Kavehost service connection settings
Element |
Description |
|---|---|
|
A Unix domain socket or a TCP socket that will be used by the kavehost service to receive files passed from your application for scanning by KAV Engine. A Unix domain socket (IPC socket) is used by the kavehost service for managing scanning tasks. This socket is used to organize data communication endpoint for exchanging files between the client (your application working with the KAV Engine via the When using local Unix domain sockets, always make sure to specify full paths to files referenced by The data channel for this socket is used to route objects between the client and the server. The files passed for scanning from your application are transferred via this data channel. The The Unix domain socket can be used for local communications only. That is the default setting will work only if client and the By default the It is recommended that Unix domain sockets are used for communication with the kavehost service where possible. Using domain sockets significantly boosts performance when scanning files. Even though it is possible to connect to the kavehost service via TCP sockets when both the client and the server run on the same local computer, best practices are to use Unix domain sockets for performance sake. If your application and the kavehost service must be run on a separate computers on a network, you can specify a TCP socket here. Provide the IP address of the computer, where you run the kavehost service and the TCP port, which will be used by the service to listen for incoming connections from the |
|
A Unix domain socket or a TCP socket that will be used by the This socket is used to organize command communication endpoint for exchanging commands between the client (your application working with the KAV Engine via the Similar to the control connection of the FTP service, the command channel for this socket is used to route commands, which are passed from your application to the By default the The Unix domain socket can be used for local communications only. That is the default setting will work only if your application and the By default the If your application and the |
|
A Unix domain socket (IPC socket) used by the Similar to the standard error output stream, the event channel for this socket is used to route event codes and error messages from the The The Unix domain socket can be used for local communications only. That is the default setting will work only if your application and the If your application and the |
|
The maximum number of processes that can be spawned by the This value should be no less than the total number of all threads spawned by all client applications, which is calculated as a product of a number of client processes and number of scanning threads started by these processes. For example, if there are 10 client applications spawning 3 scanning threads each, set the If your configuration requires that you must frequently— more than 5 times per second—connect and disconnect your clients to or from Setting this parameter is useful for multiprocessing. The If this parameter is set, for example, to 10, then the eleventh simultaneous scanning task will have to wait in queue. You can view the spawned process by running the following command at the shell prompt:
Alternatively, run where PID is the process identifier of the parent The default value is 10. This parameter must be defined; empty values are not allowed. This parameter is also defined in the |
|
One of the anti-virus database loading options described in the "Anti-virus database loading options" table within the The flag specifies initialization option for the KAV Engine and sets the Engine's host type to be used by the You can combine the flags using the logical OR operation to enable the KAV SDK to load several supported scanning engines. For example, you may specify the following value for the Flags element:
This setting sets the bitmask, which specifies that KAV SDK should start the following engines:
|
The following table lists all settings that configure environment options for the kavehost service. These elements are nested within the DirectorySettings element.
Directory settings for the kavehost service
Element |
Description |
|---|---|
|
A path to a directory to be used by the Temporary files are typically created for unpacking, when scanning archives or packed executables. The default value is If you specify an empty value, the Use the |
|
A path to a directory storing the anti-virus database used by the This is typically the Please change the default value to the one specified at a time of installing the Kaspersky Anti-Virus Software Development Kit. The database is an integral part of the Kaspersky Anti-Virus Software Development Kit necessary for the KAV Engine to initialize properly. If the anti-virus database is missing or corrupted, the If you specify an empty value, the It is recommended that you regularly update the anti-virus database and obtain the most recent data and virus detection mechanisms for the |
|
A full path to the PID file for the By default the following file will be automatically created by the kavehost sevice: |
|
A path to the directory where the application ID file ( If the path is not specified, the Kaspersky Anti-Virus Software Development Kit looks for the application ID file and the license keys in the directory with the For more information about license key files, |
|
The licensing mode. If a zero value is passed to this parameter, the full licensing mode will be used. If 1 (0) is specified, the application will use the simplified licensing mode. For more information about licensing modes, see section "Licensing". |
The following table lists all settings that configure KSN cloud connectivity options for the kavehost service. These elements are nested within the KSNSettings element.
To use default settings for KSN connectivity, comment out the KSNSettings element and all the child elements within. To configure KAV SDK to use default setting for a specific child element within the KSNSettings, comment out only the child element.
When initializing KAV SDK in service mode, if you receive an error message about improper configuration of the service configuration file, check that:
UrlCheckTimeoutMs and ObjectCheckOnDemandTimeoutMs are greater than or equal to 0 (zero).CacheSizeKb is greater than 0 and less or equal to 262143 (2^18-1 Kbytes).Fix the values if they are out of the allowed boundaries.
KSN settings for the kavehost service
Element |
Description |
|---|---|
|
The maximum time, in milliseconds, that KAV SDK waits for response KSN when running on-demand reputation checks for URL addresses. Default value: Setting the cache size to |
ObjectCheckOnDemandTimeoutMs |
The maximum time, in milliseconds, that KAV SDK waits for the response from KSN cloud when running on-demand reputation checks for files in synchronous mode. Default value: Setting the cache size to |
CacheSizeKb |
The maximum size, in Setting the cache size to Default value: |
The following table lists all settings that configure proxy connectivity options for the kavehost service. These elements are nested within the ProxySettings element.
Proxy settings for the kavehost service
Element |
Description |
|---|---|
|
The proxy server IP address (IPv4 or IPv6) or host name. |
Port |
The TCP port number of the remote proxy server. If you configure firewall rules, specify this port as a destination port (as defined in proxy configuration). |
User |
A user name to access the proxy server (as defined in proxy configuration). |
Pass |
A password for the specified user name to authenticate on the proxy server (as defined in proxy configuration). |