Extending TLS Terminator functionality

The plug-in mechanism extends the functionality of TLS Terminator so that you can implement custom logic into the operation of the TLS Terminator component without changing its source code. Plug-ins for the TLS Terminator component are dynamic libraries. When developing plug-ins, you must comply with the prerequisites for using dynamic libraries. To use the plug-in mechanism, you must do the following:

  1. Develop a plug-in that implements the interface defined in the file /opt/KasperskyOS-Community-Edition-<platform>-<version>/sysroot-*-kos/include/tls/tls_plugin_interface.h. Implementation of the following interface functions is required:
    • plugin_init() – initialize the plug-in.
    • plugin_fini() – terminate the plug-in.
    • plugin_get_version() – get the plug-in version.

    Implementation of the rest of the interface functions is optional and depends on the tasks for which the plug-in is being developed.

  2. When starting TLS Terminator, you must pass the path of the developed plug-in in the --plugin_path startup parameter. For more details, refer to TLS Terminator startup parameters and environment variables.

Plug-in mechanism details:

  1. The plug-in is loaded into memory using the POSIX function dlopen().
  2. Version compatibility is verified by using the plugin_get_version() function, and the plug-in is initialized via the plugin_init() call.
  3. When calling a function that can be intercepted by the TLS Terminator component:
    1. The component uses the POSIX function dlsym() to check whether the plug-in has an implementation of the called function.
    2. If the function is implemented in the plug-in, the component executes the plug-in version of the function. Otherwise, the TLS Terminator component executes its own version of the function.

    During initialization, the TLS Terminator component passes to the plug-in a set of pointers to its own implementations of functions through the tls_functions structure. This allows the plug-in to call these implementations as needed.

  4. When shutting down, the TLS Terminator component terminates the plug-in by calling the plugin_fini() function.
  5. The plugin is unloaded from memory using the POSIX function dlclose ().
Page top