Skip to content

DOCS: Cloudflare Zero Trust OIDC Setup Guide #70

@jason-riddle

Description

@jason-riddle

Follow up from https://discord.com/channels/1379528469859532931/1405948286090743829/1422317884767604837.

Warning

I do not claim to be a security expert nor do I claim to be an expert in configuring OIDC.

Therefore, it is the YOUR responsibility to review each step carefully and verify the security of your own OIDC configuration.

Summary

This is an example of how to configure TSIDP to work with Cloudflare Zero Trust.

Prerequisites

You need to have the following already setup and configured.

Prerequisites for Cloudflare

Prerequisites for Tailscale

Prerequisites for tsidp

  • This needs to be running with funnel enabled.

Steps

TSIDP Steps

  • Go to https://idp.<magicdns>.ts.net

  • Click on "Add New Client"

Image
  • Set the following:
    • Client Name: Cloudflare Zero Trust (Can be anything really..)
    • Redirect URLs: https://<team>.cloudflareaccess.com/cdn-cgi/access/callback
    • Click "Create Client"
Image
  • Copy the "Client ID" and "Client Secret" to save for later use.

We are done with tsidp.

Cloudflare Steps

  • Log in to Zero Trust at https://one.dash.cloudflare.com

  • In the left sidebar, scroll down and click on "Settings".

  • While here, click on "Authentication".

Image
  • Scroll down to "Login methods", click on "Add new".
Image
  • Click on "OpenID Connect".
Image
  • Set the following:

    • Name: Tailscale SSO (Can be anything..)
    • App ID: <Use the "Client ID" value here>
    • Client secret: <Use the "Client Secret" value here>
    • Auth URL: https://idp.<magicdns>.ts.net/authorize
    • Token URL: https://idp.<magicdns>.ts.net/token
    • Certificate URL: https://idp.<magicdns>.ts.net/.well-known/jwks.json
    • Proof Key for Code Exchange (PKCE): Leave off
    • Enable SCIM: Leave off
    • Email claim: email
    • OIDC scopes: openid, email, profile
  • Click "Save".

Image Image Image Image

Now on the authentication settings page, you should see "OpenID Connect • Tailscale SSO". Click on "Test".

Image

If everything was successful, you should see a "Your connection works" page.

Image

Final Steps

We are almost finished, we need to do a couple more things.

  • Go to Access > Policies. Click "Add a policy".
Image
  • Set the following

    • Name: Allow OIDC Claims (Can be anything really..)
    • For Add rules, under "Include", depending on your desired setup, you can choose which emails are allowed. In the example below, anyone that authenticates with the email [email protected] or their email address ends in @example.com, they are allowed in.
  • Scroll down, click "Save".

Image Image
  • Go to Settings > Authentication > App Launcher > click on "Manage".
Image
  • Click on "Select existing policies"
Image
  • Select the policy you just created and click "Confirm".

Dashboard Login

  • Go to https://<team>.cloudflareaccess.com, Click "Login".
Image
  • In my account, I have 2 login methods configured. However, this time I want to sign in with Tailscale, so I click on "ODIC • Tailscale SSO".
Image

The OIDC flow with tsidp will occur, afterwards I'll be on the dashboard page where I can see all of my apps.

Done

That concludes this guide. As a follow-up, for each application you want to allow Tailscale SSO login, you'll need to make sure they are using the "Allow OIDC Claims" policy.

Apps and their policies can be viewed and managed under Access > Applications > Click on app name > Configure > Policies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions