-
-
Notifications
You must be signed in to change notification settings - Fork 2k
website/integrations: add wg-easy #25544
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
Open
dominic-r
wants to merge
1
commit into
main
Choose a base branch
from
dominic/wg-integr
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.
+100
−0
Open
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
This file contains hidden or 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,100 @@ | ||
| --- | ||
| title: Integrate with wg-easy | ||
| sidebar_label: wg-easy | ||
| support_level: community | ||
| --- | ||
|
|
||
| import RedirectURI20265Note from "../../_redirect-uri-2026-5-note.mdx"; | ||
|
|
||
| ## What is wg-easy? | ||
|
|
||
| > wg-easy is a self-hosted web UI for the WireGuard VPN. It manages the WireGuard server and its clients from the browser, including client creation, QR codes for mobile setup, and connection statistics. | ||
| > | ||
| > -- https://wg-easy.github.io/wg-easy/ | ||
|
|
||
| ## Preparation | ||
|
|
||
| The following placeholders are used in this guide: | ||
|
|
||
| - `wg-easy.company` is the FQDN of the wg-easy installation. | ||
| - `authentik.company` is the FQDN of the authentik installation. | ||
|
|
||
| :::info | ||
| 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. | ||
| ::: | ||
|
|
||
| :::info wg-easy version | ||
| External authentication via OIDC is supported in wg-easy version 15.4 and later. | ||
| ::: | ||
|
|
||
| ## authentik configuration | ||
|
|
||
| To support the integration of wg-easy with authentik, you need to create an application/provider pair in authentik. | ||
|
|
||
| ### Create a custom scope mapping | ||
|
|
||
| wg-easy only accepts logins where the email scope returns `email_verified: True`. Because the default authentik email scope mapping returns `email_verified: False`, create a custom scope mapping for wg-easy. | ||
|
|
||
| 1. Log in to authentik as an administrator and open the authentik Admin interface. | ||
| 2. Navigate to **Customization** > **Property Mappings** and click **Create**. | ||
| - **Select type**: select **Scope Mapping**. | ||
| - **Configure the Scope Mapping**: provide a descriptive name (e.g. `wg-easy Email Scope`), and an optional description. | ||
| - **Scope name**: `email` | ||
| - **Expression**: | ||
|
|
||
| ```python showLineNumbers | ||
| return { | ||
| "email": request.user.email, | ||
| "email_verified": True | ||
| } | ||
| ``` | ||
|
|
||
| 3. Click **Finish** to save the property mapping. | ||
|
|
||
| ### Create an application and provider | ||
|
|
||
| <RedirectURI20265Note /> | ||
|
|
||
| 1. Navigate to **Applications** > **Applications** and click **New Application** to open the application wizard. | ||
| - **Application**: provide a descriptive name, an optional group for the type of application, the policy engine mode, and optional UI settings. Note the **Slug** value because it is required later. | ||
| - **Choose a Provider type**: select **OAuth2/OpenID Connect** as the provider type. | ||
| - **Configure the Provider**: provide a name (or accept the auto-provided name), the authorization flow to use for this provider, and the following required configurations. | ||
| - Note the **Client ID** and **Client Secret** values because they are required later. | ||
| - Add two **Redirect URI** entries of type `Strict` `Authorization`: `https://wg-easy.company/api/auth/oidc/callback` and `https://wg-easy.company/api/auth/oidc/link`. The second URI is used when linking an existing wg-easy account to authentik. | ||
| - Select any available signing key. | ||
| - Under **Advanced protocol settings**, remove the `authentik default OAuth Mapping: OpenID 'email'` scope from **Selected Scopes** and add the custom scope mapping that you created in the previous section. | ||
| - **Configure Bindings** _(optional)_: you can create a [binding](/docs/add-secure-apps/bindings-overview/) (policy, group, or user) to manage the listing and access to applications on a user's **Application Dashboard** page. | ||
|
|
||
| 2. Click **Submit** to save the new application and provider. | ||
|
|
||
| ## wg-easy configuration | ||
|
|
||
| wg-easy uses environment variables to configure external authentication. Add the following variables to the environment file for the wg-easy container, then restart the container: | ||
|
|
||
| ```env title=".env" | ||
| OAUTH_PROVIDERS=oidc | ||
| OAUTH_OIDC_NAME=authentik | ||
| OAUTH_OIDC_SERVER=https://authentik.company/application/o/<application_slug>/ | ||
| OAUTH_OIDC_CLIENT_ID=<Client ID from authentik> | ||
| OAUTH_OIDC_CLIENT_SECRET=<Client Secret from authentik> | ||
| OAUTH_AUTO_REGISTER=true | ||
| ``` | ||
|
|
||
| :::warning Auto-registered users | ||
| wg-easy creates auto-registered users with administrator permissions because its permissions system is not yet implemented. Every authentik user who is allowed to access the application can manage the WireGuard server. Set `OAUTH_AUTO_REGISTER=false` to only allow existing wg-easy users to log in after linking their authentik account. | ||
| ::: | ||
|
|
||
| To make authentik the only login method for wg-easy, you can add the following variables: | ||
|
|
||
| ```env title=".env" | ||
| DISABLE_PASSWORD_AUTH=true | ||
| OAUTH_AUTO_LAUNCH=oidc | ||
| ``` | ||
|
|
||
| ## Configuration verification | ||
|
|
||
| To confirm that authentik is properly configured with wg-easy, log out of wg-easy and click **Sign in with authentik** on the login page. You should be redirected to authentik, then returned to wg-easy after a successful login. | ||
|
|
||
| ## Resources | ||
|
|
||
| - [wg-easy documentation - External Authentication](https://wg-easy.github.io/wg-easy/latest/advanced/config/external-authentication/) | ||
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.
Maybe add a link to the documentation about email verified