Using Python with Centrify Objects

You can use Python commands or scripts to interact with Centrify objects on Linux systems. Centrify provides two Python modules that you can use in Python scripts to communicate with the Centrify Agent for *NIX:

  • pylrpc: Calls reference internal LRPC objects and methods.

  • pycapi: Calls reference the Centrify API (CAPI) mainly for use with NSS and PAM.

Requirements

Python requirements:

  • Use Python version 3.4 or later

  • Add the following path to your PYTHONPATH variable:

    /usr/share/centrifydc/python/lib64

    For example, you can update the PYTHONPATH by running the following command:

    $export PYTHONPATH=/usr/share/centrifydc/python/lib64

In your python scripts, you can import either module into your script with an import statement, such as the following:

import pylrpc

import pycapi

There are some sample scripts included so that you can what kinds of things you can do. Example python scripts are installed at /usr/share/centrifydc/samples/python.