You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: platform/smallstep-api.mdx
+39-81Lines changed: 39 additions & 81 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,11 @@ description: The Smallstep platform is used across security, IT, and DevOps team
6
6
7
7
With the Smallstep API, you can:
8
8
9
-
- Register VMs with Smallstep as you spin them up, for instant trust bootstrapping
10
-
- Integrate certificate lifecycle management into your Terraform and Ansible definitions
11
-
- Programmatically manage CAs, SSH grants and tags, and more!
9
+
- Register new devices in your Smallstep inventory
10
+
- Manage your high-level protected resources, such as Wi-Fi or VPN configurations
11
+
- Manage low-level resources like X.509 CAs, Attestation authorities, and provisioners
12
+
- Manage hosts, host grants, and tags for [Smallstep SSH](../ssh/README.mdx)
13
+
- And more!
12
14
13
15
The Smallstep API is [OpenAPI conformant](https://www.openapis.org/), with JSON requests and responses.
14
16
@@ -17,97 +19,53 @@ The Smallstep API is [OpenAPI conformant](https://www.openapis.org/), with JSON
17
19
👉 [Smallstep API Specification and Playground](https://gateway.smallstep.com)
18
20
19
21
You can get an API token in two ways:
20
-
- In your [Smallstep settings](https://smallstep.com/app?next=/settings). Under **API Tokens**, choose **+ Add Token.**
21
-
- On the command line, using the [`step` CLI](https://smallstep.com/docs/step-cli/). The [`step api token create`](https://smallstep.com/docs/step-cli/reference/api/token/create/index.html) command accepts a client certificate and private key to authenticate with Smallstep and issue a temporary API token. To use this option, you must first configure a trusted root CA in your [Smallstep settings](https://smallstep.com/app?next=/settings). The trusted root can be a Smallstep CA or an external CA. Only one trusted root CA may be configured.
22
+
-**Long-term token**: In your [Smallstep settings](https://smallstep.com/app?next=/settings). Under **API Tokens**, choose **+ Add Token.** This token has a 10 year validity period and will only be displayed once. Please store it in a safe place!
23
+
-**Short-term token**: On the command line, using the [`step` CLI](../step-cli/README.mdx). The [`step api token create`](../step-cli/reference/api/token/create/README.mdx) command accepts a client certificate and private key to authenticate with Smallstep and issue a temporary API token with a 1 hour validity period.
24
+
To use this option, you must configure a trusted root CA in your [Smallstep settings](https://smallstep.com/app?next=/settings). The trusted root can be a Smallstep CA or an external CA. Only one trusted root CA may be configured.
You can import devices from any source into Smallstep using our API.
27
34
28
-
### Getting Started
35
+
Devices added via API are automatically approved.
36
+
but they will not be marked as high-assurance
37
+
until Smallstep receives an attestation from the device.
29
38
30
-
You’ll need an API token to get started. You can create one by [signing into the Smallstep dashboard](https://smallstep.com/app/). In the bottom-left **⋮** menu, go to **Settings**. Under **API Tokens**, choose **+ Add Token.**
39
+
For each device, use the [Save Collection Instance](https://gateway.smallstep.com/v2023-11-01/operations/PutCollectionInstance) endpoint to create a device.
40
+
- For the `collectionSlug`, use `default`
41
+
- For Apple devices, the `instanceID` must be the device's serial number.
42
+
- For TPM 2.0 devices, the `instanceID` must be the TPM Endorsement Key URI, in the format `urn:ek:sha256:ul3sYf6uQ6jVEXAMPLEXoAuHI10U8gTvEJ6bMj95LXI=`. (You can retrieve the EK URI by running `step agent tpm --fingerprint` on the device.)
31
43
32
-
Your API token has a 10 year validity period and will only be displayed once. Please store it in a safe place!
44
+
For the body of the request,
45
+
create a user using the following value
46
+
(replacing `[email protected]` with the device owner's email address):
you'll see the device listed under Recent Devices.
73
71
74
-
### Configure Devices and Workloads via the API
75
-
76
-
Here’s the most common workflow for using the Smallstepi API, either directly or via the Terraform or Ansible integrations:
77
-
78
-
#### 1. [Create a device collection](https://gateway.smallstep.com/operations/PutDeviceCollection).
79
-
80
-
Set the device type according to your deployment. Note that each device type is going to have its own `deviceTypeConfiguration` as well. For example, an Azure VM device will require you to set your Azure tenant ID, for access control.
81
-
82
-
You’ll register your individual devices in step 3.
This is where you set up your workload configuration. You can specify things like certificate SANs and duration, certificate and key file ownership and permissions, reload options for the workload, and so on.
87
-
88
-
A single workload can be associated with multiple devices.
89
-
90
-
Have three HAProxy hosts in front of a fleet of `internal.example.com` web servers? That’s one workload.
91
-
92
-
Have a PostgreSQL server with several hot standby servers? That’s one workload.
93
-
94
-
Have an etcd cluster comprised of three hosts? That’s one workload.
95
-
96
-
On this endpoint, you can use the `deviceMetadataKeySANs` property to dynamically map certificate SANs for each device that’s running a workload. Or, statically assign SANs for every certificate in the workload, using `staticSANs`.
97
-
98
-
#### 3. [Add devices to collection](https://gateway.smallstep.com/operations/PutCollectionInstance).
99
-
100
-
Each device’s `instanceID` should be set according to the device type:
101
-
102
-
- For AWS EC2 instances, use the EC2 instance ID (eg. [`i-0d460b88a96dfdd08`](https://us-east-2.console.aws.amazon.com/ec2/home?region=us-east-2#InstanceDetails:instanceId=i-0d460b88a96dfdd08))
103
-
- For Azure VMs, use the managed identity principal object ID
104
-
- For Compute Engine VMs, use the instance ID (eg. `16979701088048819`)
105
-
106
-
Use the `data` field to store any relevant instance metadata, such as:
107
-
108
-
- an instance’s region, name, or role(s)
109
-
- DNS names (these can be mapped to a SANs using `deviceMetadataKeySANs`, above)
110
-
111
-
#### 4. Install the Smallstep app on each device.
112
-
113
-
See [Smallstep App](./smallstep-app.mdx) for details.
$ step ca certificate localhost localhost.crt localhost.key --not-before=5m --not-after=240h
194
194
```
195
195
196
-
Note that default maximum certificate duration is 24 hours. To adjust the global default, minimum, and maximum certificate durations for your CA, add a `claims` section to the `$(step path)/config/ca.json` configuration file, under `"authority"`, with the following keys:
196
+
Note that default maximum certificate duration is 24 hours. To adjust the global default, minimum, and maximum certificate durations for your CA, add a `claims` section to the `$(step path)/config/ca.json` configuration file, nested under `"authority"`, with the following keys:
Copy file name to clipboardExpand all lines: step-ca/registration-authority-ra-mode.mdx
+26-8Lines changed: 26 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -559,27 +559,45 @@ Here are the `config` options for `vaultcas` authorities:
559
559
560
560
-**pkiRoleEd25519**: the pki role used to issue Ed25519 certificates, defaults to *pkiRoleDefault*
561
561
562
-
-**authType**: required. the authentication method used to login to the vault, one of `approle`or `kubernetes`
562
+
-**authType**: required. the authentication method used to login to the vault, one of `approle`, `kubernetes`or `aws`
563
563
564
564
-**authMountPath**: the vault mount path for the auth method you want to use, if not set the default mount path for that auth type is used (usually the same name as the auth method)
565
565
566
566
-**namespace**: optional. if using Vault Enterprise, the [namespace](https://developer.hashicorp.com/vault/docs/enterprise/namespaces) to which requests should be scoped. Note: this value will apply to both the `pkiMountPath` and the `authMountPath`, effectively prefixing them
567
567
568
568
-**authOptions**: required. a set of options specific to the selected auth method type
569
569
570
-
-**roleID**:[authType=`approle`] required. the approle role-id to use
570
+
-For[authType=`approle`]:
571
571
572
-
-**secretID**: [authType=`approle`] the approle secret-id to use
572
+
-**roleID**: required. the approle role-id to use
573
573
574
-
-**secretIDFile**: [authType=`approle`]the path to a file containing a secret-id (recommended method in production environments)
574
+
-**secretID**: the approle secret-id to use
575
575
576
-
-**secretIDEnv**: [authType=`approle`]the name of an environment variable that contains the secret-id
576
+
-**secretIDFile**: the path to a file containing a secret-id (recommended method in production environments)
577
577
578
-
-**isWrappingToken**: [authType=`approle`] set true if the secret-id is wrapped
578
+
-**secretIDEnv**: the name of an environment variable that contains the secret-id
579
579
580
-
-**role**: [authType=`kubernetes`] required. the kubernetes role to use
580
+
-**isWrappingToken**: set true if the secret-id is wrapped
581
+
582
+
- For [authType=`kubernetes`]:
581
583
582
-
-**tokenPath**: [authType=`kubernetes`] the path to a token used to authenticate (default to the service account token path in a k8s pod)
584
+
-**role**: required. the kubernetes role to use
585
+
586
+
-**tokenPath**: the path to a token used to authenticate (default to the service account token path in a k8s pod)
587
+
588
+
- For [authType=`aws`]:
589
+
590
+
-**role**: required. the AWS role to use
591
+
592
+
-**awsAuthType**: required. the AWS authentication type to use, one of `iam` or `ec2`
593
+
594
+
-**region**: optional. the AWS region to use
595
+
596
+
-**iamServerIdHeader**: [awsAuthType=`iam`] optional. the additional header sent to Vault to mitigate replay attack
597
+
598
+
-**signatureType**: [awsAuthType=`ec2`] optional. the type of signature used to verify EC2 auth logins, one of `pkcs7`, `identity`, or `rsa2048`
599
+
600
+
-**nonce**: [awsAuthType=`ec2`] optional. the nonce sent to Vault to mitigate replay attack, a randomly generated nonce will be used if not provided
583
601
584
602
Finally, remove the `"root"`, `"key"`, and `"crt"` values from your `$(step path)/config/ca.json`, and the associated files. These are generated by `step ca init` but are not used by RA servers.
0 commit comments