mirror of
https://github.com/healthchecks/healthchecks.git
synced 2026-04-25 06:55:53 +03:00
[GH-ISSUE #185] OpenID Connect support #130
Labels
No labels
bug
bug
bug
feature
good-first-issue
new integration
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/healthchecks#130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nogweii on GitHub (Aug 13, 2018).
Original GitHub issue: https://github.com/healthchecks/healthchecks/issues/185
It would be nice if healthchecks supported OAuth/OpenID Connect or similar for on-premise deployments. That way a user could be redirected to a central IAM platform (AWS's, Active Directory's Federated Services, Keycloak, there a number of similar providers and tools) that they likely are already logged in to.
@nogweii commented on GitHub (Nov 15, 2018):
LDAP support (#198) is fairly similar to this request, though this is more about SSO -- redirecting the user to the authentication server rather than requiring them to type their username and password again.
@hongkongkiwi commented on GitHub (Nov 27, 2018):
We would like to do Google Authentication, we already use this for all our other internal tools and it works really well taking the security burden away from us.
Can this be added? I think this would be invaluable for your amazing tool.
@jameskirsop commented on GitHub (Apr 24, 2019):
Another way of approaching this would be to allow HTTP Headers to authenticate a user - in a similar way to Grafana or Zabbix (among many other tools) do.
Alternatively, I've got
django_auth_adfsworking quite well. I had to manually edit my superuser account to have my UPN as the username, but after that I'm able to sign in and get redirected to my projects with no issue.Adding ADFS support was pretty simple (in the same way that adding plain AD support seemed easy in #198). I just needed to make sure that
LOGIN_URLwas set so it redirected my login requests to ADFS instead of the standardhealthchecks.iologin page.@nogweii commented on GitHub (Apr 25, 2019):
@jameskirsop I would love to see any changes you've made to make ADFS work. Could you share those here, or perhaps as a gist?
@jameskirsop commented on GitHub (Apr 30, 2019):
@evaryont, installed
django_auth_adfsvia pip and then used the following.Added the appropriate config to
INSTALLED_APPS,MIDDLEWAREandAUTHENTICATION_BACKENDS.And used this:
A couple of caveats I've found:
When inviting a user via email address the address is translated to lowercase. For users with capitals in their UPN, and then (in some cases) also in the email address handed back in claims, they're logged in with a new account instead because the two don't match. Eg. JBlogs@domain.com is stored as jblogs@domain.com and ADFS can't find a match, it seems.
If a new user logs in without having an account, the 'username' field is populated with their UPN. While this is expected behaviour with
django_auth_adfs, it breaks functionality with Healthchecks - particularly when you try and invite an existing ADFS-created user to a project/team - and results in a 500 error - I'm expecting because of the first caveat:The way I get around both of these, currently, is manually copying the token created by Healthcheck, deleting the 'invited' account created by Healthcheck (via
./manage.py shell) and pasting the token into the username field in the database. It's a hacky way of doing it, but it seems to work.Not using
LowercaseEmailFieldfor user accounts would be a step towards allowing better ADFS support in my opinion, but I do understand why it's a useful way of storing emails on public services. Alternatively, manually changing the waydjango_auth_adfsmiddleware handles this could be an appropriate option - to have it always translate email address claims to lowercase.@jameskirsop commented on GitHub (May 1, 2019):
A few hours later and I've made some significant progress with working around the above.
I've subclassed the
AdfsBaseBackendandAdfsAuthCodeBackendclasses from django_auth_adfs and made a minor tweak so that it handles getting the appropriate claim back and then translates it to work correctly within the existing HealthChecks framework.I'm going to do some more testing and then put together a PR for a secondary backend that can optionally be used to bridge the divide between HealthCheck and ADFS.
@lukasmrtvy commented on GitHub (Oct 25, 2019):
References:
OIDC: https://django-oauth-toolkit.readthedocs.io/
LDAP: https://django-auth-ldap.readthedocs.io/en/latest/
ADFS: https://django-auth-adfs.readthedocs.io/en/latest/
@nogweii commented on GitHub (Dec 24, 2019):
I have the ultimate hack, adding OpenID Connect support to Healthchecks without modifying any code:
Copy & paste this into
local_settings.pyand it should, roughly, Just Work. Oh, and make sure you runpip install mozilla-django-oidc.@cuu508 I'm sorry for this horrible python but it's pretty clever, eh?
@cuu508 commented on GitHub (Dec 26, 2019):
@evaryont that's quite a hack indeed! 👍
I'm interested in adding "official" OpenID Connect support into the project and the hosted site as well. Picking the default identity providers will be tricky, but starting with Github and Google seems reasonable.
Checking out mozilla-django-oidc library now – looks like it's designed to support a single, preconfigured identity provider, right?
@nogweii commented on GitHub (Jan 2, 2020):
Indeed, looking around there isn't a way to configure it to support multiple providers simultaneously. You might be able to get it working by creating multiple applications, one for each provider, but boy that does sound hacky.
@decentral1se commented on GitHub (Apr 10, 2020):
Is anyone working on this? I'd be most interested in Keycloak integration and I see that there is https://django-keycloak.readthedocs.io/en/latest/. Is anyone against me taking a stab at integrating this just for Keycloak?
@cuu508 commented on GitHub (Apr 14, 2020):
Hi @decentral1se – here's a quick summary of my plans and the current situation.
I'm not familiar with Keycloak (or, to be completely honest, with the other mentioned technologies), would Keycloak work as another OIDC identity provider? If that's the case, we should plan for supporting other OIDC providers in future too.
@lukasmrtvy commented on GitHub (Apr 14, 2020):
Keycloak, https://github.com/dexidp/dex or generic oidc provider connector is always good start, because these will allow to You "federate" from other upstream oidc providers.
@lukasmrtvy commented on GitHub (Jul 14, 2020):
@cuu508 is there any progress ?
@cuu508 commented on GitHub (Jul 14, 2020):
@lukasmrtvy from my side, unfortunately no.
@jameskirsop commented on GitHub (Jul 15, 2020):
Here's a blob of the subclasses I wrote for
django_auth_adfsintegration with Healthchecks. I've been using this in production for about 12 months now with no issue back against initially ADFS, and now AzureAD.I don't know, @cuu508, if you'd like to have this in the project to allow for some support of third party logins for those who are hosting themselves?? It might be a little niche, but it would solve the problem for a number of people who've posted on this issue.
I'm happy to create a PR for this after writing up some documentation, if you'd like to have it included.
@peppelinux commented on GitHub (Jul 17, 2020):
I used djangosaml2 for doing SAML2 authentication, an example in my fork here, see saml2_sp and requirements:
https://github.com/UniversitaDellaCalabria/healthchecks
@Akruidenberg commented on GitHub (Jan 3, 2022):
+1 for this feature!
@peppelinux commented on GitHub (Jan 3, 2022):
I'd suggest also SATOSA as IAM Proxy
See
https://github.com/italia/Satosa-Saml2Spid
@nogweii commented on GitHub (Jan 11, 2022):
With the HTTP header auth merged in, I think the only thing that remains would be an example configuration of something like the following stack:
Documenting that and referring people to it should hopefully provide the foundation for plugging in whatever authentication proxies people would like.
@cuu508 the only I'd like to ask of you is do you have a list of routes that should be excluded from from authentication? I could make some guesses, but it would be nice to be more confident about the choices.
@cuu508 commented on GitHub (Jan 13, 2022):
Hi @nogweii, here'sthe list of routes that I think would make sense to be excluded from authentication:
//accounts/unsubscribe_reports/<str:signed_username>//api/v1/badges//api/v1/channels//api/v1/checks//api/v1/checks/<sha1:unique_key>/api/v1/checks/<sha1:unique_key>/flips//api/v1/checks/<uuid:code>/api/v1/checks/<uuid:code>/flips//api/v1/checks/<uuid:code>/pause/api/v1/checks/<uuid:code>/pings//api/v1/metrics//api/v1/notifications/<uuid:code>/status/api/v1/status//badge/<slug:badge_key>/<slug:signature>.<slug:fmt>/badge/<slug:badge_key>/<slug:signature>/<quoted:tag>.<slug:fmt>/checks/cron_preview//docs//docs/<slug:doc>//docs/cron//integrations/<uuid:code>/unsub/<str:signed_token>//integrations/<uuid:code>/verify/<slug:token>//integrations/add_pushover//integrations/add_slack//integrations/pagerduty//integrations/telegram//integrations/telegram/bot//ping/<slug:ping_key>/<slug:slug>/ping/<slug:ping_key>/<slug:slug>/<int:exitstatus>/ping/<slug:ping_key>/<slug:slug>/fail/ping/<slug:ping_key>/<slug:slug>/start/ping/<uuid:code>/ping/<uuid:code>//ping/<uuid:code>/<int:exitstatus>/ping/<uuid:code>/fail/ping/<uuid:code>/start/projects/<uuid:code>/checks/metrics/<slug:key>/projects/<uuid:code>/metrics/<slug:key>/tv/@axelcypher commented on GitHub (Mar 25, 2022):
Soooo... did anyone managed to get it to work? Right now i'm trying to authenticate via Authentik with Traefik, but i can't get it to work...
@cuu508 commented on GitHub (Dec 16, 2022):
I currently have no plans to add OIDC authentication options. I want to preserve the discussion in the comments, so I'm converting this issue to a discussion rather than closing it.