diff --git a/src/pages/selfhosted/identity-providers.mdx b/src/pages/selfhosted/identity-providers.mdx index dd13b553..5a1b1e1a 100644 --- a/src/pages/selfhosted/identity-providers.mdx +++ b/src/pages/selfhosted/identity-providers.mdx @@ -8,558 +8,9 @@ There are a few Identity Provider options that you can choose to run a self-host NetBird supports generic OpenID (OIDC) protocol allowing for the integration with any IDP that follows the specification. -## Auth0 +## Self-hosted IDPs -This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide) and explains how to integrate **self-hosted** NetBird with [Auth0](https://auth0.com/). - -Auth0 is a flexible, drop-in solution to add authentication and authorization services to your applications. -It is a 3rd party managed service and can't be self-hosted. Auth0 is the right choice if you don't want to manage an Identity Provider (IDP) -instance on your own. - - - If you prefer to have full control over authentication and authorization of your NetBird network, there are good - self-hosted alternatives to the managed Auth0 service like [Keycloak](/integrations/identity-providers/self-hosted/using-netbird-with-keycloak). - - -### Step 1: Create Auth0 account -To create an Auth0 account, sign up at [https://auth0.com](https://auth0.com/). - -There are multiple properties of the **`setup.env`** file that we will configure in this guide: -- `NETBIRD_AUTH_CLIENT_ID` -- `NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT` -- `NETBIRD_USE_AUTH0` -- `NETBIRD_AUTH_AUDIENCE` -- `NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID` (Optional) -- `NETBIRD_MGMT_IDP` -- `NETBIRD_IDP_MGMT_CLIENT_ID` -- `NETBIRD_IDP_MGMT_CLIENT_SECRET` -- `NETBIRD_IDP_MGMT_EXTRA_AUDIENCE` - -### Step 2: Create and configure Auth0 application - -This Auth0 application will be used to authorize access to NetBird Dashboard (Web UI). - -- Follow the steps in the [Auth0 React SDK Guide](https://auth0.com/docs/quickstart/spa/react/01-login#configure-auth0) -up until "Install the Auth0 React SDK". -- Use **`https://YOUR DOMAIN`** as: `Allowed Callback URLs`, `Allowed Logout URLs`, `Allowed Web Origins`, `Allowed Origins (CORS)` - - Make sure that **`Token Endpoint Authentication Method`** is set to **`None`**. - - -- Use **`Client ID`** to set ```NETBIRD_AUTH_CLIENT_ID``` property in the `setup.env` file. -- Use **`Domain`** to configure ```NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT``` property in the `setup.env` file like so: - -```bash - https:///.well-known/openid-configuration -``` - -Double-check if the endpoint returns a JSON response by calling it from your browser. - - -### Step 3: Create and configure Auth0 API - -This Auth0 API will be used to access NetBird Management Service API. - -- Follow the steps in the [Auth0 Create An API](https://auth0.com/docs/quickstart/backend/golang#create-an-api). -- Use API **`Identifier`** to set ```NETBIRD_AUTH_AUDIENCE``` property in the `setup.env` file. -- Set ```NETBIRD_USE_AUTH0``` to `true`in the `setup.env` file. - -### Step 4: Enable Interactive SSO Login (Optional) - -The [Interactive SSO Login feature](/how-to/installation#running-net-bird-with-sso-login) allows for machine -authorization with your Identity Provider. This feature can be used as an alternative to [setup keys](/how-to/register-machines-using-setup-keys) -and is optional. - -You can enable it by following these steps: -- Log in to your Auth0 account https://manage.auth0.com/ -- Go to `Applications` (left-hand menu) -- Click `Create Application` button (top right) -- Fill in the form with the following values: - - Name: `Interactive Login` - - Application type: `Native` -- Click `Create` - -

- high-level-dia -

- -- Click `Settings` tab -- Copy **`Client ID`** to `NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID` in the `setup.env` file - -

- high-level-dia -

- -- Scroll down to the `Advanced Settings` section -- Enable **`Device Code`** -- Click `Save Changes` - -

- high-level-dia -

- -### Step 5: Create and configuire Machine to Machine application. -This application will be used to authorize access to Auth0 Management API. - -- Log in to your Auth0 account https://manage.auth0.com/ -- Go to `Applications` (left-hand menu) -- Click `Create Application` button (top right) -- Fill in the form with the following values: - - Name: `Netbird API` - - Application type: `Machine to Machine Applications` -- Click `Create` - -

- high-level-dia -

- -- Fill the form with the following values: - - API: `Auth0 Management API` - - Permissions: `read:users`, `update:users`, `create:users`, `read:users_app_metadata`, `update:users_app_metadata`, `create:users_app_metadata` - - Click `Authorize` - -

- high-level-dia -

- -- Click `Settings` tab -- Copy **`Client ID`** to `NETBIRD_IDP_MGMT_CLIENT_ID` in the `setup.env` file -- Copy **`Client SECRET`** to `NETBIRD_IDP_MGMT_CLIENT_SECRET` in the `setup.env` file -- Copy **`DOMAIN`** to `NETBIRD_IDP_MGMT_EXTRA_AUDIENCE` in the `setup.env` file - -

- high-level-dia -

- -- Set properties in the `setup.env` file: -```shell -NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https:///.well-known/openid-configuration" -NETBIRD_USE_AUTH0=true -NETBIRD_AUTH_CLIENT_ID="" -NETBIRD_AUTH_SUPPORTED_SCOPES="openid profile email offline_access api email_verified" -NETBIRD_AUTH_AUDIENCE="" -NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID="" - -NETBIRD_MGMT_IDP="auth0" -NETBIRD_IDP_MGMT_CLIENT_ID="" -NETBIRD_IDP_MGMT_CLIENT_SECRET="" -NETBIRD_IDP_MGMT_EXTRA_AUDIENCE="https:///api/v2/" -``` - - -### Step 6: Continue with the NetBird Self-hosting Guide -You've configured all required resources in Auth0. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). - -## Keycloak - -This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide) and explains how to integrate -**self-hosted** NetBird with [Keycloak](https://www.keycloak.org/). - -Keycloak is an open source software product to allow single sign-on with Identity and Access Management aimed at modern applications and services. - - - If you prefer not to self-host an Identity and Access Management solution, then you could use a managed alternative like - [Auth0](/integrations/identity-providers/self-hosted/using-netbird-with-auth0). - - -The following guide is an adapted version of the original -[Keycloak on Docker](https://www.keycloak.org/getting-started/getting-started-docker) guide from the official website. - -### Expected Result - -After completing this guide, you can log in to your self-hosted NetBird Dashboard and add your machines -to your network using the [Interactive SSO Login feature](/how-to/getting-started#running-net-bird-with-sso-login) -over Keycloak. - -

