Abhishek Sharma 9e4fffccf6 stages/authenticator_duo: return a descriptive error when the Duo API is unreachable (#24965)
* stages/authenticator_duo: return a descriptive error when the Duo API is unreachable

`_duo_import_devices` caught only `RuntimeError`, but `duo_client` surfaces
transport failures as the underlying socket/TLS error. `SSLCertVerificationError`
is an `OSError`, not a `RuntimeError`, so a Duo endpoint behind an untrusted
certificate escaped the handler entirely and the request finished as a bare 405
with no actionable error.

`OSError` is also in `authentik.lib.sentry.ignored_classes`, so the exception was
dropped from error reporting too, leaving nothing to diagnose from.

Catch the transport failures explicitly and map them to the documented 400 with a
descriptive message, ordered narrowest-first since
SSLCertVerificationError < SSLError < OSError:

- certificate verification failure -> "TLS certificate verification failed."
- any other TLS failure            -> "TLS error."
- any other connection failure     -> "Failed to connect to Duo."

The messages stay categorical and do not echo exception text, keeping the
existing behaviour of not leaking internals to the API caller.

closes #22896

* translate

Signed-off-by: Jens Langhammer <jens@goauthentik.io>

---------

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
Co-authored-by: Jens Langhammer <jens@goauthentik.io>
2026-08-25 12:54:04 +01:00
2026-04-27 01:08:32 +02:00
2026-03-31 11:33:46 +02:00
2026-07-29 15:12:35 +01:00
2026-08-03 19:48:58 +00:00
2026-06-24 19:50:08 +02:00
2025-09-02 21:38:53 +00:00
2023-04-19 16:13:45 +02:00
2026-04-27 01:08:32 +02:00

authentik logo


Join Discord GitHub Workflow Status GitHub Workflow Status GitHub Workflow Status Code Coverage Latest version

What is authentik?

authentik is an open-source Identity Provider (IdP) for modern SSO. It supports SAML, OAuth2/OIDC, LDAP, RADIUS, and more, designed for self-hosting from small labs to large production clusters.

Our enterprise offering is available for organizations to securely replace existing IdPs such as Okta, Auth0, Entra ID, and Ping Identity for robust, large-scale identity management.

Installation

  • Docker Compose: recommended for small/test setups. See the documentation.
  • Kubernetes (Helm Chart): recommended for larger setups. See the documentation and the Helm chart repository.
  • AWS CloudFormation: deploy on AWS using our official templates. See the documentation.
  • DigitalOcean Marketplace: one-click deployment via the official Marketplace app. See the app listing.

Screenshots

Light Dark

Development and contributions

See the Developer Documentation for information about setting up local build environments, testing your contributions, and our contribution process.

When you contribute documentation, either to accompany a code change or as a standalone contribution, please be sure to follow our documentation Style Guide.

Security

Please see SECURITY.md.

Adoption

Using authentik? We'd love to hear your story and feature your logo. Email us at hello@goauthentik.io or open a GitHub Issue/PR!

License

MIT License CC BY-SA 4.0 authentik EE License

Languages
Python 55.4%
TypeScript 34%
Rust 3.5%
JavaScript 2.6%
CSS 2.3%
Other 2.1%