Kavehost service configuration file

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:

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

ScanConnectionString

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 libsdk8l3.so communication provider) and the server (the KAV Engine provided by the kavehost service). The communication provider library is located in .\lib directory the KAV SDK distribution package.

When using local Unix domain sockets, always make sure to specify full paths to files referenced by pScanFileName parameter of the kaveScanFile function.

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 /tmp/.kavscan domain socket, which was used in early builds of KAV SDK, is now deprecated.

The Unix domain socket can be used for local communications only. That is the default setting will work only if client and the kavehost service are run on the same local computer. Please note, when working through a Unix domain socket only the names of the files to be scanned are passed through the socket. The file data is read by the kavehost server through the file I/O API.

By default the /tmp/.kavcomX domain sockets are used where X is the index of the scanning kavehost process. This Unix domain socket is used to organize communication between the client and kavehost service where latter performs scanning tasks.

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 libsdk8l3.so connection provider. Make sure to open the provided port for incoming connections from the computer where the libsdk8l3.so library is called on. Note that files passed for scanning will be transferred via network resulting in increased network load.

ComConnectionString

A Unix domain socket or a TCP socket that will be used by the kavehost service to receive commands (scanning tasks) from your application.

This socket is used to organize command communication endpoint for exchanging commands between the client (your application working with the KAV Engine via the libsdk8l3.so communication provider) and the server (the KAV Engine provided by the kavehost service).

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 kavehost service.

By default the /tmp/.kavcom domain socket is used.

The Unix domain socket can be used for local communications only. That is the default setting will work only if your application and the kavehost service run on the same local computer. Please note, when working through a Unix domain socket only the names of the files to be scanned are passed through the socket. The file data is read by the kavehost server though the file I/O API.

By default the /tmp/.kavcom domain sockets is used. This Unix domain socket is used to organize command channel for communicating tasks between the client and kavehost service where latter performs scanning tasks.

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 libsdk8l3.so connection provider. Make sure to open the provided port for incoming connections from the computer where the libsdk8l3.so library is called on. The library should be installed locally on the client computer.

EventConnectionString

A Unix domain socket (IPC socket) used by the kavehost service for diagnostics and notification. This socket is used to organize event communication endpoint for exchanging events between the client (your application working with the KAV Engine via the libsdk8l3.so communication provider) and the server (the KAV Engine provided by the kavehost service) and the server (KAV Engine provided by the kavehost service).

Similar to the standard error output stream, the event channel for this socket is used to route event codes and error messages from the kavehost service to the your application. Using this channel the KAV Engine makes you aware of scanning results.

The /tmp/.kavevent domain socket, which was used in early builds of KAV SDK, is now deprecated.

The Unix domain socket can be used for local communications only. That is the default setting will work only if your application and the kavehost service are run on the same local computer. Please note, when working through a Unix domain socket only the names of the files to be scanned are passed through the socket. The file data is read by the kavehost server though the file I/O API.

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 libsdk8l3.so connection provider. Make sure to open the provided port for incoming connections from the computer where the libsdk8l3.so library is called on. The library should be installed locally on the client computer. Once the connection is installed from the client side to the server, the organized channel is bidirectional and the raised events are passed from server to client.

MaxScannersCount

The maximum number of processes that can be spawned by the kavehost for scanning of files. The more the number of processes, the more files can be processed by the service at a time.

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 MaxScannersCount element to at least 30. These processes are spawned by kavehost to handle requests from your clients. Once a client thread exits, the corresponding kavehost process, assigned to handle thread’s request, exits as well.

If your configuration requires that you must frequently— more than 5 times per second—connect and disconnect your clients to or from kavehost service, consider increasing the value of MaxScannersCount setting by 1.5 times from the values used in versions with lower load.

Setting this parameter is useful for multiprocessing. The kavehost service processes one scan task at a time. Each kavehost process is allocated for scanning of a unique file. Multiprocessing allows you to spawn several child kavehost processes each dedicated to processing of a single file.

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:

ps -o user,pid,ppid,command -AH | grep kavehost

Alternatively, run pstree <PID>,

where PID is the process identifier of the parent kavehost process. Type pidof kavehost to get the PID.

The default value is 10. This parameter must be defined; empty values are not allowed.

This parameter is also defined in the dwScanningThreadsCount argument of the initialization function kaveInitializeEx. If the value passed to the dwScanningThreadsCount argument of the kaveInitializeEx function differs from the one specified in the MaxScannersCount parameter of the kavehost.xml configuration file, the minimum of the two is used.

Flags

One of the anti-virus database loading options described in the "Anti-virus database loading options" table within the kaveInitialize section.

The flag specifies initialization option for the KAV Engine and sets the Engine's host type to be used by the kavehost service for unpacking of files.

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:

KAV_SHT_ENGINE_KLAV| KAV_SHT_ENGINE_KLAVEMU

This setting sets the bitmask, which specifies that KAV SDK should start the following engines:

  • Main scanning engine
  • Heuristic emulation engine
  • Stream scanning engine used by Web Monitor component

    Please do not confuse and do not mix these flags with scanner host type flags provided in the "Scanner host types" table within the kaveInitialize section:

  • KAV_SHT_INPROC
  • KAV_SHT_OUTPROC
  • KAV_SHT_SERVICE

    These flags enable different hosting models for the KAV Engine.

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

TempPath

A path to a directory to be used by the kavehost service to store temporary files when scanning files.

Temporary files are typically created for unpacking, when scanning archives or packed executables.

The default value is /tmp.

If you specify an empty value, the /tmp temporary directory will be used. Alternatively, a directory, which is currently specified in the $TEMPDIR system environment variable will be used.

Use the env command to display system environment variables.

BasePath

A path to a directory storing the anti-virus database used by the kavehost service for scanning of files.

This is typically the /var/kaspersky/bases directory.

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 kavehost will be unable to start.

If you specify an empty value, the kavehost service will be looking for the database in the /bases directory under the kavehost's program directory.

It is recommended that you regularly update the anti-virus database and obtain the most recent data and virus detection mechanisms for the kavehost's use.

PidPath

A full path to the PID file for the kavehost service. This file will be automatically created by the kavehost at the given path. The PID file allows the operating system to distinguish between processes with the same name.

By default the following file will be automatically created by the kavehost sevice: /var/run/kavehost.pid. If you are using security enhanced Linux, make sure to provide access to the /var/run directory for the kavehost process.

LicensePath

A path to the directory where the application ID file (appinfo.kli) and license key (a *.key file) files are stored.

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 kavehost ELF executable file (\opt\kav\sdk8l3\bin\ by default). Then, it will look for these files within the directory where the communication provider libsdk8l3.so library is stored.

For more information about license key files, appinfo.kli file and licensing modes, see section "Licensing".

LicensingMode

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:

Fix the values if they are out of the allowed boundaries.

KSN settings for the kavehost service

Element

Description

UrlCheckTimeoutMs

The maximum time, in milliseconds, that KAV SDK waits for response KSN when running on-demand reputation checks for URL addresses.

Default value: 20000

Setting the cache size to 0 configures KAV SDK to not use this timeout.

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: 10000

Setting the cache size to 0 configures KAV SDK to not use this timeout.

CacheSizeKb

The maximum size, in Kbytes, scanning statuses returned from KSN that can be stored in the of status cache.

Setting the cache size to 0 configures KAV SDK to not cache KSN scanning statuses.

Default value: 30720.

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

Host

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).

Page top