There are three current methods for installing Keylime: the Ansible role, the Keylime installer or a manual installation.

Ansible Keylime Roles

An Ansible role to deploy Keylime , alongside the Keylime Rust agent

This role deploys Keylime for use with a Hardware TPM.

Should you wish to deploy Keylime with a software TPM emulator for development or getting your feet wet, use the Ansible Keylime Soft TPM role instead.


Download or clone Ansible Keylime from its repository and follow the usage section.

Run the example playbook against your target remote host(s):

ansible-playbook -i your_hosts playbook.yml

TPM Version Control (Software TPM)

Ansible Keylime Soft TPM provides a role type for 2.0 TPM versions.

TPM 2.0 support can be configured by simply adding the role in the playbook.yml file here

For TPM 2.0 use:

- ansible-keylime-tpm20

This rule uses the TPM 2.0 Emulator (IBM software TPM).


If you prefer, a Vagrantfile is available for provisioning.

Clone the repository and then simply run:

vagrant up --provider <provider> --provision

For example, using libvirt:

vagrant up --provider libvirt --provision

For example, using VirtualBox:

vagrant up --provider virtualbox --provision

Once the VM is started, vagrant ssh into the VM and run sudo su - to become root.

You can then start the various components using commands:


Rust agent


The Rust agent is the official agent for Keylime and replaces the Python implementation. For the rust agent a different configuration file is used (by default /etc/keylime/agent.conf) which is not interchangeable with the old Python configuration.

Installation instructions can be found in the for the Rust agent.

Keylime Bash installer

Keylime requires Python 3.6 or greater.

Installation can be performed via an automated shell script, The following command line options are available:

Usage: ./ [option...]
-k              Download Keylime (stub installer mode)
-m              Use modern TPM 2.0 libraries; this is the default
-s              Install & use a Software TPM emulator (development only)
-p PATH         Use PATH as Keylime path
-h              This help info

Docker - Deployment

The verifier, registrar and tenant can also be deployed using Docker images. Keylime’s official images can be found here. Those are automatically generated for every commit and release.

For building those images locally see here.

Docker - Development

Python Keylime and with a TPM emulator can also be deployed using Docker. Since this docker configuration uses a TPM emulator, it should only be used for development or testing and NOT in production.

Please see either the Dockerfiles here or our local CI script here which will automate the build and pull of Keylime.


Keylime requires Python 3.6 or greater.

Python-based prerequisites

The following Python packages are required:

  • cryptography>=3.3.2

  • tornado>=5.0.2

  • pyzmq>=14.4

  • pyyaml>=3.11

  • requests>=2.6

  • sqlalchemy>=1.3

  • alembic>=1.1.0

  • packaging>=20.0

  • psutil>=5.4.2

  • lark>=1.0.0

  • pyasn1>=0.4.2

  • pyasn1-modules>=0.2.1

  • jinja2>=3.0.0

  • gpg (Note: the GPG bindings must match the local GPG version and therefore this package should not be installed via PyPI)

The current list of required packages can be found here.

All of them should be available as distro packages. See for more information if you want to install them this way. You can also let Keylime’s install them via PyPI.

TPM 2.0 Support

Keylime uses the Intel TPM2 software set to provide TPM 2.0 support. You will need to install the tpm2-tss software stack (available here) and tpm2-tools utilities available here. See in these projects for detailed instructions on how to build and install.

The brief synopsis of a quick build/install (after installing dependencies) is:

# tpm2-tss
git clone tpm2-tss
pushd tpm2-tss
./configure --prefix=/usr
sudo make install
# tpm2-tools
git clone tpm2-tools
pushd tpm2-tools
./configure --prefix=/usr/local
sudo make install

To ensure that you have the recent version installed ensure that you have the tpm2_checkquote utility in your path.


Keylime by default (all versions after 6.2.0) uses the kernel TPM resource manager. For kernel versions older than 4.12 we recommend to use the tpm2-abrmd resource manager (available here).

How the TPM is accessed by tpm2-tools can be set using the TPM2TOOLS_TCTI environment variable. More information about that can be found here.

Talk to the swtpm emulator directly:

export TPM2TOOLS_TCTI="mssim:port=2321"

To talk to the TPM directly (not recommended):

export TPM2TOOLS_TCTI="device:/dev/tpm0"

Install Keylime

You’re finally ready to install Keylime:

sudo python install

Database support

Keylime supports the following databases:

  • SQLite

  • PostgreSQL

  • MySQL

  • MariaDB

SQLite is configured as default (database_url = sqlite) where the databases are stored under /var/lib/keylime.

Starting with Keylime version 6.4.0 only supports SQLAlchemy’s URL format to allow a more flexible configuration. The format for the supported databases can be found in the SQLAlchemy engine configuration documentation.