self-hosted icon indicating copy to clipboard operation
self-hosted copied to clipboard

SSO with multiple domains

Open bert2002 opened this issue 5 years ago • 21 comments

Important Details

How are you running Sentry?

[ x] On-Premise docker [Version 10.0.0.dev0]

Description

I want to configure Google Auth with multiple domains whitelisted. At the moment only the default domain is allowed to configure, but I need a second one (not sure where it gets the first one though, configured external dns?)

Steps to Reproduce

  1. configure sentry/sentry.conf.py
SENTRY_OPTIONS['auth-google.client-id'] = 'ID'
SENTRY_OPTIONS['auth-google.client-secret'] = 'SECRET'
SENTRY_OPTIONS['auth-google.domains'] = [ 'domain1.org', 'domain2.org']
  1. rebuild & rerun
docker-compose build
docker-compose run --rm web upgrade
docker-compose up -d

What you expected to happen

I expected to be able to login with SSO from both domains.

Is that the right approach?

Many thanks, bert

bert2002 avatar Dec 16 '19 06:12 bert2002

Any updates? Is there any official documentation available on how to add multi-domains to SSO auth in on-premise installations?

Edit: added detail about on-prem

webknows avatar May 14 '20 21:05 webknows

Hi is there any updates on this? Many developers at the firm are not able to log in because of this. Hope assistance can be provided. Thanks

RuChiang avatar May 21 '20 02:05 RuChiang

Currently nobody is working on this. If anyone is willing to take a stab, I'd be happy to assist them.

/cc @EvanPurkhiser

BYK avatar May 22 '20 12:05 BYK

Hi! Could you share the status of this ticket?

As I understand multiple domains supported by google provider https://github.com/getsentry/sentry-auth-google/pull/13

azhurbilo avatar Dec 08 '20 15:12 azhurbilo

@azhurbilo this issue is "oh hold" which means we'd like to get this done some time but it is not a priority. And pull requests are welcome if anyone wants to take a stab at it.

Turns out this code is the one that is being used for Google Auth so I'll dig if this is just exposing the functionality via settings. Thanks for bringing it up.

BYK avatar Dec 08 '20 16:12 BYK

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Accepted, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Jan 06 '21 18:01 github-actions[bot]

@dcramer Following up on https://github.com/getsentry/sentry-auth-google/pull/13/files How does one configure domain or domains in sentry?

jawabuu avatar Apr 25 '21 02:04 jawabuu

@jawabuu this issue was closed due to staleness so I don't think this is possible yet. @leedongwei, is this something you'd consider as part of the current auth work?

BYK avatar Apr 26 '21 09:04 BYK

@BYK understood. Just wanted to confirm this. Considering you already have DOMAIN_BLOCKLIST it should be easy in my opinion to have something like DOMAIN_ALLOWLIST I have implemented this approach in sentry-auth/oidc at https://github.com/jawabuu/sentry-auth-oidc/commit/a3c4586446d2f80e4a7d8e7474845c720b85cb78 Reason for using the plugin is I'm using Gitlab as the auth provider.

jawabuu avatar Apr 26 '21 09:04 jawabuu

I dont think we exposed a way to configure it via the CLI, but you can update the database row to store domains vs domain

dcramer avatar Apr 26 '21 15:04 dcramer

@dcramer Does this solve the issue of passing the domain or domains to be checked against when logging in? How would one set this in for example sentry.conf.py

jawabuu avatar Apr 26 '21 16:04 jawabuu

You cannot configure these kinds of things via the python config. They're all at the database level and configured per-organization (which in self-hosted is usually a single org).

dcramer avatar Apr 26 '21 16:04 dcramer

@dcramer Noted. If I understand correctly, is the domain is populated from the org created in sentry? Is it a requirement then that the org name be a domain?

jawabuu avatar Apr 26 '21 16:04 jawabuu

No - the domain is not at all related to the name of the org. When you attach an SSO account it is linked to your Google domain. We then retain that coupling. If you wish to support multiple Google-backed domains the only way currently is to change the config value in the db row to go from domain => sentry.io to domains => ['sentry.io', 'getsentry.com']

dcramer avatar Apr 26 '21 16:04 dcramer

@dcramer Thanks for clarifying. This is very helpful. I'm guessing this happens when one is configuring SSO on the auth tab?

jawabuu avatar Apr 26 '21 16:04 jawabuu

Has this feature died or was it already implemented? Adding auth-google.domains doesn't work. Neither does OIDC_DOMAIN_ALLOWLIST into the ENV.

lahdekorpi avatar Oct 17 '23 07:10 lahdekorpi

Hey @lahdekorpi you will need to install a fork to make use of the functionality

jawabuu avatar Oct 17 '23 09:10 jawabuu

@jawabuu Were you able to get this working? If so, do you mind sharing what your workflow is?

hubertdeng123 avatar Oct 18 '23 21:10 hubertdeng123

Hey @hubertdeng123

This is(was) my dockerfile

FROM getsentry/sentry:21.8.0
RUN python -m pip install https://github.com/jawabuu/sentry-auth-oidc/archive/d2d1b5461e79444208a3faee7ac365bf2c6d76f3.tar.gz

jawabuu avatar Oct 18 '23 22:10 jawabuu

It looks like this can be only changed from the database now.

docker exec -u postgres -it sentry-self-hosted-postgres-1 psql
postgres=# select * from sentry_authprovider;
 id | provider |                  config                  |          date_added           | sync_time | last_sync | default_role | default_global_access | flags | organization_id
----+----------+------------------------------------------+-------------------------------+-----------+-----------+--------------+-----------------------+-------+-----------------
  1 | google   | {"domains":["example.com"],"version":"1"} | 2024-03-13 15:11:45.266913+00 |           |           |           50 | t                     |     0 |               1
(1 row)
postgres=# update sentry_authprovider set config = '{"domains":["example.com", "example.net"],"version":"1"}' where id =1;
UPDATE 1

avelinesg avatar Mar 13 '24 17:03 avelinesg

Transferring to self-hosted, but not prioritizing this

hubertdeng123 avatar Mar 14 '24 23:03 hubertdeng123