- high-level-dia -

- -### Step 1: Check your Keycloak Instance - -For this guide, you need a fully configured Keycloak instance running with SSL. - -We assume that your Keycloak instance is available at **`https://YOUR-KEYCLOAK-HOST-AND_PORT`**. -Feel free to change the port if you have configured Keycloak with a different one. - -Most of the OIDC software requires SSL for production use. -We encourage you to comply with this requirement to make the world more secure 😊. - -### Step 2: Create a realm - -To create a realm you need to: - -- Open the Keycloak Admin Console -- Hover the mouse over the dropdown in the top-left corner where it says `Master`, then click on `Create Realm` -- Fill in the form with the following values: -- Realm name: `netbird` -- Click `Create` - -

- high-level-dia -

- - -### Step 3: Create a user - -In this step we will create a NetBird administrator user. - -- Open the Keycloak Admin Console -- Make sure, that the selected realm is `Netbird` -- Click `Users` (left-hand menu) -- Click `Create new user` -- Fill in the form with the following values: -- Username: `netbird` -- Click `Create` - -

- high-level-dia -

- -The user will need an initial password set to be able to log in. To do this: -- Click `Credentials` tab -- Click `Set password` button -- Fill in the password form with a password -- Set the `Temporary` field to `Off` to prevent having to update password on first login -- Click `Save` - -

- high-level-dia -

- -### Step 4: Create a NetBird client - -In this step we will create NetBird application client and register with the Keycloak instance. - -- Open the Keycloak Admin Console -- Make sure, that the selected realm is `Netbird` -- Click `Clients` -- Click `Create client` button -- Fill in the form with the following values and click Next: -- Client Type: `OpenID Connect` -- Client ID: `netbird-client` -- Your newly client `netbird-client` will be used later to set `NETBIRD_AUTH_CLIENT_ID` in the `setup.env` - -

- high-level-dia -

- - -- Check the checkboxes as on the screenshot below and click Save - -

- high-level-dia -

- -### Step 5: Adjust NetBird client access settings - -In this step we will configure NetBird application client access with the NetBird URLs. - -- Open the Keycloak Admin Console -- Make sure, that the selected realm is `Netbird` -- Click `Clients` -- Choose `netbird-client` from the list -- Go to `Access Settings` section -- Fill in the fields with the following values: -- Root URL: `https://YOUR DOMAIN/` (this is the NetBird Dashboard root URL) -- Valid redirect URIs: `https://YOUR DOMAIN/*` -- Valid post logout redirect URIs: `https://YOUR DOMAIN/*` -- Web origins: `+` -- Click `Save` - -

- high-level-dia -

- -### Step 6: Create a NetBird client scope - -In this step, we will create and configure the NetBird client audience for Keycloak to add it to the generated JWT tokens. - -- Open the Keycloak Admin Console -- Make sure, that the selected realm is `Netbird` -- Click `Client scopes` (left-hand menu) -- Click `Create client scope` button -- Fill in the form with the following values: -- Name: `api` -- Type: `Default` -- Protocol: `OpenID Connect` -- Click `Save` - -

- high-level-dia -

- -- While in the newly created Client Scope, switch to the `Mappers` tab -- Click `Configure a new mapper` -- Choose the `Audience` mapping - -

- high-level-dia -

- -- Fill in the form with the following values: -- Name: `Audience for NetBird Management API` -- Included Client Audience: `netbird-client` -- Add to access token: `On` -- Click `Save` - -

- high-level-dia -

- -### Step 7: Add client scope to NetBird client - -- Open the Keycloak Admin Console -- Make sure, that the selected realm is `Netbird` -- Click `Clients` -- Choose `netbird-client` from the list -- Switch to `Client scopes` tab -- Click `Add client scope` button -- Choose `api` -- Click `Add` choosing `Default` -- The value `netbird-client` will be used as audience - -

- high-level-dia -

- -### Step 8: Create a NetBird-Backend client - -In this step we will create NetBird backend client and register with the Keycloak instance. - -- Open the Keycloak Admin Console -- Make sure, that the selected realm is `Netbird` -- Click `Clients` -- Click `Create client` button -- Fill in the form with the following values and click Next: -- Client Type: `OpenID Connect` -- Client ID: `netbird-backend` -- Your newly client `netbird-backend` will be used later to set `NETBIRD_IDP_MGMT_CLIENT_ID` in the `setup.env` - -

- high-level-dia -

- -- Check the checkboxes as on the screenshot below and click Save - -

- high-level-dia -

- -The client will need secret to authenticate. To do this: -- Click `Credentials` tab -- Copy `client secret` will be used later to set `NETBIRD_IDP_MGMT_CLIENT_SECRET` in the `setup.env` - -

- high-level-dia -

- -### Step 9: Add manage-users role to netbird-backend - -- Open the Keycloak Admin Console -- Make sure, that the selected realm is `Netbird` -- Click `Clients` -- Choose `netbird-backend` from the list -- Switch to `Service accounts roles` tab -- Click `Assign roles` button -- Select `Filter by clients` and search for `manage-users` - -

- high-level-dia -

- -- Check the role checkbox and click assign - -

- high-level-dia -

