-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add nebula_ca plugin #539
Open
cclaudio
wants to merge
1
commit into
confidential-containers:main
Choose a base branch
from
cclaudio:nebula-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add nebula_ca plugin #539
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -250,6 +250,39 @@ This is also called "Repository" in old versions. The properties to be configure | |
| `password` | String | AAP client key password | Yes | `8f9989c18d27...` | | ||
| `cert_pem` | String | CA cert for the KMS instance | Yes | `-----BEGIN CERTIFICATE----- ...` | | ||
|
||
#### Nebula CA Configuration | ||
|
||
The `name` field is `nebula-ca` to enable this plugin. | ||
|
||
The table below describes the properties supported to configure the plugin, they are all optional. | ||
|
||
| Property | Type | Description | Default | | ||
|------------------------|--------|-----------------------------------|----------| | ||
| `nebula_cert_bin_path` | String | `nebula-cert` binary path | If not provided, `nebula-cert` will be searched in $PATH | | ||
| `work_dir` | String | This plugin work directory, it requires `rw` permission | `/opt/confidential-containers/kbs/nebula-ca` | | ||
| `[plugins.self_signed_ca]` | SubSection | Nebula CA credential properties | See table below | | ||
|
||
The properties supported under `[plugins.self_signed_ca]` are described in the table below. They are all optional. | ||
|
||
When the KBS is starting, the plugin will try to load the CA credential from `${work_dir}/ca/ca.{key,crt}`, otherwise, it will create a new self-signed CA credential based on the `[plugins.self_signed_ca]` properties provided. The default value will be considered if a `[plugins.self_signed_ca]` property is not provided. | ||
|
||
| Property | Type | Description | Default | Example | | ||
|---------------------|---------|-----------------------------------|----------|-----------------------------------------------------| | ||
| `name` | String | Name of the certificate authority | `Trustee Nebula CA plugin` | | | ||
| `argon_iterations` | Integer | Argon2 iterations parameter used for encrypted private key passphrase | 1 | | | ||
| `argon_memory` | Integer | Argon2 memory parameter (in KiB) used for encrypted private key passphrase | 2097152 | | | ||
| `argon_parallelism` | Integer | Argon2 parallelism parameter used for encrypted private key passphrase | 4 | | | ||
| `curve` | String | EdDSA/ECDSA Curve (25519, P256) | `25519` | | | ||
| `duration` | String | Amount of time the certificate should be valid for. Valid time units are: <hours>"h"<minutes>"m"<seconds>"s" | `8760h0m0s` | | | ||
| `groups` | String | Comma separated list of groups. This will limit which groups subordinate certs can use | "" | `server,ssh` | | ||
| `ips` | String | Comma separated list of ipv4 address and network in CIDR notation. This will limit which ipv4 addresses and networks subordinate certs can use for ip addresses | "" | `192.168.100.10/24,192.168.100.15/24` | | ||
| `out_qr` | String | Path to write a QR code image (png) of the certificate | | `/opt/confidential-containers/kbs/nebula_ca/ca_qr.crt`| | ||
| `subnets` | String | Comma separated list of ipv4 address and network in CIDR notation. This will limit which ipv4 addresses and networks subordinate certs can use in subnets | "" | `192.168.86.0/24` | | ||
|
||
A simple [configuration example](#configuration-examples). | ||
|
||
Further [documentation](./plugins/nebula_ca.md). | ||
|
||
## Configuration Examples | ||
|
||
Using a built-in CoCo AS: | ||
|
@@ -283,6 +316,13 @@ policy_engine = "opa" | |
name = "resource" | ||
type = "LocalFs" | ||
dir_path = "/opt/confidential-containers/kbs/repository" | ||
|
||
[[plugins]] | ||
name = "nebula-ca" | ||
# This sub-section is optional. In this example, we just | ||
# want to show how to customize the Nebula CA. | ||
[plugin.self_signed_ca] | ||
duration = "4380hm0s0" | ||
``` | ||
|
||
Using a remote CoCo AS: | ||
|
@@ -302,6 +342,13 @@ as_addr = "http://127.0.0.1:50004" | |
name = "resource" | ||
type = "LocalFs" | ||
dir_path = "/opt/confidential-containers/kbs/repository" | ||
|
||
[[plugins]] | ||
name = "nebula-ca" | ||
nebula_cert_bin_path = "/usr/local/bin/nebula-cert" | ||
work_dir = "/opt/confidential-containers/kbs/nebula-ca" | ||
[plugins.settings] | ||
name = "Nebula CA for Trustee KBS" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same suggestion as before. |
||
``` | ||
|
||
Running with Intel Trust Authority attestation service: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# Nebula CA plugin | ||
|
||
[Nebula](https://github.com/slackhq/nebula) is an open-source project that provides | ||
tooling to create a Layer 3 Encrypted Nebula Overlay Network (ENON). Each Nebula release | ||
provides two binaries. | ||
- nebula: it's used to create nodes (Lighthouse or regular node) and | ||
join to a Lighthouse's ENON | ||
- nebula-cert: executable to generate keys, certificates, CA's, and to sign node certificates. | ||
|
||
This plugin calls the `nebula-cert` binary to provide some of its functionalities for | ||
Nebula nodes (e.g. CoCo PODs or confidential VMs) that want to join an ENON. | ||
|
||
Every ENON must have at least one Lighthouse, which is a node that has an static IP address, identifies the ENON and helps with node discovery. | ||
|
||
## Setup | ||
|
||
Build the KBS with the cargo feature `nebula-ca-plugin` enabled and install the `nebula-cert` binary to the KBS image. | ||
|
||
```bash | ||
docker compose build --build-arg NEBULA_CA_PLUGIN=true | ||
``` | ||
|
||
Configure the `nebula-ca` plugin. For simple cases, the plugin default configurations should be enough, just add the lines below to the [KBS config](#kbs/config/docker-compose/kbs-config.toml). For more complex cases, the [config.md](#kbs/docs/config.md) explains how the plugin could be customized. | ||
|
||
```toml | ||
[[plugins]] | ||
name = "nebula-ca" | ||
``` | ||
|
||
Start trustee | ||
|
||
```bash | ||
docker compose up | ||
``` | ||
|
||
## Runtime services | ||
|
||
All runtime services supported are described in the following sections. | ||
|
||
### credential service | ||
|
||
Create a credential for the node to join an ENON. | ||
|
||
Only `GET` request is supported, e.g. `GET /kbs/v0/nebula-ca/credential?name=podA&ip=10.9.8.7/21`. | ||
|
||
The request takes parameters via URL query string. All parameters supported are described in the table below. Note that `name` and `ip` are required. | ||
|
||
| Property | Type | Required | Description | Default | Example | | ||
|---------------------|--------|----------|-------------------------|---------|-------------------------------------------| | ||
| `name` | String | Yes | Name of the certificate, usually hostname or podname | | `credential?name=podA&ip=10.9.8.7/21` | | ||
| `ip` | String | Yes | IPv4 address and network in CIDR notation to assign to the certificate | | `credential?name=podA&ip=10.9.8.7/21` | | ||
| `duration` | String | No | How long the certificate should be valid for. | 1 second before the signing certificate expires. Valid time units are: <hours>"h"<minutes>"m"<seconds>"s" | `credential?name=podA&ip=10.9.8.7/21&duration=8760h0m0s` | | ||
| `groups` | String | No | Comma separated list of groups | | `credential?name=podA&ip=10.9.8.7/21&groups=ssh,server` | | ||
| `subnets` | String | No | Comma separated list of IPv4 address and network in CIDR notation. Subnets the certificate can serve for. | | `credential?name=podA&ip=10.9.8.7/21&subnets=10.9.7.7/21,10.9.8.7/21` | | ||
|
||
The request will be processed only if the node passes the attestation, otherwise an error is returned. With that, the ENON is expected to have only attested nodes. | ||
|
||
Once the request is processed, the following structure is returned in JSON format. | ||
|
||
```rust | ||
struct CredentialServiceOut { | ||
node_crt: Vec<u8>, // Self-signed certificate created | ||
node_key: Vec<u8>, // Key created | ||
ca_crt: Vec<u8>, // CA certificate | ||
} | ||
``` | ||
|
||
Currently, this service provides only basic functionality. | ||
- It is stateless. Once a requested credential is returned, it is deleted. | ||
- It does not support [CA rotation](https://nebula.defined.net/docs/guides/rotating-certificate-authority/). | ||
- It does not support runtime attestation. If the same POD requests another credential later, the changes made to the POD's initial state will not be attested. Ideally, the POD should make sure that the certificate will not expire before the workload is finished. | ||
- It does not have any information about Lighthouses, so it is not able to check if the IP address provided in the request and the IP address of the Lighthouse are in the same network. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we add a separate config example for nebula and leave this only for CoCoAS example?