Skip to content

Commit 5f93eb2

Browse files
committed
Add keylime-docs into main keylime repo
2 parents bbc1919 + 79b3d3b commit 5f93eb2

23 files changed

Lines changed: 2310 additions & 0 deletions

docs/.readthedocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
formats: all
3+
sphinx:
4+
configuration: conf.py
5+
python:
6+
install:
7+
- requirements: requirements.txt

docs/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SOURCEDIR = .
8+
BUILDDIR = _build
9+
10+
# Put it first so that "make" without argument is like "make help".
11+
help:
12+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
13+
14+
.PHONY: help Makefile
15+
16+
# Catch-all target: route all unknown targets to Sphinx using the new
17+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
18+
%: Makefile
19+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# keylime-docs
2+
3+
[![Documentation Status](https://readthedocs.org/projects/keylime-docs/badge/?version=latest)](https://keylime-docs.readthedocs.io/en/latest/?badge=latest)
4+
5+
All Keylime documentation is formatted in [reStructuredText](https://en.wikipedia.org/wiki/ReStructuredText)
6+
7+
The documentation project is built using [sphinx](http://www.sphinx-doc.org)
8+
9+
Documentation is hosted on [readthedocs](https://readthedocs.org/)

docs/_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
theme: jekyll-theme-tactile

docs/conf.py

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Configuration file for the Sphinx documentation builder.
4+
#
5+
# This file does only contain a selection of the most common options. For a
6+
# full list see the documentation:
7+
# http://www.sphinx-doc.org/en/master/config
8+
9+
# -- Path setup --------------------------------------------------------------
10+
11+
# If extensions (or modules to document with autodoc) are in another directory,
12+
# add these directories to sys.path here. If the directory is relative to the
13+
# documentation root, use os.path.abspath to make it absolute, like shown here.
14+
#
15+
# import os
16+
# import sys
17+
# sys.path.insert(0, os.path.abspath('.'))
18+
19+
20+
# -- Project information -----------------------------------------------------
21+
22+
project = 'Keylime Documentation'
23+
copyright = '2022, Keylime Developers'
24+
author = 'Keylime Developers'
25+
26+
# The short X.Y version
27+
version = ''
28+
# The full version, including alpha/beta/rc tags
29+
release = '6.4.1'
30+
31+
32+
# -- General configuration ---------------------------------------------------
33+
34+
# If your documentation needs a minimal Sphinx version, state it here.
35+
#
36+
# needs_sphinx = '1.0'
37+
38+
# Add any Sphinx extension module names here, as strings. They can be
39+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
40+
# ones.
41+
extensions = [
42+
'sphinx.ext.viewcode',
43+
'sphinx.ext.autosectionlabel',
44+
'sphinx.ext.autodoc',
45+
'sphinx.ext.intersphinx',
46+
'sphinx.ext.githubpages',
47+
'sphinxcontrib.httpdomain',
48+
'sphinx_tabs.tabs',
49+
'sphinx-prompt',
50+
'recommonmark',
51+
'notfound.extension',
52+
]
53+
54+
# Add any paths that contain templates here, relative to this directory.
55+
templates_path = ['_templates']
56+
57+
# The suffix(es) of source filenames.
58+
# You can specify multiple suffix as a list of string:
59+
#
60+
# source_suffix = ['.rst', '.md']
61+
source_suffix = '.rst'
62+
63+
# The master toctree document.
64+
master_doc = 'index'
65+
66+
# The language for content autogenerated by Sphinx. Refer to documentation
67+
# for a list of supported languages.
68+
#
69+
# This is also used if you do content translation via gettext catalogs.
70+
# Usually you set "language" from the command line for these cases.
71+
language = None
72+
73+
# List of patterns, relative to source directory, that match files and
74+
# directories to ignore when looking for source files.
75+
# This pattern also affects html_static_path and html_extra_path.
76+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
77+
78+
# The name of the Pygments (syntax highlighting) style to use.
79+
pygments_style = None
80+
81+
82+
# -- Options for HTML output -------------------------------------------------
83+
84+
# The theme to use for HTML and HTML Help pages. See the documentation for
85+
# a list of builtin themes.
86+
#
87+
#html_theme = 'alabaster'
88+
html_theme = 'sphinx_rtd_theme'
89+
# Theme options are theme-specific and customize the look and feel of a theme
90+
# further. For a list of options available for each theme, see the
91+
# documentation.
92+
#
93+
# html_theme_options = {}
94+
95+
# Add any paths that contain custom static files (such as style sheets) here,
96+
# relative to this directory. They are copied after the builtin static files,
97+
# so a file named "default.css" will overwrite the builtin "default.css".
98+
html_static_path = ['_static']
99+
100+
# Custom sidebar templates, must be a dictionary that maps document names
101+
# to template names.
102+
#
103+
# The default sidebars (for documents that don't match any pattern) are
104+
# defined by theme itself. Builtin themes are using these templates by
105+
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
106+
# 'searchbox.html']``.
107+
#
108+
# html_sidebars = {}
109+
110+
111+
# -- Options for HTMLHelp output ---------------------------------------------
112+
113+
# Output file base name for HTML help builder.
114+
htmlhelp_basename = 'KeylimeDocumentationdoc'
115+
116+
117+
# -- Options for LaTeX output ------------------------------------------------
118+
119+
latex_elements = {
120+
# The paper size ('letterpaper' or 'a4paper').
121+
#
122+
# 'papersize': 'letterpaper',
123+
124+
# The font size ('10pt', '11pt' or '12pt').
125+
#
126+
# 'pointsize': '10pt',
127+
128+
# Additional stuff for the LaTeX preamble.
129+
#
130+
# 'preamble': '',
131+
132+
# Latex figure (float) alignment
133+
#
134+
# 'figure_align': 'htbp',
135+
}
136+
137+
# Grouping the document tree into LaTeX files. List of tuples
138+
# (source start file, target name, title,
139+
# author, documentclass [howto, manual, or own class]).
140+
latex_documents = [
141+
(master_doc, 'KeylimeDocumentation.tex', 'Keylime Documentation Documentation',
142+
'Keylime Developers', 'manual'),
143+
]
144+
145+
146+
# -- Options for manual page output ------------------------------------------
147+
148+
# One entry per manual page. List of tuples
149+
# (source start file, name, description, authors, manual section).
150+
man_pages = [
151+
(master_doc, 'keylimedocumentation', 'Keylime Documentation Documentation',
152+
[author], 1)
153+
]
154+
155+
156+
# -- Options for Texinfo output ----------------------------------------------
157+
158+
# Grouping the document tree into Texinfo files. List of tuples
159+
# (source start file, target name, title, author,
160+
# dir menu entry, description, category)
161+
texinfo_documents = [
162+
(master_doc, 'KeylimeDocumentation', 'Keylime Documentation Documentation',
163+
author, 'KeylimeDocumentation', 'One line description of project.',
164+
'Miscellaneous'),
165+
]
166+
167+
168+
# -- Options for Epub output -------------------------------------------------
169+
170+
# Bibliographic Dublin Core info.
171+
epub_title = project
172+
173+
# The unique identifier of the text. This can be a ISBN number
174+
# or the project homepage.
175+
#
176+
# epub_identifier = ''
177+
178+
# A unique identification for the text.
179+
#
180+
# epub_uid = ''
181+
182+
# A list of files that should not be packed into the epub file.
183+
epub_exclude_files = ['search.html']
184+
185+
186+
# -- Extension configuration -------------------------------------------------

docs/design.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
=================
2+
Design of Keylime
3+
=================
4+
5+
.. toctree::
6+
:maxdepth: 2
7+
:caption: Contents:
8+
9+
design/overview.rst
10+
design/threat_model.rst
11+
12+

docs/design/overview.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
===================
2+
Overview of Keylime
3+
===================
4+
5+
Keylime mainly consists of an agent, two server components (verifier and registrar) and a commandline tool the tenant.
6+
7+
Agent
8+
-----
9+
10+
The agent is a service that runs on the operating system that should be attested.
11+
It communicates with the TPM to enroll the AK and to generate quotes and
12+
collects the necessary data like the UEFI and IMA event logs to make state attestation
13+
possible.
14+
15+
The agent provides an interface to provision the device further once it was attested
16+
successfully for the first time using the secure payload mechanism.
17+
For more details see: :doc:`../user_guide/secure_payload`.
18+
19+
It is possible for the agent to listen to revocation events that are sent by the verifier
20+
if an agent attestation failed. This is useful for environments where attested systems
21+
directly communicate with each other and require that the other systems are trusted.
22+
In this case a revocation message might change local policies so that the compromised
23+
system cannot access any resources from other systems.
24+
25+
Registrar
26+
---------
27+
The agent registers itself in the registrar.
28+
The registrar manages the agent enrollment process which includes
29+
getting an UUID for the agent, collecting the `EK`:sub:`pub`, EK certificate and `AK`:sub:`pub` from an agent
30+
and verifying that the `AK` belongs to the `EK` (using `MakeCredential` and `ActivateCredential`).
31+
32+
33+
Once an agent has been registered in the registrar, it is ready to be enrolled for attestation.
34+
The tenant can use the EK certificate to verify to verify the trustworthiness of the TPM.
35+
Both the tenant and verifier
36+
37+
.. note::
38+
If `EK` or `AK` are mentioned outside of internal TPM signing operations, it usually
39+
references the `EK`:sub:`pub` or `AK`:sub:`pub` because it should not be possible
40+
extract the private keys out of the TPM.
41+
42+
.. note::
43+
The Keylime agent currently generates a `AK` on every startup and sends the EK and
44+
EK certificate. This is done to keep then design simple by not requiring a third
45+
party to verify the EK.
46+
The EK (and EK certificate) is required to verify the authenticity of the AK once
47+
and Keylime does not require a new AK but currently registration only with an AK
48+
is not enabled because the agent does not implement persisting the AK.
49+
50+
Verifier
51+
--------
52+
The verifier implements the actual attestation of an agent and sends revocation messages if an agent leaves the trusted
53+
state.
54+
55+
Once an agent is registered for attestation (using the tenant or the API directly) the verifier continuously pulls
56+
the required attestation data from the agent. This can include: a quote over the PCRs, the PCR values, NK public key,
57+
IMA log and UEFI event log. After that the quote is validated additional validation of the data can be configured.
58+
59+
Static PCR values
60+
"""""""""""""""""
61+
The `tpm_policy` allows for simple checking of PCR values against a known good allowlist. In most cases this is only
62+
useful when the boot chain does not change often, there is a way to retrieve the values beforehand
63+
and the UEFI event log is unavailable.
64+
More information can be found in :doc:`../user_guide/user_selected_pcr_monitoring`.
65+
66+
Measured Boot using the UEFI Event Log
67+
""""""""""""""""""""""""""""""""""""""
68+
On larger deployments it is not feasible to collect golden values for the PCR values used for measured boot. To make
69+
attestation still possible Keylime includes a policy engine for validating the UEFI event log. This is the preferred
70+
method because static PCR values are fragile because they change if something in the boot chain is updated (firmware,
71+
Shim, GRUB, Linux kernel, initrd, ...). More information can be found in :doc:`../user_guide/use_measured_boot`.
72+
73+
IMA validation
74+
""""""""""""""
75+
Keylime allows to verify files measured by IMA against either a provided allowlist or a signature.
76+
This makes it for example easy to attest all files that were executed by root.
77+
More information can be found in :doc:`../user_guide/runtime_ima`.
78+
79+
80+
Tenant
81+
------
82+
The tenant is a commandline management tool shipped by Keylime to manage agents.
83+
This includes adding or removing the agent from attestation, validation of the EK certificate against a cert store and
84+
getting the status of an agent. It also provides the necessary tools for the payload mechanism and revocation actions.
85+
86+
For all the features of the tenant see the output of ``keylime_tenant --help``.

docs/design/threat_model.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
============
2+
Threat Model
3+
============
4+
5+
Keylime was originally developed with the intention of using it in combination with hypervisors to protect the VMs
6+
against by using the vTPM support in Xen. vTPM support for TPM2.0 was never implemented into Keylime and swtpm+libvirt
7+
never supported it, so this model no longer fits. Keylime is commonly used either on bare metal hardware or in VMs where
8+
the TPM is emulated but from VM side treated the same as a hardware TPM. Therefore the common threat model is defined on
9+
the latter use case.
10+
11+
12+
.. note::
13+
The term vTPM can be confusing because it originally described the deep quote feature in Xen which Keylime used for
14+
TPM 1.2. Now it commonly refers to a software implementation of a TPM (e.g. swtpm) or the Virtual TPM Proxy Driver
15+
in the Linux kernel.
16+
17+
From Keylime's perspective the core hardware like CPU, memory, motherboard is trusted, because it does not provide
18+
mechanisms to detect tampering with the hardware itself.
19+
Keylime chains its root of trust into the TPM therefore the TPM is deemed in general trustworthy. This trust is verified
20+
using the EK or EK certificate.
21+
22+
The goal of Keylime is to attest the state of a running system. For this to work the entire boot chain has to be
23+
verified. The UEFI with Secure Boot enabled firmware and CRTM are generally trusted because it provides the UEFI event
24+
log and the API for other EFI applications to use the TPM. All the other applications in the boot chain are either
25+
measured by the firmware or the application that loads them (e.g. GRUB2 loads the kernel). The threat model does not
26+
require to trust arbitrary EFI applications during the boot process because it can be verified after boot what was
27+
executed.
28+
29+
30+
The threat model includes that an adversary has full control over the network and can either sent rouge messages,
31+
drop or modify them. Also the Keylime agent and running operating system itself is not deemed trustworthy by default.
32+
Only after the successful initial attestation the system is deemed trustworthy, but still can leave the trusted state
33+
at any moment and is therefore continuously attested.
34+
35+
36+
Types of Attacks to detect
37+
--------------------------
38+
Keylime tries to detect the following attacks.
39+
40+
TPM Quote Manipulation
41+
""""""""""""""""""""""
42+
Because the TPM is the root-of-trust for Keylime, it ensures that the quote is valid.
43+
This is vital for all the other attestation steps because the quote is used to validate the data.
44+
45+
Keylime ensures this through three steps:
46+
47+
* EK validation: The tenant allows Keylime to verify the EK certificate against the CAs of hardware manufacturers
48+
or add custom validation steps. This is done to ensure that the EK belongs to an actual hardware TPM or a trusted
49+
software TPM.
50+
* AK enrollment: Using the TPM commands `MakeCredential`, `ActivateCredential` and enforcing certain key properties
51+
(restricted, user with auth, sign encrypt, fixed TPM, fixed parent and sensitive data origin)
52+
Keylime ensures that the used AK belongs to the provided EK and has the right properties for signing quotes.
53+
* Quote validation: Each quote generated by the TPM is verified with the AK provided during agent registration.
54+
The verifier provides a fresh nonce that is included in the quote to prohibit replay attacks.
55+
56+
57+
Modification of the boot process
58+
""""""""""""""""""""""""""""""""
59+
Checking the security of the running system does only make sense if it can be ensured that the system was correctly
60+
booted. Therefore Keylime provides two ways to allow users to verify the entire boot chain up to the running system:
61+
static PCR value checks (:doc:`../user_guide/user_selected_pcr_monitoring`) and the measured boot policy engine
62+
(:doc:`../user_guide/use_measured_boot`).
63+
64+
65+
Runtime file and system integrity
66+
"""""""""""""""""""""""""""""""""
67+
Keylime can attest the state of a Linux system and the files using the Linux Integrity Measurement Architecture (IMA).
68+
Therefore Keylime can be used to remotely check for attacks that IMA detects.

0 commit comments

Comments
 (0)