From d69ebbfd2467a78bb4268f71d93c396cca0bd05c Mon Sep 17 00:00:00 2001 From: NiceDevil <17103076+nicedevil007@users.noreply.github.com> Date: Fri, 31 Jan 2025 20:57:51 +0100 Subject: [PATCH 1/4] initial release --- .../integrations/services/beszel/index.mdx | 94 +++++++++++++++++++ website/sidebarsIntegrations.js | 1 + 2 files changed, 95 insertions(+) create mode 100644 website/integrations/services/beszel/index.mdx diff --git a/website/integrations/services/beszel/index.mdx b/website/integrations/services/beszel/index.mdx new file mode 100644 index 000000000000..8d6785bec743 --- /dev/null +++ b/website/integrations/services/beszel/index.mdx @@ -0,0 +1,94 @@ +--- +title: Integrate with Beszel +sidebar_label: Beszel +--- + +# Integrate With Beszel + +Support level: Community + +## What is Beszel + +> Beszel is a lightweight server monitoring platform that provides Docker statistics, historical data, and configurable alerts. +> It features a user-friendly web interface, supports multi-user management, OAuth authentication, and offers a REST API for integration with other applications. +> Designed for simplicity, Beszel is easy to set up and operates efficiently without requiring public internet exposure. +> +> -- https://beszel.dev/ +> +> This guide explains how to configure Beszel to use authentik as the OAuth provider for logging in to the Web GUI. + +## Preparation + +The following placeholders are used in this guide: + +- `beszel.company` is the FQDN of the Beszel installation. +- `authentik.company` is the FQDN of the authentik installation. + +:::note +This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application. +::: + +## authentik configuration + +Start the wizard for adding a new application. + +**1. Application:** + +- Name: `Beszel` +- Slug: `beszel` + +**2. Choose a Provider** + +Select `OAuth2/OpenID Provider` + +**3. Configure Provider** + +Select implicit or explicit authorization flow as desired. + +Take note of the Client ID and Client Secret, you'll need to give them to Beszel later. + +- Redirect URIs/Origins (RegEx): `https://_beszel.company_/api/oauth2-redirect` +- Signing Key: Select any available signing keys. + +Leave the rest as default values. + +## Beszel configuration + +1. Sign in to Beszel with a browser of your choice and access the system setting by using this URL https://_beszel.company_/_/#/settings. + +2. Disable **Hide collection create and edit controls** and click **Save changes**. + +3. Open the **users** submenu by clicking the **Collections** icon in the left menu or by accessing this URL: https://beszel.company/_/#/collections?collection=pb_users_auth. + +4. Click the gear icon next to **users**, then select the **Options** tab. + +5. Enable **OAuth2** by toggling the corresponding switch. + +6. Click **+ Add provider** and select **OpenID Connect**. + +7. Enter the following details from the authentik provider: + - Set **Client ID** to _client-id_ + - Set **Client secret** to _client-secret_ + - Set **Display name** to **authentik** + - Set **Auth URL** to https://_authentik.company_/application/o/authorize/ + - Set **Token URL** to https://_authentik.company_/application/o/token/ + - Set **User info URL** to https://_authentik.company_/application/o/userinfo/ + +## Test the login + +- Open your web browser and go to: https://_beszel.company_. +- Click **authentik** to log in. +- You should be redirected to authentik (following the login flow you configured). After logging in, authentik will redirect you back to https://_beszel.company_. +- If you successfully return to the Beszel WebGUI, the login is working correctly. + +## User Creation + +1. Manually Creating Users: + - Users are not created automatically when logging in with authentik. The owner must manually create each user in Beszel. + - To create users, go to the System Settings where you configured OpenID Connect. + - The URL for user creation is: https://_beszel.company_/_/#/collections?collection=pb_users_auth. + - Click **+ New record** and enter the user's **email** (must match the authentik email address). + +2. Automatically Creating Users: + - Set the following environment variable: **USER_CREATION=true** + - Depending on your deployment method, you can set this as a Docker environment variable or in the systemd service file. diff --git a/website/sidebarsIntegrations.js b/website/sidebarsIntegrations.js index cd1637da15a1..dcb0ce2d5ca0 100644 --- a/website/sidebarsIntegrations.js +++ b/website/sidebarsIntegrations.js @@ -144,6 +144,7 @@ module.exports = { type: "category", label: "Monitoring", items: [ + "services/beszel/index", "services/chronograf/index", "services/gatus/index", "services/glitchtip/index", From 849a3190b90bdbbba376ce7ede79fc04997c0e4c Mon Sep 17 00:00:00 2001 From: nicedevil007 Date: Fri, 31 Jan 2025 20:12:05 +0000 Subject: [PATCH 2/4] Ready for PR --- authentik/lib/sync/outgoing/models.py | 6 +++--- website/integrations/services/beszel/index.mdx | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/authentik/lib/sync/outgoing/models.py b/authentik/lib/sync/outgoing/models.py index 72657c3302ec..e46fb529f7d1 100644 --- a/authentik/lib/sync/outgoing/models.py +++ b/authentik/lib/sync/outgoing/models.py @@ -22,9 +22,9 @@ class OutgoingSyncProvider(Model): class Meta: abstract = True - def client_for_model[T: User | Group]( - self, model: type[T] - ) -> BaseOutgoingSyncClient[T, Any, Any, Self]: + def client_for_model[ + T: User | Group + ](self, model: type[T]) -> BaseOutgoingSyncClient[T, Any, Any, Self]: raise NotImplementedError def get_object_qs[T: User | Group](self, type: type[T]) -> QuerySet[T]: diff --git a/website/integrations/services/beszel/index.mdx b/website/integrations/services/beszel/index.mdx index 8d6785bec743..ccc133b906ca 100644 --- a/website/integrations/services/beszel/index.mdx +++ b/website/integrations/services/beszel/index.mdx @@ -54,7 +54,7 @@ Leave the rest as default values. ## Beszel configuration -1. Sign in to Beszel with a browser of your choice and access the system setting by using this URL https://_beszel.company_/_/#/settings. +1. Sign in to Beszel with a browser of your choice and access the system setting by using this URL https://_beszel.company_/\_/#/settings. 2. Disable **Hide collection create and edit controls** and click **Save changes**. @@ -84,9 +84,10 @@ Leave the rest as default values. ## User Creation 1. Manually Creating Users: + - Users are not created automatically when logging in with authentik. The owner must manually create each user in Beszel. - To create users, go to the System Settings where you configured OpenID Connect. - - The URL for user creation is: https://_beszel.company_/_/#/collections?collection=pb_users_auth. + - The URL for user creation is: https://_beszel.company_/\_/#/collections?collection=pb_users_auth. - Click **+ New record** and enter the user's **email** (must match the authentik email address). 2. Automatically Creating Users: From 9d1da7b71fdcd01964d642320d90542d1e131edf Mon Sep 17 00:00:00 2001 From: NiceDevil <17103076+nicedevil007@users.noreply.github.com> Date: Fri, 31 Jan 2025 21:22:05 +0100 Subject: [PATCH 3/4] never changed this? Used these commands after fresh git pull: make lint-fix && npx prettier --write ./website/integrations/services/beszel/index.mdx && make website Signed-off-by: NiceDevil <17103076+nicedevil007@users.noreply.github.com> --- authentik/lib/sync/outgoing/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/authentik/lib/sync/outgoing/models.py b/authentik/lib/sync/outgoing/models.py index e46fb529f7d1..72657c3302ec 100644 --- a/authentik/lib/sync/outgoing/models.py +++ b/authentik/lib/sync/outgoing/models.py @@ -22,9 +22,9 @@ class OutgoingSyncProvider(Model): class Meta: abstract = True - def client_for_model[ - T: User | Group - ](self, model: type[T]) -> BaseOutgoingSyncClient[T, Any, Any, Self]: + def client_for_model[T: User | Group]( + self, model: type[T] + ) -> BaseOutgoingSyncClient[T, Any, Any, Self]: raise NotImplementedError def get_object_qs[T: User | Group](self, type: type[T]) -> QuerySet[T]: From d24553ef0082a71d57f1bc741169897e540f5b25 Mon Sep 17 00:00:00 2001 From: NiceDevil <17103076+nicedevil007@users.noreply.github.com> Date: Sun, 2 Feb 2025 09:14:54 +0100 Subject: [PATCH 4/4] reference to PocketBase As @4d62 suggestet, here is the much simpler version as it uses 1:1 settings from PocketBase --- .../integrations/services/beszel/index.mdx | 57 +++---------------- 1 file changed, 7 insertions(+), 50 deletions(-) diff --git a/website/integrations/services/beszel/index.mdx b/website/integrations/services/beszel/index.mdx index ccc133b906ca..2bd344a37c9d 100644 --- a/website/integrations/services/beszel/index.mdx +++ b/website/integrations/services/beszel/index.mdx @@ -19,66 +19,23 @@ sidebar_label: Beszel ## Preparation -The following placeholders are used in this guide: +Since Beszel uses PocketBase as its backend, you only need to replace the PocketBase placeholders with the placeholders found on this page. +You can find the PocketBase documentation here: https://docs.goauthentik.io/integrations/services/pocketbase/. - `beszel.company` is the FQDN of the Beszel installation. - `authentik.company` is the FQDN of the authentik installation. +- `Beszel` is the Name of the authentik application. +- `beszel` is the Slug of the authentik application. :::note This documentation lists only the settings that you need to change from their default values. Be aware that any changes other than those explicitly mentioned in this guide could cause issues accessing your application. ::: -## authentik configuration - -Start the wizard for adding a new application. - -**1. Application:** - -- Name: `Beszel` -- Slug: `beszel` - -**2. Choose a Provider** - -Select `OAuth2/OpenID Provider` - -**3. Configure Provider** - -Select implicit or explicit authorization flow as desired. - -Take note of the Client ID and Client Secret, you'll need to give them to Beszel later. - -- Redirect URIs/Origins (RegEx): `https://_beszel.company_/api/oauth2-redirect` -- Signing Key: Select any available signing keys. - -Leave the rest as default values. - -## Beszel configuration - -1. Sign in to Beszel with a browser of your choice and access the system setting by using this URL https://_beszel.company_/\_/#/settings. - -2. Disable **Hide collection create and edit controls** and click **Save changes**. - -3. Open the **users** submenu by clicking the **Collections** icon in the left menu or by accessing this URL: https://beszel.company/_/#/collections?collection=pb_users_auth. - -4. Click the gear icon next to **users**, then select the **Options** tab. - -5. Enable **OAuth2** by toggling the corresponding switch. - -6. Click **+ Add provider** and select **OpenID Connect**. - -7. Enter the following details from the authentik provider: - - Set **Client ID** to _client-id_ - - Set **Client secret** to _client-secret_ - - Set **Display name** to **authentik** - - Set **Auth URL** to https://_authentik.company_/application/o/authorize/ - - Set **Token URL** to https://_authentik.company_/application/o/token/ - - Set **User info URL** to https://_authentik.company_/application/o/userinfo/ - ## Test the login -- Open your web browser and go to: https://_beszel.company_. +- Open your web browser and go to: https://beszel.company. - Click **authentik** to log in. -- You should be redirected to authentik (following the login flow you configured). After logging in, authentik will redirect you back to https://_beszel.company_. +- You should be redirected to authentik (following the login flow you configured). After logging in, authentik will redirect you back to https://beszel.company. - If you successfully return to the Beszel WebGUI, the login is working correctly. ## User Creation @@ -87,7 +44,7 @@ Leave the rest as default values. - Users are not created automatically when logging in with authentik. The owner must manually create each user in Beszel. - To create users, go to the System Settings where you configured OpenID Connect. - - The URL for user creation is: https://_beszel.company_/\_/#/collections?collection=pb_users_auth. + - The URL for user creation is: https://beszel.company>/\_/#/collections?collection=pb_users_auth. - Click **+ New record** and enter the user's **email** (must match the authentik email address). 2. Automatically Creating Users: