Headscale

Headscale

This integration guide is community supported. It's not guaranteed to be complete, accurate, or up-to-date. It's likely that if this integration guide does not work for you that changes occurred with a third-party application.

Important Note: This documentation is version specific. Make sure you check the section outlining the tested versions.

Important Note: We always recommend users read the third-party documentation as part of the integration process to ensure configuration elements matches their needs. As such the See Also section is likely to have important links.

Important Note: If you find an error in this documentation please make a Pull Request, start a Discussion, or contact us on a Chat Room.

Tested Versions

Assumptions

This example makes the following assumptions:

  • Application Root URL: https://headscale.example.com/
  • Authelia Root URL: https://auth.example.com/
  • Client ID: headscale
  • Client Secret: insecure_secret

Some of the values presented in this guide can automatically be replaced with documentation variables.

Configuration

Authelia

The following YAML configuration is an example Authelia client configuration for use with Headscale which will operate with the application example:

configuration.yml
identity_providers:
  oidc:
    ## The other portions of the mandatory OpenID Connect 1.0 configuration go here.
    ## See: https://www.authelia.com/c/oidc
    clients:
      - client_id: 'headscale'
        client_name: 'Headscale'
        client_secret: '$pbkdf2-sha512$310000$c8p78n7pUMln0jzvd4aK4Q$JNRBzwAo0ek5qKn50cFzzvE9RXV88h1wJn5KGiHrD0YKtZaR/nCb2CJPOsKaPK0hjf.9yHxzQGZziziccp6Yng'  # The digest of 'insecure_secret'.
        public: false
        authorization_policy: 'two_factor'
        require_pkce: true
        pkce_challenge_method: 'S256'
        redirect_uris:
          - 'https://headscale.example.com/oidc/callback'
        scopes:
          - 'openid'
          - 'email'
          - 'profile'
          - 'groups'
        response_types:
          - 'code'
        grant_types:
          - 'authorization_code'
        access_token_signed_response_alg: 'none'
        userinfo_signed_response_alg: 'none'
        token_endpoint_auth_method: 'client_secret_basic'

Application

To configure Headscale to utilize Authelia as an OpenID Connect 1.0 provider, configure the oidc: section in the config.yaml

config.yaml
oidc:
  only_start_if_oidc_is_available: true
  issuer: 'https://auth.example.com'
  client_id: 'headscale'
  client_secret: 'insecure_secret'
  # client_secret_path: '/path/to/client_secret.txt' # Alternative to client_secret
  scope: ['openid', 'profile', 'email', 'groups']
  pkce:
    enabled: true
    method: 'S256'

See Also