- -Your authority OIDC configuration will be available under: -```bash -https://< YOUR_KEYCLOAK_HOST_AND_PORT >/realms/netbird/.well-known/openid-configuration -``` - - Double-check if the endpoint returns a JSON response by calling it from your browser. - - -- Set properties in the `setup.env` file: -```shell -NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT=`https:///realms/netbird/.well-known/openid-configuration`. -NETBIRD_USE_AUTH0=false -NETBIRD_AUTH_CLIENT_ID=`netbird-client` -NETBIRD_AUTH_SUPPORTED_SCOPES="openid profile email offline_access api" -NETBIRD_AUTH_AUDIENCE=`netbird-client` -NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID=`netbird-client`. Optional, -it enables the [Interactive SSO Login feature](/how-to/getting-started#running-net-bird-with-sso-login) (Oauth 2.0 Device Authorization Flow) - -NETBIRD_MGMT_IDP="keycloak" -NETBIRD_IDP_MGMT_CLIENT_ID="netbird-backend" -NETBIRD_IDP_MGMT_CLIENT_SECRET="" -NETBIRD_IDP_MGMT_EXTRA_ADMIN_ENDPOINT="https:///admin/realms/netbird" - -``` - - Make sure that your Keycloak instance use HTTPS. Otherwise, the setup won't work. - - -### Step 10: Continue with the NetBird Self-hosting Guide -You've configured all required resources in Keycloak. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). - -## Azure AD - -This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide) and explains how to integrate **self-hosted** NetBird with [Azure AD](https://azure.microsoft.com/en-us/products/active-directory/). - -Azure AD is a an enterprise identity service that provides single sign-on and multifactor authentication to your applications. -It is a 3rd party managed service and can't be self-hosted. - - - If you prefer to have full control over authentication and authorization of your NetBird network, there are good - self-hosted alternatives to the managed Auth0 service like [Keycloak](/integrations/identity-providers/self-hosted/using-netbird-with-keycloak). - - -Before you start creating and configuring an Azure AD application, ensure that you have the following: -- An Azure account: To create an Azure AD application, you must have an Azure account. If you don't have one, sign up for a free account at https://azure.microsoft.com/free/. - -- User account with appropriate permissions: You must have an Azure AD user account with the appropriate permissions to create and manage Azure AD applications. If you don't have the required permissions, ask your Azure AD administrator to grant them to you. - - -### Step 1. Create and configure Azure AD application -In this step, we will create and configure NetBird application in azure AD. -- Navigate to [Azure Active Directory](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/Overview) -- Click `App Registrations` in the left menu then click on the `+ New registration` button to create a new application. -- Fill in the form with the following values and click Register -- Name: `Netbird` -- Account Types: `Accounts in this organizational directory only (Default Directory only - Single tenant)` -- Redirect URI: select `Single-page application (SPA)` and URI as `https:///silent-auth` - -

- high-level-dia -

- -### Step 2. Platform configurations -- Click `Authentication` on the left side menu -- Under the `Single-page application` Section, add another URI `https:///auth` and `http://localhost:53000` - -

- high-level-dia -

- -- Scroll down and setup other options as on the screenshot below and click Save - -

- high-level-dia -

- -### Step 3. Create a NetBird application scope -- Click `Expose an API` on the left menu -- Under `Application ID URI` click `Set` and then `Save` -- Click `+ Add a Scope` -- Fill in the form with the following values and click `Add scope` -- Scope name: `api` - -

- high-level-dia -

- -- Under `Authorized client Applications`, click on `+ add a client application` and enter the following: -- Fill in the form with the following values and click `Add application` -- Client ID: same as your Application ID URI minus the `api://` - -

- high-level-dia -

- - -### Step 4. Add API permissions -- Add `Netbird` permissions -- Click `API permissions` on the left menu -- Click `Add a permission` -- Click `My APIs` tab, and select `Netbird`. Next check `api` permission checkbox and click `Add permissions`. - -

- high-level-dia -

- -- Add `Delagated permissions` to Microsoft Graph -- Click `Add a permission` -- Click `Microsoft Graph` and then click `Delagated permissions` tab and check all permissions under the `OpenId permissions` section and click `Add permissions` - -

- high-level-dia -

- - -- Add `Application permissions` to Microsoft Graph -- Click `Add a permission` -- Click `Microsoft Graph` and then click `Application permissions` tab -- Search for `User.ReadWrite.All` and under `User` sections and check `User.ReadWrite.All` checkbox section - -

- high-level-dia -

- -- Search for `Application.ReadWrite.All` and under `Application` sections and check `Application.ReadWrite.All` checkbox section and click `Add permissions` - -

- high-level-dia -

- -- Click `Grant admin conset for Default Directory` and click `Yes` - -

- high-level-dia -

- -### Step 5. Update token version -- Click `Manifest` on left menu -- Search for `accessTokenAcceptedVersion` and change the value from `null` to `2` -- Click `Save` - -### Step 6. Generate client secret -- Click `Certificates & secrets` on left menu -- Click `New client secret` -- Fill in the form with the following values and click `Add` -- Description: `Netbird` -- Copy `Value` and save it as it can be viewed only once after creation. - -

- high-level-dia -

- -Your authority OIDC configuration will be available under: -```bash -https://login.microsoftonline.com//v2.0/.well-known/openid-configuration -``` - - Double-check if the endpoint returns a JSON response by calling it from your browser. - - -- Set properties in the `setup.env` file: -```shell -NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https://login.microsoftonline.com//v2.0/.well-known/openid-configuration" -NETBIRD_USE_AUTH0=false -NETBIRD_AUTH_CLIENT_ID="" -NETBIRD_AUTH_SUPPORTED_SCOPES="openid profile email offline_access api:///api" -NETBIRD_AUTH_AUDIENCE="" -NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID="" -NETBIRD_AUTH_REDIRECT_URI="/auth" -NETBIRD_AUTH_SILENT_REDIRECT_URI="/silent-auth" -NETBIRD_AUTH_USER_ID_CLAIM="oid" - -NETBIRD_AUTH_DEVICE_AUTH_PROVIDER="none" - -NETBIRD_MGMT_IDP="azure" -NETBIRD_IDP_MGMT_CLIENT_ID="" -NETBIRD_IDP_MGMT_CLIENT_SECRET="" -NETBIRD_IDP_MGMT_EXTRA_OBJECT_ID="" -NETBIRD_IDP_MGMT_EXTRA_GRAPH_API_ENDPOINT="https://graph.microsoft.com/v1.0" - -``` - -### Step 7: Continue with the NetBird Self-hosting Guide -You've configured all required resources in Azure AD. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). - -## Zitadel +### Zitadel This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide) and explains how to integrate **self-hosted** NetBird with [Zitadel](https://zitadel.com). @@ -569,7 +20,7 @@ This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted- [Zitadel Cloud](https://zitadel.cloud/). -### Step 1. Create and configure Zitadel application +#### Step 1. Create and configure Zitadel application In this step, we will create and configure NetBird application in zitadel. Create new zitadel project @@ -618,7 +69,7 @@ Create new zitadel application - Copy `Client ID` will be used later in the `setup.env` -### Step 2: Application Token Configuration +#### Step 2: Application Token Configuration To configure `netbird` application token you need to: @@ -634,7 +85,7 @@ To configure `netbird` application token you need to: high-level-dia

