|
|
|
|
@@ -1,77 +1,74 @@
|
|
|
|
|
# Automate Deployments and Onboard Machines at Scale with Setup Keys
|
|
|
|
|
|
|
|
|
|
# Use setup keys to run automated deployments and add machines to your network at scale
|
|
|
|
|
A setup key is a pre-authentication token used to register new machines in your network.
|
|
|
|
|
On a machine's first run, it associates that machine with your account.
|
|
|
|
|
|
|
|
|
|
Setup key is a pre-authentication key that allows to register new machines in your network.
|
|
|
|
|
It simply associates a machine with an account on a first run.
|
|
|
|
|
## Registering Machines Using Setup Keys
|
|
|
|
|
|
|
|
|
|
## Related Video Content
|
|
|
|
|
For a comprehensive guide, part of our "Getting started with NetBird" video specifically covers setup keys:
|
|
|
|
|
<YouTube videoId="JRCZy4rLi-c" start={175} />
|
|
|
|
|
Pass the setup key to the ```netbird up``` command to authenticate a machine without interactive SSO login.
|
|
|
|
|
This unlocks automated, unattended deployments and integrates cleanly with infrastructure-as-code tools such as Ansible, CloudFormation, and Terraform.
|
|
|
|
|
|
|
|
|
|
The setup key can be provided as a parameter to the ```netbird up``` command.
|
|
|
|
|
This makes it possible to run automated deployments with infrastructure-as-code software like Ansible, Cloudformation or Terraform.
|
|
|
|
|
|
|
|
|
|
```bash {{ title: 'Starting NetBird Client' }}
|
|
|
|
|
sudo netbird up --setup-key <SETUP KEY>
|
|
|
|
|
```bash
|
|
|
|
|
netbird up --setup-key <SETUP KEY>
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## Types of setup keys
|
|
|
|
|
## Types of Setup Keys
|
|
|
|
|
|
|
|
|
|
There are 2 types of setup keys:
|
|
|
|
|
* **One-off key**. This type of key can be used only once to authenticate a machine.
|
|
|
|
|
* **Reusable key**. This type of key can be used multiple times to authenticate machines.
|
|
|
|
|
There are two types of setup keys:
|
|
|
|
|
* **One-off key** — can be used only once to authenticate a single machine.
|
|
|
|
|
* **Reusable key** — can be used multiple times to authenticate a configurable number of machines.
|
|
|
|
|
|
|
|
|
|
## Ephemeral peers
|
|
|
|
|
## Ephemeral Peers
|
|
|
|
|
|
|
|
|
|
You can create a setup key with the ephemeral peers option enabled.
|
|
|
|
|
Peers added with this key that later become offline for over 10 minutes will be removed automatically from the NetBird system.
|
|
|
|
|
Peers registered with this key are automatically removed from NetBird after staying offline for more than 10 minutes.
|
|
|
|
|
|
|
|
|
|
This is useful when you want to add containers or auto scaling instances to your network.
|
|
|
|
|
This is useful for short-lived workloads such as containers or autoscaling instances.
|
|
|
|
|
|
|
|
|
|
## Using setup keys
|
|
|
|
|
## Managing Setup Keys
|
|
|
|
|
|
|
|
|
|
Setup keys are available in the NetBird Management Dashboard under `Peers` → `Setup Keys` [https://app.netbird.io/setup-keys](https://app.netbird.io/setup-keys).
|
|
|
|
|
You can easily add new or revoke keys.
|
|
|
|
|
Setup keys are available in the NetBird Management Dashboard under `Settings` → `Setup Keys`.
|
|
|
|
|
Use [this page](https://app.netbird.io/settings?tab=setup-keys) to view and manage your setup keys.
|
|
|
|
|
From there, you can add new keys or revoke existing ones.
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
<img src="/docs-static/img/manage/peers/register-machines-using-setup-keys/setup-keys.png" alt="high-level-dia" className="imagewrapper-big"/>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
<Note>
|
|
|
|
|
When revoking a key, all machines authenticated with this key will remain connected to the network. The same logic applies when the key expires.
|
|
|
|
|
When you revoke a key, all machines already authenticated with it remain connected to the network. The same applies when the key expires.
|
|
|
|
|
</Note>
|
|
|
|
|
|
|
|
|
|
## Expiration
|
|
|
|
|
|
|
|
|
|
You can set expiration when creating a key. When expired, the setup key can't be used anymore.
|
|
|
|
|
You can set an expiration date when creating a key. Once expired, the key can no longer be used.
|
|
|
|
|
|
|
|
|
|
## Usage limit
|
|
|
|
|
## Usage Limit
|
|
|
|
|
|
|
|
|
|
By default, every reusable key has unlimited usage.
|
|
|
|
|
We recommend limiting the number of times the key can be used, e.g., set it to 30 if you need to enroll only 30 machines.
|
|
|
|
|
We recommend limiting the number of times a key can be used — for example, set it to 30 if you only need to enroll 30 machines.
|
|
|
|
|
|
|
|
|
|
## Allow Extra DNS Labels
|
|
|
|
|
|
|
|
|
|
You can create a setup key with the **Allow Extra DNS Labels** option enabled.
|
|
|
|
|
When enabled, peers registered with this key can set additional DNS names using the `--extra-dns-labels` flag. Other peers in the network can then reach them by these names.
|
|
|
|
|
When enabled, peers registered with this key can set additional DNS names using the `--extra-dns-labels` flag, so other peers in the network can reach them by those names.
|
|
|
|
|
|
|
|
|
|
If multiple peers share the same label, they form a DNS round-robin group for that label, distributing queries across all of them.
|
|
|
|
|
If multiple peers share the same label, they form a DNS round-robin group for that label, with queries distributed across all of them.
|
|
|
|
|
|
|
|
|
|
See [Extra DNS Labels](/manage/dns/extra-dns-labels) for full details, including wildcard labels and usage examples.
|
|
|
|
|
|
|
|
|
|
## Peer Auto-grouping
|
|
|
|
|
## Peer Auto-Grouping
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NetBird offers a powerful [access control feature](/manage/access-control/manage-network-access) that allows easy access management of your resources.
|
|
|
|
|
In a basic scenario, you would create multiple groups of peers and create access rules to define what groups can access each other.
|
|
|
|
|
Adding peers to groups might become time-consuming in large networks with dozens of machines.
|
|
|
|
|
NetBird offers a powerful [access control feature](/manage/access-control/manage-network-access) for managing access to your resources.
|
|
|
|
|
In a typical setup, you create multiple groups of peers and define access rules that determine which groups can reach each other.
|
|
|
|
|
Adding peers to groups manually can become time-consuming in large networks with dozens of machines.
|
|
|
|
|
|
|
|
|
|
Starting NetBird [v0.9.2](https://github.com/netbirdio/netbird/releases), when creating or updating a setup key,
|
|
|
|
|
it is possible to specify a list of auto-assign groups. Every peer registered with this key will be automatically added
|
|
|
|
|
to these groups. All the access control rules enabled for these groups will apply automatically.
|
|
|
|
|
Starting with NetBird [v0.9.2](https://github.com/netbirdio/netbird/releases), you can specify a list of auto-assign groups when creating or updating a setup key.
|
|
|
|
|
Every peer registered with this key is automatically added to those groups, and all access control rules for those groups apply automatically.
|
|
|
|
|
|
|
|
|
|
To add `Auto-assign groups`, open `Peers` → `Setup Keys` and create or update any existing setup key.
|
|
|
|
|
Then use this key to enroll new machine.
|
|
|
|
|
To configure `Auto-assign groups`, open `Settings` → `Setup Keys` and create or update a setup key.
|
|
|
|
|
Then use this key to enroll new machines.
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
<img src="/docs-static/img/manage/peers/register-machines-using-setup-keys/netbird-peer-auto-tagging-newkey.png" alt="high-level-dia" className="imagewrapper"/>
|
|
|
|
|
@@ -81,17 +78,17 @@ Then use this key to enroll new machine.
|
|
|
|
|
Auto-assign groups will apply only to newly registered machines.
|
|
|
|
|
</Note>
|
|
|
|
|
|
|
|
|
|
## Create setup key
|
|
|
|
|
## Create Setup Key
|
|
|
|
|
|
|
|
|
|
Go to `Peers` → `Setup Keys` and click the `Create Setup Key` button
|
|
|
|
|
In the opened popup, give your new key an easily identifiable name, choose type, set usage limit, and assign auto groups.
|
|
|
|
|
The defaults should be suitable for most of the cases. We recommend using one-off keys for security reasons.
|
|
|
|
|
Go to `Settings` → `Setup Keys` and click the `Create Setup Key` button.
|
|
|
|
|
In the dialog that opens, give your new key a recognizable name, choose its type, set a usage limit, and assign auto-groups.
|
|
|
|
|
The defaults are suitable for most cases. For security reasons, we recommend using one-off keys.
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
<img src="/docs-static/img/manage/peers/register-machines-using-setup-keys/add-setup-key.png" alt="high-level-dia" className="imagewrapper"/>
|
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
After your key has been successfully created, copy and store it in a secure location.
|
|
|
|
|
Once the key has been created, copy it and store it in a secure location.
|
|
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
<img src="/docs-static/img/manage/peers/register-machines-using-setup-keys/setup-key-created.png" alt="high-level-dia" className="imagewrapper"/>
|
|
|
|
|
|