diff --git a/development/ref/oidc/index.html b/development/ref/oidc/index.html index 0be7d3b7..45b574eb 100644 --- a/development/ref/oidc/index.html +++ b/development/ref/oidc/index.html @@ -44,6 +44,21 @@ client_secret: "generated-secret" use_expiry_from_token: true
Expire a node and force re-authentication
A node can be expired immediately via:
You may refer to users in the Headscale policy via:
A user identifier in the policy must contain a single @
The Headscale policy requires a single @ to reference a user. If the username or provider identifier doesn't already contain a single @, it needs to be appended at the end. For example: the username ssmith has to be written as ssmith@ to be correctly identified as user within the policy.
Email address or username might be updated by users
Many identity providers allow users to update their own profile. Depending on the identity provider and its configuration, the values for username or email address might change over time. This might have unexpected consequences for Headscale where a policy might no longer work or a user might obtain more access by hijacking an existing username or email address.
Headscale uses the standard OIDC claims to populate and update its local user profile on each login. OIDC claims are read from the ID Token and from the UserInfo endpoint.
| Headscale profile | OIDC claim | Notes / examples |
|---|---|---|
| email address | email | Only verified emails are synchronized, unless email_verified_required: false is configured |
| display name | name | eg: Sam Smith |
| username | preferred_username | Depends on identity provider, eg: ssmith, ssmith@idp.example.com, \\example.com\ssmith |
| profile picture | picture | URL to a profile picture or avatar |
| provider identifier | iss, sub | A stable and unique identifier for a user, typically a combination of iss and sub OIDC claims |
groups | Only used to filter for allowed groups |
@.Please see the GitHub label "OIDC" for OIDC related issues.
Third-party software and services
This section of the documentation is specific for third-party software and services. We recommend users read the third-party documentation on how to configure and integrate an OIDC client. Please see the Configuration section for a description of Headscale's OIDC related configuration settings.
Any identity provider with OpenID Connect support should "just work" with Headscale. The following identity providers are known to work:
Authelia is fully supported by Headscale.
Encryption Key in the providers section unset.No username due to missing preferred_username
Google OAuth does not send the preferred_username claim when the scope profile is requested. The username in Headscale will be blank/not set.
In order to integrate Headscale with Google, you'll need to have a Google Cloud Console account.
Google OAuth has a verification process if you need to have users authenticate who are outside of your domain. If you only need to authenticate users from your domain name (ie @example.com), you don't need to go through the verification process.
However if you don't have a domain, or need to add users outside of your domain, you can manually add emails via Google Console.
APIs and services -> CredentialsCreate Credentials -> OAuth client IDApplication Type, choose Web ApplicationName, enter whatever you likeAuthorised redirect URIs, add Headscale's OIDC callback URL: https://headscale.example.com/oidc/callbackSave at the bottom of the formClient ID and Client secret, you can also download it for reference if you need it.https://accounts.google.com.headscale_users@sso.example.com.Keycloak is fully supported by Headscale.
Keycloak has no built-in client scope for the OIDC groups claim. This extra configuration step is only needed if you need to authorize access based on group membership.
groups for OpenID Connect:Group Membership mapper with name groups and the token claim name groups.group.Default.Full group path option:Full group path is enabled: groups contain their full path, e.g. /top/group1Full group path is disabled: only the name of the group is used, e.g. group1In order to integrate Headscale with Microsoft Entra ID, you'll need to provision an App Registration with the correct scopes and redirect URI.
Configure Headscale following the "Basic configuration" steps. The issuer URL for Microsoft Entra ID is: https://login.microsoftonline.com/<tenant-UUID>/v2.0. The following extra_params might be useful:
domain_hint: example.com to use your own domainprompt: select_account to force an account picker during loginWhen using Microsoft Entra ID together with the allowed groups filter, configure the Headscale OIDC scope without the groups claim, for example:
You may refer to users in the Headscale policy via:
A user identifier in the policy must contain a single @
The Headscale policy requires a single @ to reference a user. If the username or provider identifier doesn't already contain a single @, it needs to be appended at the end. For example: the username ssmith has to be written as ssmith@ to be correctly identified as user within the policy.
Email address or username might be updated by users
Many identity providers allow users to update their own profile. Depending on the identity provider and its configuration, the values for username or email address might change over time. This might have unexpected consequences for Headscale where a policy might no longer work or a user might obtain more access by hijacking an existing username or email address.
Howto use the provider identifier in the policy
The provider identifier uniquely identifies an OIDC user and a well-behaving identity provider guarantees that this value never changes for a particular user. It is usually an opaque and long string and its value is currently only available from the API, database or directly from your identity provider).
Use the API with the /api/v1/user endpoint to fetch the provider identifier (providerId). The value (be sure to append an @ in case the provider identifier doesn't already contain an @ somewhere) can be used directly to reference a user in the policy. To improve readability of the policy, one may use the groups section as an alias:
Headscale uses the standard OIDC claims to populate and update its local user profile on each login. OIDC claims are read from the ID Token and from the UserInfo endpoint.
| Headscale profile | OIDC claim | Notes / examples |
|---|---|---|
| email address | email | Only verified emails are synchronized, unless email_verified_required: false is configured |
| display name | name | eg: Sam Smith |
| username | preferred_username | Depends on identity provider, eg: ssmith, ssmith@idp.example.com, \\example.com\ssmith |
| profile picture | picture | URL to a profile picture or avatar |
| provider identifier | iss, sub | A stable and unique identifier for a user, typically a combination of iss and sub OIDC claims |
groups | Only used to filter for allowed groups |
@.Please see the GitHub label "OIDC" for OIDC related issues.
Third-party software and services
This section of the documentation is specific for third-party software and services. We recommend users read the third-party documentation on how to configure and integrate an OIDC client. Please see the Configuration section for a description of Headscale's OIDC related configuration settings.
Any identity provider with OpenID Connect support should "just work" with Headscale. The following identity providers are known to work:
Authelia is fully supported by Headscale.
Encryption Key in the providers section unset.No username due to missing preferred_username
Google OAuth does not send the preferred_username claim when the scope profile is requested. The username in Headscale will be blank/not set.
In order to integrate Headscale with Google, you'll need to have a Google Cloud Console account.
Google OAuth has a verification process if you need to have users authenticate who are outside of your domain. If you only need to authenticate users from your domain name (ie @example.com), you don't need to go through the verification process.
However if you don't have a domain, or need to add users outside of your domain, you can manually add emails via Google Console.
APIs and services -> CredentialsCreate Credentials -> OAuth client IDApplication Type, choose Web ApplicationName, enter whatever you likeAuthorised redirect URIs, add Headscale's OIDC callback URL: https://headscale.example.com/oidc/callbackSave at the bottom of the formClient ID and Client secret, you can also download it for reference if you need it.https://accounts.google.com.headscale_users@sso.example.com.alice@sso.example.com) as preferred_username by default. Headscale stores this value as username which might be confusing as the username and email fields now contain values that look like an email address. Kanidm can be configured to send the short username as preferred_username attribute instead: Once configured, the short username in Headscale will be alice and can be referred to as alice@ in the policy.Keycloak is fully supported by Headscale.
Keycloak has no built-in client scope for the OIDC groups claim. This extra configuration step is only needed if you need to authorize access based on group membership.
groups for OpenID Connect:Group Membership mapper with name groups and the token claim name groups.group.Default.Full group path option:Full group path is enabled: groups contain their full path, e.g. /top/group1Full group path is disabled: only the name of the group is used, e.g. group1In order to integrate Headscale with Microsoft Entra ID, you'll need to provision an App Registration with the correct scopes and redirect URI.
Configure Headscale following the "Basic configuration" steps. The issuer URL for Microsoft Entra ID is: https://login.microsoftonline.com/<tenant-UUID>/v2.0. The following extra_params might be useful:
domain_hint: example.com to use your own domainprompt: select_account to force an account picker during loginWhen using Microsoft Entra ID together with the allowed groups filter, configure the Headscale OIDC scope without the groups claim, for example:
Groups for the allowed groups filter need to be specified with their group ID(UUID) instead of the group name.