-### Step 3: Application Redirect Configuration +#### Step 3: Application Redirect Configuration This step is intended for setup running in development mode with no SSL @@ -653,7 +104,7 @@ To configure `netbird` application redirect you need to: high-level-dia

-### Step 4: Create a Service User +#### Step 4: Create a Service User In this step we will create a `netbird` service user. @@ -680,7 +131,7 @@ In this step we will generate `ClientSecret` for the `netbird` service user. high-level-dia

-### Step 5: Grant manage-users role to netbird service user +#### Step 5: Grant manage-users role to netbird service user In this step we will grant `Org User Manager` role to `netbird` service user. @@ -726,10 +177,266 @@ NETBIRD_IDP_MGMT_EXTRA_MANAGEMENT_ENDPOINT="https:// ``` -### Step 6: Continue with the NetBird Self-hosting Guide +#### Step 6: Continue with the NetBird Self-hosting Guide You've configured all required resources in Zitadel. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). -## Authentik + +### Keycloak + +This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide) and explains how to integrate +**self-hosted** NetBird with [Keycloak](https://www.keycloak.org/). + +Keycloak is an open source software product to allow single sign-on with Identity and Access Management aimed at modern applications and services. + + + If you prefer not to self-host an Identity and Access Management solution, then you could use a managed alternative like + [Auth0](/integrations/identity-providers/self-hosted/using-netbird-with-auth0). + + +The following guide is an adapted version of the original +[Keycloak on Docker](https://www.keycloak.org/getting-started/getting-started-docker) guide from the official website. + +#### Expected Result + +After completing this guide, you can log in to your self-hosted NetBird Dashboard and add your machines +to your network using the [Interactive SSO Login feature](/how-to/getting-started#running-net-bird-with-sso-login) +over Keycloak. + +

+ high-level-dia +

+ +#### Step 1: Check your Keycloak Instance + +For this guide, you need a fully configured Keycloak instance running with SSL. + +We assume that your Keycloak instance is available at **`https://YOUR-KEYCLOAK-HOST-AND_PORT`**. +Feel free to change the port if you have configured Keycloak with a different one. + +Most of the OIDC software requires SSL for production use. +We encourage you to comply with this requirement to make the world more secure 😊. + +#### Step 2: Create a realm + +To create a realm you need to: + +- Open the Keycloak Admin Console +- Hover the mouse over the dropdown in the top-left corner where it says `Master`, then click on `Create Realm` +- Fill in the form with the following values: +- Realm name: `netbird` +- Click `Create` + +

+ high-level-dia +

+ + +#### Step 3: Create a user + +In this step we will create a NetBird administrator user. + +- Open the Keycloak Admin Console +- Make sure, that the selected realm is `Netbird` +- Click `Users` (left-hand menu) +- Click `Create new user` +- Fill in the form with the following values: +- Username: `netbird` +- Click `Create` + +

+ high-level-dia +

+ +The user will need an initial password set to be able to log in. To do this: +- Click `Credentials` tab +- Click `Set password` button +- Fill in the password form with a password +- Set the `Temporary` field to `Off` to prevent having to update password on first login +- Click `Save` + +

+ high-level-dia +

+ +#### Step 4: Create a NetBird client + +In this step we will create NetBird application client and register with the Keycloak instance. + +- Open the Keycloak Admin Console +- Make sure, that the selected realm is `Netbird` +- Click `Clients` +- Click `Create client` button +- Fill in the form with the following values and click Next: +- Client Type: `OpenID Connect` +- Client ID: `netbird-client` +- Your newly client `netbird-client` will be used later to set `NETBIRD_AUTH_CLIENT_ID` in the `setup.env` + +

+ high-level-dia +

+ + +- Check the checkboxes as on the screenshot below and click Save + +

+ high-level-dia +

+ +#### Step 5: Adjust NetBird client access settings + +In this step we will configure NetBird application client access with the NetBird URLs. + +- Open the Keycloak Admin Console +- Make sure, that the selected realm is `Netbird` +- Click `Clients` +- Choose `netbird-client` from the list +- Go to `Access Settings` section +- Fill in the fields with the following values: +- Root URL: `https://YOUR DOMAIN/` (this is the NetBird Dashboard root URL) +- Valid redirect URIs: `https://YOUR DOMAIN/*` +- Valid post logout redirect URIs: `https://YOUR DOMAIN/*` +- Web origins: `+` +- Click `Save` + +

+ high-level-dia +

+ +#### Step 6: Create a NetBird client scope + +In this step, we will create and configure the NetBird client audience for Keycloak to add it to the generated JWT tokens. + +- Open the Keycloak Admin Console +- Make sure, that the selected realm is `Netbird` +- Click `Client scopes` (left-hand menu) +- Click `Create client scope` button +- Fill in the form with the following values: +- Name: `api` +- Type: `Default` +- Protocol: `OpenID Connect` +- Click `Save` + +

+ high-level-dia +

+ +- While in the newly created Client Scope, switch to the `Mappers` tab +- Click `Configure a new mapper` +- Choose the `Audience` mapping + +

+ high-level-dia +

+ +- Fill in the form with the following values: +- Name: `Audience for NetBird Management API` +- Included Client Audience: `netbird-client` +- Add to access token: `On` +- Click `Save` + +

+ high-level-dia +

+ +#### Step 7: Add client scope to NetBird client + +- Open the Keycloak Admin Console +- Make sure, that the selected realm is `Netbird` +- Click `Clients` +- Choose `netbird-client` from the list +- Switch to `Client scopes` tab +- Click `Add client scope` button +- Choose `api` +- Click `Add` choosing `Default` +- The value `netbird-client` will be used as audience + +

+ high-level-dia +

+ +#### Step 8: Create a NetBird-Backend client + +In this step we will create NetBird backend client and register with the Keycloak instance. + +- Open the Keycloak Admin Console +- Make sure, that the selected realm is `Netbird` +- Click `Clients` +- Click `Create client` button +- Fill in the form with the following values and click Next: +- Client Type: `OpenID Connect` +- Client ID: `netbird-backend` +- Your newly client `netbird-backend` will be used later to set `NETBIRD_IDP_MGMT_CLIENT_ID` in the `setup.env` + +

+ high-level-dia +

+ +- Check the checkboxes as on the screenshot below and click Save + +

+ high-level-dia +

+ +The client will need secret to authenticate. To do this: +- Click `Credentials` tab +- Copy `client secret` will be used later to set `NETBIRD_IDP_MGMT_CLIENT_SECRET` in the `setup.env` + +

