Kaspersky Scan Engine

Running Kaspersky Scan Engine in ICAP mode with the init script

You can run Kaspersky Scan Engine in ICAP mode by using the kavicapd service init script located in the %service_dir%/etc/init.d directory. The init script allows you to run the service manually from the command line or add it as a startup script.

Preparing the init script

By default, the kavicapd init script searches for the kavicapd executable file in the /opt/kaspersky/ScanEngine/bin directory. If you want to use the kavicapd service from another location, edit the init script accordingly. The DAEMON_DIR variable in the kavicapd script defines the path to the kavicapd executable file.

To prepare the kavicapd init script:

  1. Open the kavicapd.sh script for editing.
  2. Specify paths to plugins and libraries.
  3. Locate the following code:

    ########## ICAP service configuration ##########

    DAEMON_DIR="${SDKPATH}/bin"

    DAEMON="${DAEMON_DIR}/kavicapd"

    PIDFILE=/var/run/kavicapd.pid

    CONFILE=/etc/kavicapd.xml

  4. If required, manually set the value of the DAEMON_DIR variable to the kavicapd executable file location.
  5. Set the value of the PIDFILE variable to the kavicapd PID file location.

    If the PID file does not exist, the process initiated by the kavicapd.sh script will create it.

  6. Set the value of the CONFILE variable to the ICAP mode configuration file location.
  7. Locate the following line:

    STATUS_FILE_PATH=/tmp/kavicapd

  8. Set the value of the STATUS_FILE_PATH variable to the directory that will contain the status file of the kavicapd service.

    The value of this variable must be the same as the value of TempPath in the ICAP mode configuration file.

  9. Locate the following line:

    UPDATE_SIGNAL="USR1"

  10. Set the value of the UPDATE_SIGNAL variable to the signal that will be used to update and reload the database (updatedb command).

    Specify USR1 to use SIGUSR1, or USR2 to use SIGUSR2.

    If the kavicapd service receives a USR signal (SIGUSR1 or SIGUSR2) that is not specified in this parameter, the service stops (this is the default behavior of Linux programs). Consider this behavior when specifying a value for this parameter.

  11. Save the file and close the editor.

Running the service with the init script

The kavicapd.sh init script supports the following commands:

  • start—Start the kavicapd service.

    After this command is executed, the script prints [OK] and immediately returns control to the terminal, but it takes the service some time to start.

  • stop—Stop the kavicapd service.
  • restart—Restart the kavicapd service (that is, stop and then start the service).

    After this command is executed, the script prints [OK] and immediately returns control to the terminal, but it takes the service some time to start.

  • updatedb—Send a SIGUSR1 or SIGUSR2 signal (as specified in the UPDATE_SIGNAL parameter of the init script) to the kavicapd service.

    The kavicapd service handles this signal either by reloading or by updating and then reloading the database, as specified in the ICAP mode configuration file.

  • status—Show the status of the kavicapd service.

    Status message contains the following information:

    • KAV SDK version
    • ICAP version
    • Information about the anti-virus database
    • Information about the key file or activation code

    Following is an example of the status command output in simplified licensing mode:

    kavicapd (pid 1107) is running...

    KAV SDK version: KAV SDK v8.5.1.83

    ICAPD version: KL ICAP Service v1.0 (KAV SDK v8.5.1.83)

    Database release date: 2015-Sep-14 07:46:00

    Records in the database: 4308101

    Key file name: EXAMPLE.key

    Key file expiration date: 2019-Jan-12 20:00:00

    Days left: 590

    Following is an example of the status command output in online licensing mode.

    kavicapd (pid 1107) is running...

    KAV SDK version: KAV SDK v8.5.1.83

    ICAPD version: KL ICAP Service v1.0 (KAV SDK v8.5.1.83)

    Database release date: 2015-Sep-14 07:46:00

    Records in the database: 4308101

    Activation code: EXMPL-*****-*****-12345

    License expiration date: 2019-Jan-12 20:00:00

    Days left: 590

To see the list of supported commands, execute the script without any parameters.

[user@host ~]$ /etc/init.d/kavicapd

Running the service automatically

To start the service automatically, make kavicapd a startup service.

To make kavicapd a startup service:

  1. Copy the kavicapd.sh init script to the directory that contains init scripts. The location of this directory may vary depending on the operating system.
  2. Add the kavicapd service to the service startup list. The exact method may vary depending on the operating system.
  3. Verify that the service has been added successfully.
  4. Restart the system for the changes to take effect.