Skip to content

Commit 08d29ff

Browse files
committed
[doc] Improvements on management of trusted certificates
Signed-off-by: Ming Lu <ming.lu@cloud.com>
1 parent a9978f1 commit 08d29ff

1 file changed

Lines changed: 122 additions & 0 deletions

File tree

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
---
2+
title: Trusted certificates for identity validation in TLS connections
3+
layout: default
4+
design_doc: true
5+
revision: 1
6+
status: draft
7+
---
8+
9+
# Overview
10+
11+
In various use cases, TLS connections are established on the host on which XAPI runs.
12+
When establishing a TLS connection, the peer identity needs to be validated.
13+
This is done using either a root CA certificate to perform certificate chain validation, or a known peer certificate for validation with certificate pinning.
14+
The root CA certificates and peer certificates involved in this process are referred to as trusted certificates.
15+
When a trusted certificate is installed, the local endpoint can validate the peer identity during TLS connection establishment.
16+
Certificate chain validation is a general-purpose, standards-based approach but requires additional steps, such as getting the peer's certificate signed by a CA.
17+
In contrast, certificate pinning offers a quicker way to set up trust in some cases without the overhead of CA signing.
18+
For example, in Trust‑On‑First‑Use (TOFU) policy and a self-signed server certificate scenario the first received leaf certificate can be trusted to avoid user intervention or configuration.
19+
20+
As the unified API for the whole system, XAPI also exposes interfaces for users to install and manage trusted certificates that are used by system components for different purposes.
21+
22+
The base design described in [pool-certificates.md](https://github.com/minglumlu/xen-api/blob/5d1ea1520825d502c57a90a02db476cd7d6a9132/doc/content/design/pool-certificates.md) defines the database, API, and trust store in the filesystem for managing trusted certificates.
23+
This document introduces the following enhancements to that design:
24+
25+
* Explicit separation of root CA certificates and peer certificates:
26+
In the base design, both certificate types share the same database schema, APIs, and are stored together in a single bundle file.
27+
This makes it difficult to determine the appropriate validation approach based on the certificate type.
28+
The improvement introduces a type value to separate root CA certificates and peer certificates explicitly.
29+
30+
* Add a "purpose" attribute for trusted certificates:
31+
According to the base design, only certificates used for internal TLS connections among XAPI processes within a pool are stored separately.
32+
All other trusted certificates are grouped in a single bundle, which may include certificates for multiple purposes.
33+
By introducing a "purpose" attribute, certificates can be organized by their intended use, improving clarity and reducing ambiguity.
34+
35+
# Use Cases
36+
* An XAPI client establishes a TLS connection to an XAPI service.
37+
This case is outside the scope of trusted certificates managed by XAPI and is included here only for completeness.
38+
* An XAPI process on one host initiates a TLS connection to an XAPI process on another host within the same pool.
39+
This case is covered in the base design and is listed here for completeness.
40+
* An XAPI process initiates a TLS connection to an external service, such as an appliance.
41+
This case benefits from the improvements introduced in this design.
42+
* A non-XAPI process (like licensing agent) running on a host managed by XAPI initiates a TLS connection to an external service, such as a License Server.
43+
This case benefits from the improvements introduced in this design as well.
44+
45+
46+
# Changes
47+
## Database schema
48+
The *Certificate* class in database is defined to represent general certificates, including trusted certificates.
49+
One existing class field "type" supports the following enumeration values:
50+
* "ca": trusted certificates including both root CA and peer.
51+
* "host": identity certificate of a host for communication with entities outside the pool.
52+
* "host_internal": identity certificate of a host for communication with other pool members.
53+
54+
Two improvements in this design:
55+
* A new value "peer" is introduced in this design so that the existing "ca" now represents trusted root CA only.
56+
The new "peer" will represent trusted peer certificates.
57+
58+
* A new enumeration type "purpose" is introduced to indicate the intended usage of a trusted certificate.
59+
A new *Certificate* class field "purposes" (a set of values of enumeration type "purpose") will be added to represent all applicable purposes of a trusted certificate.
60+
By default, this set is empty which corresponds to the existing general "ca" certificates.
61+
62+
## API
63+
64+
### pool.install_ca_certificate
65+
66+
This is an existing API to install a trusted certificate into the pool with its arguments being defined as:
67+
* session (ref session_id): reference to a valid session;
68+
* name (string): the name of the certificate;
69+
* cert (string): the certificate in PEM format.
70+
71+
In this design, it is recommended to use it to install root CA certificates only.
72+
And a new argument "purposes" is appended to specify the purposes of the trusted certificate to be installed. By default it is an empty set.
73+
* session (ref session_id): reference to a valid session;
74+
* name (string): the name of the certificate;
75+
* cert (string): the certificate in PEM format;
76+
* purposes (string list): the purposes of the certificate
77+
78+
### pool.install_peer_certificate
79+
This is a new API introduced in this design with its arguments being defined as:
80+
* session (ref session_id): reference to a valid session;
81+
* name (string): the name of the certificate;
82+
* cert (string): the certificate in PEM format;
83+
* purposes (string list): the purposes of the certificate.
84+
85+
This new API can be used to install trusted peer certificates only.
86+
87+
And corresponding "pool.uninstall_peer_certificate" for uninstalling a trusted peer certificate with arguments:
88+
* session (ref session_id): reference to a valid session;
89+
* name (string): the name of the certificate;
90+
* force (bool): remove the database entry even if the file doesn't exist.
91+
92+
### pool.join
93+
Since the trusted certificates managed in this design are pool-wide, any existing trusted certificates on the joining host should be removed during pool.join.
94+
Instead, all trusted certificates from the pool will be synchronized to the new host in the pre-join phase.
95+
96+
## Trust store
97+
The trusted certificates are stored in individual hosts' filesystems.
98+
The existing stores defined in the base design are:
99+
| Name | Filesystem location | User-configurable | Used for |
100+
| ---- | ------------------- | ----------------- | -------- |
101+
| Trusted Default | /etc/stunnel/certs/ | yes (using API) | Certificates that users can install for trusting appliances
102+
| Trusted Pool | /etc/stunnel/certs-pool/ | no | Certificates that are managed by the pool for host-to-host communications
103+
| Default Bundle | /etc/stunnel/xapi-stunnel-ca-bundle.pem | no | Bundle of certificates that hosts use to verify appliances (in particular WLB), this is kept in sync with "Trusted Default"
104+
| Pool Bundle | /etc/stunnel/xapi-pool-ca-bundle.pem | no | Bundle of certificates that hosts use to verify other hosts on pool communications, this is kept in sync with "Trusted Pool"
105+
106+
For backwards compatibility, when a trusted certificate is being installed via "pool.install_ca_certificate" or "pool.install_peer_certificate" but with empty "purposes",
107+
the trusted certificate will be stored as "Trusted Default" and "Default Bundle".
108+
The pool "Trusted Pool" and "Pool Bundle" are for host-to-host TLS communications within a pool. This design doesn't change them.
109+
110+
When the "purposes" is not empty, the stores for the certificates installed via "pool.install_ca_certificate" or "pool.install_peer_certificate" are defined as:
111+
| Name | Filesystem location | User-configurable | Used for |
112+
| ---- | ------------------- | ----------------- | -------- |
113+
| Trusted Peer | /etc/trusted-certs/peer-\<PURPOSE\>/ | no | Trusted peer certificates that users can install to validate a peer’s identity when establishing a TLS connection for \<PURPOSE\>
114+
| Trusted CA | /etc/trusted-certs/ca-\<PURPOSE\>/ | no | Trusted root CA certificates that users can install to validate a peer’s identity when establishing a TLS connection for \<PURPOSE\>
115+
| Peer Bundle | /etc/trusted-certs/peer-bundle-\<PURPOSE\>.pem | no | Bundle of trusted peer certificates under /etc/trusted-certs/peer-\<PURPOSE\>/ to verify a peer's identity when establishing a TLS connection for \<PURPOSE\>
116+
| CA Bundle | /etc/trusted-certs/ca-bundle-\<PURPOSE\>.pem | no | Bundle of trusted root CA certificates under /etc/trusted-certs/ca-\<PURPOSE\>/ to verify a peer's identity when establishing a TLS connection for \<PURPOSE\>
117+
118+
The filesystem location is derived from the \<PURPOSE\>. Each \<PURPOSE\> string corresponds to a predefined value of the "purpose" type in the database, implemented as predefined constants.
119+
120+
The "Peer Bundle" and "CA Bundle" can be directly used by other non-XAPI processes when establishing TLS connections.
121+
Users can select the appropriate bundle based on the chosen validation method: certificate chain validation or certificate pinning.
122+

0 commit comments

Comments
 (0)