+ high-level-dia +

+ +#### Step 9: Add manage-users role to netbird-backend + +- Open the Keycloak Admin Console +- Make sure, that the selected realm is `Netbird` +- Click `Clients` +- Choose `netbird-backend` from the list +- Switch to `Service accounts roles` tab +- Click `Assign roles` button +- Select `Filter by clients` and search for `manage-users` + +

+ high-level-dia +

+ +- Check the role checkbox and click assign + +

+ high-level-dia +

+ +Your authority OIDC configuration will be available under: +```bash +https://< YOUR_KEYCLOAK_HOST_AND_PORT >/realms/netbird/.well-known/openid-configuration +``` + + Double-check if the endpoint returns a JSON response by calling it from your browser. + + +- Set properties in the `setup.env` file: +```shell +NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT=`https:///realms/netbird/.well-known/openid-configuration`. +NETBIRD_USE_AUTH0=false +NETBIRD_AUTH_CLIENT_ID=`netbird-client` +NETBIRD_AUTH_SUPPORTED_SCOPES="openid profile email offline_access api" +NETBIRD_AUTH_AUDIENCE=`netbird-client` +NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID=`netbird-client`. Optional, +it enables the [Interactive SSO Login feature](/how-to/getting-started#running-net-bird-with-sso-login) (Oauth 2.0 Device Authorization Flow) + +NETBIRD_MGMT_IDP="keycloak" +NETBIRD_IDP_MGMT_CLIENT_ID="netbird-backend" +NETBIRD_IDP_MGMT_CLIENT_SECRET="" +NETBIRD_IDP_MGMT_EXTRA_ADMIN_ENDPOINT="https:///admin/realms/netbird" + +``` + + Make sure that your Keycloak instance use HTTPS. Otherwise, the setup won't work. + + +#### Step 10: Continue with the NetBird Self-hosting Guide +You've configured all required resources in Keycloak. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). + +### Authentik This guide is a part of the [NetBird Self-hosting Guide](/docs/selfhosted/selfhosted-guide) and explains how to integrate **self-hosted** NetBird with [Authentik](https://goauthentik.io). @@ -739,7 +446,7 @@ This guide is a part of the [NetBird Self-hosting Guide](/docs/selfhosted/selfho [Auth0](/integrations/identity-providers/self-hosted/using-netbird-with-auth0).
-### Step 1: Create OAuth2/OpenID Provider +#### Step 1: Create OAuth2/OpenID Provider In this step, we will create OAuth2/OpenID Provider in Authentik. - Navigate to authentik admin interface @@ -768,7 +475,7 @@ Take note of `Client ID`, we will use it later high-level-dia

-### Step 2: Create external applications +#### Step 2: Create external applications In this step, we will create external applications in Authentik. - Navigate to authentik admin interface @@ -783,7 +490,7 @@ In this step, we will create external applications in Authentik. high-level-dia

-### Step 3: Create service account +#### Step 3: Create service account In this step, we will create service account. - Navigate to authentik admin interface @@ -803,7 +510,7 @@ In this step, we will create service account. high-level-dia

-### Step 4: Add service account to admin group +#### Step 4: Add service account to admin group In this step, we will add `Netbird` service account to `authentik Admins` group. - Navigate to authentik admin interface @@ -843,10 +550,166 @@ NETBIRD_IDP_MGMT_EXTRA_USERNAME="Netbird" NETBIRD_IDP_MGMT_EXTRA_PASSWORD="" ``` -### Step 5: Continue with the NetBird Self-hosting Guide +#### Step 5: Continue with the NetBird Self-hosting Guide You've configured all required resources in Authentik. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). -## Okta +## Managed IDPs + +### Azure AD + +This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide) and explains how to integrate **self-hosted** NetBird with [Azure AD](https://azure.microsoft.com/en-us/products/active-directory/). + +Azure AD is a an enterprise identity service that provides single sign-on and multifactor authentication to your applications. +It is a 3rd party managed service and can't be self-hosted. + + + If you prefer to have full control over authentication and authorization of your NetBird network, there are good + self-hosted alternatives to the managed Auth0 service like [Keycloak](/integrations/identity-providers/self-hosted/using-netbird-with-keycloak). + + +Before you start creating and configuring an Azure AD application, ensure that you have the following: +- An Azure account: To create an Azure AD application, you must have an Azure account. If you don't have one, sign up for a free account at https://azure.microsoft.com/free/. + +- User account with appropriate permissions: You must have an Azure AD user account with the appropriate permissions to create and manage Azure AD applications. If you don't have the required permissions, ask your Azure AD administrator to grant them to you. + + +#### Step 1. Create and configure Azure AD application +In this step, we will create and configure NetBird application in azure AD. +- Navigate to [Azure Active Directory](https://portal.azure.com/#view/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/~/Overview) +- Click `App Registrations` in the left menu then click on the `+ New registration` button to create a new application. +- Fill in the form with the following values and click Register +- Name: `Netbird` +- Account Types: `Accounts in this organizational directory only (Default Directory only - Single tenant)` +- Redirect URI: select `Single-page application (SPA)` and URI as `https:///silent-auth` + +

+ high-level-dia +

+ +#### Step 2. Platform configurations +- Click `Authentication` on the left side menu +- Under the `Single-page application` Section, add another URI `https:///auth` and `http://localhost:53000` + +

+ high-level-dia +

+ +- Scroll down and setup other options as on the screenshot below and click Save + +

+ high-level-dia +

+ +#### Step 3. Create a NetBird application scope +- Click `Expose an API` on the left menu +- Under `Application ID URI` click `Set` and then `Save` +- Click `+ Add a Scope` +- Fill in the form with the following values and click `Add scope` +- Scope name: `api` + +

+ high-level-dia +

+ +- Under `Authorized client Applications`, click on `+ add a client application` and enter the following: +- Fill in the form with the following values and click `Add application` +- Client ID: same as your Application ID URI minus the `api://` + +

+ high-level-dia +

+ + +#### Step 4. Add API permissions +- Add `Netbird` permissions +- Click `API permissions` on the left menu +- Click `Add a permission` +- Click `My APIs` tab, and select `Netbird`. Next check `api` permission checkbox and click `Add permissions`. + +

+ high-level-dia +

+ +- Add `Delagated permissions` to Microsoft Graph +- Click `Add a permission` +- Click `Microsoft Graph` and then click `Delagated permissions` tab and check all permissions under the `OpenId permissions` section and click `Add permissions` + +

+ high-level-dia +

+ + +- Add `Application permissions` to Microsoft Graph +- Click `Add a permission` +- Click `Microsoft Graph` and then click `Application permissions` tab +- Search for `User.ReadWrite.All` and under `User` sections and check `User.ReadWrite.All` checkbox section + +

+ high-level-dia +

+ +- Search for `Application.ReadWrite.All` and under `Application` sections and check `Application.ReadWrite.All` checkbox section and click `Add permissions` + +

+ high-level-dia +

+ +- Click `Grant admin conset for Default Directory` and click `Yes` + +

+ high-level-dia +

+ +#### Step 5. Update token version +- Click `Manifest` on left menu +- Search for `accessTokenAcceptedVersion` and change the value from `null` to `2` +- Click `Save` + +#### Step 6. Generate client secret +- Click `Certificates & secrets` on left menu +- Click `New client secret` +- Fill in the form with the following values and click `Add` +- Description: `Netbird` +- Copy `Value` and save it as it can be viewed only once after creation. + +

+ high-level-dia +

+ +Your authority OIDC configuration will be available under: +```bash +https://login.microsoftonline.com//v2.0/.well-known/openid-configuration +``` + + Double-check if the endpoint returns a JSON response by calling it from your browser. + + +- Set properties in the `setup.env` file: +```shell +NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https://login.microsoftonline.com//v2.0/.well-known/openid-configuration" +NETBIRD_USE_AUTH0=false +NETBIRD_AUTH_CLIENT_ID="" +NETBIRD_AUTH_SUPPORTED_SCOPES="openid profile email offline_access api:///api" +NETBIRD_AUTH_AUDIENCE="" +NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID="" +NETBIRD_AUTH_REDIRECT_URI="/auth" +NETBIRD_AUTH_SILENT_REDIRECT_URI="/silent-auth" +NETBIRD_AUTH_USER_ID_CLAIM="oid" + +NETBIRD_AUTH_DEVICE_AUTH_PROVIDER="none" + +NETBIRD_MGMT_IDP="azure" +NETBIRD_IDP_MGMT_CLIENT_ID="" +NETBIRD_IDP_MGMT_CLIENT_SECRET="" +NETBIRD_IDP_MGMT_EXTRA_OBJECT_ID="" +NETBIRD_IDP_MGMT_EXTRA_GRAPH_API_ENDPOINT="https://graph.microsoft.com/v1.0" + +``` + +#### Step 7: Continue with the NetBird Self-hosting Guide +You've configured all required resources in Azure AD. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). + +### Okta This guide is a part of the [NetBird Self-hosting Guide](/getting-started/self-hosting) and explains how to integrate **self-hosted** NetBird with [Okta](https://www.okta.com/). @@ -857,7 +720,7 @@ If you prefer to have full control over authentication and authorization of your Before you start creating and configuring an Okta application, ensure that you have an Okta workforce identity cloud account. If you don't have one, sign up for a free account at https://www.okta.com/free-trial/. -### Step 1. Create and configure Okta single-page application +#### Step 1. Create and configure Okta single-page application In this step, we will create and configure Netbird single-page application in okta. - Navigate to Okta Admin Dashboard - Click `Applications` in the left menu and then click on `Applications` @@ -892,7 +755,7 @@ In this step, we will create and configure Netbird single-page application in ok high-level-dia

-### Step 2. Create and configure Okta native application +#### Step 2. Create and configure Okta native application In this step, we will create and configure Netbird native application in okta. - Navigate to Okta Admin Dashboard - Click `Applications` in the left menu and then click on `Applications` @@ -926,7 +789,7 @@ In this step, we will create and configure Netbird native application in okta.

-### Step 3. Generate api token +#### Step 3. Generate api token In this step, we will generate netbird api token in okta for authorizing calls to user api. - Navigate to Okta Admin Dashboard @@ -971,10 +834,10 @@ NETBIRD_AUTH_DEVICE_AUTH_USE_ID_TOKEN=true NETBIRD_MGMT_IDP="okta" NETBIRD_IDP_MGMT_EXTRA_API_TOKEN="" ``` -### Step 4: Continue with the NetBird Self-hosting Guide +#### Step 4: Continue with the NetBird Self-hosting Guide You've configured all required resources in Okta. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). -## Google Workspace +### Google Workspace This guide is a part of the [NetBird Self-hosting Guide](/getting-started/self-hosting) and explains how to integrate **self-hosted** NetBird with [Google Workspace](https://workspace.google.com/). @@ -985,7 +848,7 @@ Before you start creating and configuring an Google Workspace application, ensur - Create new `Netbird` project in Google cloud console https://console.cloud.google.com. - Enable `Admin SDK API` for `Netbird` project at https://console.cloud.google.com/apis/library/admin.googleapis.com. -### Step 1: Configure OAuth consent screen +#### Step 1: Configure OAuth consent screen - Navigate to [OAuth consent](https://console.cloud.google.com/apis/credentials/consent) page - Select `Internal` User Type and click create

@@ -1008,7 +871,7 @@ Before you start creating and configuring an Google Workspace application, ensur high-level-dia

-### Step 2: Create OAuth 2.0 credentials +#### Step 2: Create OAuth 2.0 credentials - Navigate to [API Credentials](https://console.cloud.google.com/apis/credentials) page - Click `CREATE CREDENTIALS` at the top and select `OAuth client ID` - Fill in the form with the following values and click `CREATE` @@ -1024,7 +887,7 @@ Before you start creating and configuring an Google Workspace application, ensur high-level-dia

-### Step 3: Create service account +#### Step 3: Create service account - Navigate to [API Credentials](https://console.cloud.google.com/apis/credentials) page - Click `CREATE CREDENTIALS` at the top and select `Service account` - Fill in the form with the following values and click `CREATE` @@ -1036,7 +899,7 @@ Before you start creating and configuring an Google Workspace application, ensur high-level-dia

-### Step 4: Create service account keys +#### Step 4: Create service account keys - Navigate to [API Credentials](https://console.cloud.google.com/apis/credentials) page - Under `Service Accounts` click the `netbird` to edit the service account

@@ -1053,7 +916,7 @@ Read how to manage and secure your service keys [here](https://cloud.google.com/ - Open downloaded json file and take note of `client_id` will be used later as `Service Account Client ID` -### Step 5: Grant user and schema management admin role to service account +#### Step 5: Grant user and schema management admin role to service account - Navigate to [Admin Console](https://admin.google.com/ac/home) page - Select `Account` on the left menu and then click `Admin Roles` - Click `Create new role` @@ -1082,7 +945,7 @@ Read how to manage and secure your service keys [here](https://cloud.google.com/ high-level-dia

-### Step 6: Granting service account access to organization data +#### Step 6: Granting service account access to organization data - Navigate to [Admin Console](https://admin.google.com/ac/home) page - Select `Security` > `Access and data control` > `API controls` and then click `MANAGE DOMAIN WIDE DELEGATION` - Click `Add new` @@ -1124,5 +987,147 @@ NETBIRD_IDP_MGMT_EXTRA_SERVICE_ACCOUNT_KEY="" NETBIRD_IDP_MGMT_EXTRA_CUSTOMER_ID="" ``` -### Step 7: Continue with the NetBird Self-hosting Guide -You've configured all required resources in Google Workspace. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). \ No newline at end of file +#### Step 7: Continue with the NetBird Self-hosting Guide +You've configured all required resources in Google Workspace. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). + +### Auth0 + +This guide is a part of the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide) and explains how to integrate **self-hosted** NetBird with [Auth0](https://auth0.com/). + +Auth0 is a flexible, drop-in solution to add authentication and authorization services to your applications. +It is a 3rd party managed service and can't be self-hosted. Auth0 is the right choice if you don't want to manage an Identity Provider (IDP) +instance on your own. + + + If you prefer to have full control over authentication and authorization of your NetBird network, there are good + self-hosted alternatives to the managed Auth0 service like [Keycloak](/integrations/identity-providers/self-hosted/using-netbird-with-keycloak). + + +#### Step 1: Create Auth0 account +To create an Auth0 account, sign up at [https://auth0.com](https://auth0.com/). + +There are multiple properties of the **`setup.env`** file that we will configure in this guide: +- `NETBIRD_AUTH_CLIENT_ID` +- `NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT` +- `NETBIRD_USE_AUTH0` +- `NETBIRD_AUTH_AUDIENCE` +- `NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID` (Optional) +- `NETBIRD_MGMT_IDP` +- `NETBIRD_IDP_MGMT_CLIENT_ID` +- `NETBIRD_IDP_MGMT_CLIENT_SECRET` +- `NETBIRD_IDP_MGMT_EXTRA_AUDIENCE` + +#### Step 2: Create and configure Auth0 application + +This Auth0 application will be used to authorize access to NetBird Dashboard (Web UI). + +- Follow the steps in the [Auth0 React SDK Guide](https://auth0.com/docs/quickstart/spa/react/01-login#configure-auth0) +up until "Install the Auth0 React SDK". +- Use **`https://YOUR DOMAIN`** as: `Allowed Callback URLs`, `Allowed Logout URLs`, `Allowed Web Origins`, `Allowed Origins (CORS)` + + Make sure that **`Token Endpoint Authentication Method`** is set to **`None`**. + + +- Use **`Client ID`** to set ```NETBIRD_AUTH_CLIENT_ID``` property in the `setup.env` file. +- Use **`Domain`** to configure ```NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT``` property in the `setup.env` file like so: + +```bash + https:///.well-known/openid-configuration +``` + + Double-check if the endpoint returns a JSON response by calling it from your browser. + + +#### Step 3: Create and configure Auth0 API + +This Auth0 API will be used to access NetBird Management Service API. + +- Follow the steps in the [Auth0 Create An API](https://auth0.com/docs/quickstart/backend/golang#create-an-api). +- Use API **`Identifier`** to set ```NETBIRD_AUTH_AUDIENCE``` property in the `setup.env` file. +- Set ```NETBIRD_USE_AUTH0``` to `true`in the `setup.env` file. + +#### Step 4: Enable Interactive SSO Login (Optional) + +The [Interactive SSO Login feature](/how-to/installation#running-net-bird-with-sso-login) allows for machine +authorization with your Identity Provider. This feature can be used as an alternative to [setup keys](/how-to/register-machines-using-setup-keys) +and is optional. + +You can enable it by following these steps: +- Log in to your Auth0 account https://manage.auth0.com/ +- Go to `Applications` (left-hand menu) +- Click `Create Application` button (top right) +- Fill in the form with the following values: + - Name: `Interactive Login` + - Application type: `Native` +- Click `Create` + +

+ high-level-dia +

+ +- Click `Settings` tab +- Copy **`Client ID`** to `NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID` in the `setup.env` file + +

+ high-level-dia +

+ +- Scroll down to the `Advanced Settings` section +- Enable **`Device Code`** +- Click `Save Changes` + +

+ high-level-dia +

+ +#### Step 5: Create and configuire Machine to Machine application. +This application will be used to authorize access to Auth0 Management API. + +- Log in to your Auth0 account https://manage.auth0.com/ +- Go to `Applications` (left-hand menu) +- Click `Create Application` button (top right) +- Fill in the form with the following values: + - Name: `Netbird API` + - Application type: `Machine to Machine Applications` +- Click `Create` + +

+ high-level-dia +

+ +- Fill the form with the following values: + - API: `Auth0 Management API` + - Permissions: `read:users`, `update:users`, `create:users`, `read:users_app_metadata`, `update:users_app_metadata`, `create:users_app_metadata` + - Click `Authorize` + +

+ high-level-dia +

+ +- Click `Settings` tab +- Copy **`Client ID`** to `NETBIRD_IDP_MGMT_CLIENT_ID` in the `setup.env` file +- Copy **`Client SECRET`** to `NETBIRD_IDP_MGMT_CLIENT_SECRET` in the `setup.env` file +- Copy **`DOMAIN`** to `NETBIRD_IDP_MGMT_EXTRA_AUDIENCE` in the `setup.env` file + +

+ high-level-dia +

+ +- Set properties in the `setup.env` file: +```shell +NETBIRD_AUTH_OIDC_CONFIGURATION_ENDPOINT="https:///.well-known/openid-configuration" +NETBIRD_USE_AUTH0=true +NETBIRD_AUTH_CLIENT_ID="" +NETBIRD_AUTH_SUPPORTED_SCOPES="openid profile email offline_access api email_verified" +NETBIRD_AUTH_AUDIENCE="" +NETBIRD_AUTH_DEVICE_AUTH_CLIENT_ID="" + +NETBIRD_MGMT_IDP="auth0" +NETBIRD_IDP_MGMT_CLIENT_ID="" +NETBIRD_IDP_MGMT_CLIENT_SECRET="" +NETBIRD_IDP_MGMT_EXTRA_AUDIENCE="https:///api/v2/" +``` + + +#### Step 6: Continue with the NetBird Self-hosting Guide +You've configured all required resources in Auth0. You can now continue with the [NetBird Self-hosting Guide](/selfhosted/selfhosted-guide#step-4-disable-single-account-mode-optional). diff --git a/src/pages/selfhosted/selfhosted-guide.mdx b/src/pages/selfhosted/selfhosted-guide.mdx index 738e8071..8163d7b5 100644 --- a/src/pages/selfhosted/selfhosted-guide.mdx +++ b/src/pages/selfhosted/selfhosted-guide.mdx @@ -13,7 +13,58 @@ If you would like to learn more about the architecture please refer to the [Arch We run NetBird in the cloud, and it will take less than 5 minutes to get started with our managed version. [Check it out!](https://netbird.io/pricing) -## Requirements + +## Getting started with NetBird and Zitadel +In this guide, we will guide you through deploying NetBird with [Zitadel](https://zitadel.com/) +as the identity provider for user management using a getting started setup script and docker containers. + + + This is the quickest way to try self-hosted NetBird. It should take around 5 minutes to get started if you already have a public domain and a VM. + Follow the [Advanced guide with a custom identity provider](#advanced-guide-with-a-custom-identity-provider) for installations with different IDPs. + + +### Requirements + +**Infrastructure requirements:** +- A Linux VM with at least **1CPU** and **2GB** of memory. +- The VM should be publicly accessible on TCP ports **80** and **443** and UDP ports: **3478**, **49152-65535**. +- **Public domain** name pointing to the VM. + +**Software requirements:** +- Docker installed on the VM with the docker compose plugin ([Docker installation guide](https://docs.docker.com/engine/install/)) or docker with docker-compose in version 2 or higher. +- [jq](https://jqlang.github.io/jq/) installed. In most distributions +Usually available in the official repositories and can be installed with `sudo apt install jq` or `sudo yum install jq` +- [curl](https://curl.se/) installed. +Usually available in the official repositories and can be installed with `sudo apt install curl` or `sudo yum install curl` + +### Download and run the script + +Download and run the installation script in a single line: +```bash +export NETBIRD_DOMAIN=netbird.example.com; curl -fsSL https://github.com/netbirdio/netbird/releases/latest/download/getting-started-with-zitadel.sh | bash +``` +If you want to check the script before running it, you can download it and run it locally: +```bash +curl -sSLO https://github.com/netbirdio/netbird/releases/latest/download/getting-started-with-zitadel.sh +# check the script +cat getting-started-with-zitadel.sh +# run the script +export NETBIRD_DOMAIN=netbird.example.com +bash getting-started-with-zitadel.sh +``` + + Replace `netbird.example.com` with your domain name. + +Once the script execution is complete, you can access your netbird instance via the URL `https://netbird.example.com` using the credentials displayed in your terminal. + +### Creating users +If you want to add additional users, you can access Zitadel's management console via the URL `https://netbird.example.com/ui/console` with the same credentials. Follow the [Users guide](https://zitadel.com/docs/guides/manage/console/users) +from Zitadel to add additional local users or integrate Zitadel with your existing identity provider by following the guide [Configure identity providers](https://zitadel.com/docs/guides/integrate/identity-providers). + +## Advanced guide with a custom identity provider +This guide will walk you through deploying NetBird with a custom identity provider for user management. + +### Requirements - Virtual machine offered by any cloud provider (e.g., AWS, DigitalOcean, Hetzner, Google Cloud, Azure ...). - Any Linux OS. @@ -25,7 +76,7 @@ If you would like to learn more about the architecture please refer to the [Arch For this tutorial we will be using domain ```demo.netbird.io``` which points to our Ubuntu 22.04 machine hosted at Hetzner. -## Step 1: Get the latest stable NetBird code +### Step 1: Get the latest stable NetBird code ```bash #!/bin/bash @@ -43,7 +94,7 @@ Then switch to the infra folder that contains docker-compose file: ```bash cd netbird/infrastructure_files/ ``` -## Step 2: Prepare configuration files +### Step 2: Prepare configuration files To simplify the setup we have prepared a script to substitute required properties in the [docker-compose.yml.tmpl](https://github.com/netbirdio/netbird/tree/main/infrastructure_files/docker-compose.yml.tmpl) and [management.json.tmpl](https://github.com/netbirdio/netbird/tree/main/infrastructure_files/management.json.tmpl) files. @@ -80,7 +131,7 @@ This can be any email address. [Let's Encrypt](https://letsencrypt.org/) will cr If you want to setup netbird with your own reverse-Proxy and without using the integrated letsencrypt, follow [this step here instead](#advanced-running-netbird-behind-an-existing-reverse-proxy). -## Step 3: Configure Identity Provider (IDP) +### Step 3: Configure Identity Provider (IDP) NetBird supports generic OpenID (OIDC) protocol allowing integration with any IDP following the specification. @@ -99,7 +150,7 @@ Pick the one that suits your needs, follow the steps, and continue with this gui - Continue with [Okta](/selfhosted/identity-providers#okta). - Continue with [Auth0](/selfhosted/identity-providers#auth0). -## Step 4: Disable single account mode (optional) +### Step 4: Disable single account mode (optional) NetBird Management service runs in a single account mode by default since version v0.10.1. Management service was creating a separate account for each registered user before v0.10.1. @@ -110,7 +161,7 @@ If you want to disable the single-account mode, set `--disable-single-account-mo [docker-compose.yml.tmpl](https://github.com/netbirdio/netbird/tree/main/infrastructure_files/docker-compose.yml.tmpl) `command` section of the `management` service. -## Step 5: Run configuration script +### Step 5: Run configuration script Make sure all the required properties set in the ```setup.env``` file and run: ```bash @@ -119,12 +170,12 @@ Make sure all the required properties set in the ```setup.env``` file and run: This will export all the properties as environment variables and generate ```docker-compose.yml``` and ```management.json``` files substituting required variables. -## Step 6: Run docker compose: +### Step 6: Run docker compose: ```bash docker-compose up -d ``` -## Step 7: Check docker logs (Optional) +### Step 7: Check docker logs (Optional) ```bash docker-compose logs signal