Commit Graph
675 Commits
Author SHA1 Message Date
Ximon Eighteen 36cd630935 FIX: Incorrect variable used in log message. 2021-03-14 11:01:23 +01:00
Ximon Eighteen 16d578a053 Merge branch 'master' into v0.8.1-bis. 2021-03-09 10:58:06 +01:00
Ximon EighteenandGitHub 0f930f37ef Logout enhancements (closes #385, closes #397, fixes #408, closes #425) (#436)
- Formalize support for different logout strategies and add the fallback strategy.
- Generate the logout URL at logout time in preparation for supporting dynamic logout requests (as needed by token revocation).
- Secure the connection to the mock OpenID Connect provider with a self-signed TLS certificate.
- Allow self-signed certificates for HTTPS connections to localhost (same policy as elsewhere in Krill).
- Upgrade openidconnect-rs to latest v2.0.0 alpha to gain contributed support for OAuth 2.0 Token Revocation. (#385 and #397)
- Use reqwest 0.9.x directly instead of via the openidconnect-rs crate (we cannot use the v0.11.x reqwest that comes with the crate as (a) it doesn't permit self-signed certificates, (b) the blocking implementation was changed to be async which causes problems when inside an existing async runtime, and (c) switching the OpenID Connect client code over to be async is non-trivial - see #428).
- Pass the ID token as `id_token_hint` to the OpenID Connect RP-Initiated Logout 1.0 endpoint. (#408)
- Refined logic for the various logout mechanism permutations. (#425).
- Require OpenID Connection RP-Initiated Logout 1.0 and OAuth 2.0 Token Revocation endpoints to be HTTPS per the specs.
- Passes manual testing with Microsoft Azure Active Directory RP-Initiated Logout support and Google Compute Cloud OAuth 2.0 Token Revocation support.
- Added a Google Cloud Platform example to the comments in the default config file.
- Updated and added tests.
- Fixed logout and token revocation in the mock OpenID Connect provider to actually terminate login sessions.
- Handle a race condition in Lagosta where null user data was accessed that was just deleted due to logout.
- Handle errors from the Krill logout endpoint in Lagosta.
2021-03-08 23:39:45 +01:00
Ximon Eighteen ef1f47cbc2 Compilation fix resulting from PR merge. 2021-03-08 12:28:13 +01:00
Ximon EighteenandGitHub a12f065bf4 Auth related bug fixes and improvements (#432)
* FIX: don't permit users with empty roles to login.
* FIX: incorrect return value stated in JMESPath resub() fn docstring.
* FIX: Don't panic on unwrap() if the JMESPath resub() fn doesn't find a match.
* Show a useful error message if the JMESPath recap() or resub() fns are given an invalid regular expression as input, not an unwrap() with a source file and line number.
* Require a claim value to be non-empty after trimming whitespace in order to be considered a search match. Raise an error (and thus fail the OpenID Connect based login process) if an internal error occurs while doing JMESPath, as we can't trust the claim resolution outcome in that case.
2021-03-08 12:11:24 +01:00
Ximon EighteenandGitHub 47830dbf37 Check the OpenID Connect CSRF token (resolves #383). (#424)
Use a user agent cookie with strict security settings to verify the CSRF token. Adds a test to verify that passing the wrong CSRF state value to Krill correctly results in an error.
2021-03-08 12:09:13 +01:00
Ximon EighteenandGitHub a217f776af Log types passed to oso when trace is enabled (#430)
When trace level logging is enabled, log the types passed to Oso, not just the values.
2021-03-08 12:05:35 +01:00
Ximon EighteenandGitHub 2d0753ea19 Log errors that occur during Krill startup when started from a test. (#429) 2021-03-08 11:28:32 +01:00
Ximon EighteenandGitHub 824cf04f6b FIX: Correctly compare login session cache eviction timestamp to now. (fixes #390) (#399) 2021-02-10 14:26:33 +01:00
Ximon EighteenandGitHub 58c9cb5a4b Use strongly typed permissions in policy rules. (#417)
* Use strongly typed Permission checks instead of unrestricted String based checks.

* FIX: Don't include Permission:: in the message logged at WARN level about a user not having permission, only log the permission name, e.g. CA_CREATE.

* FIX: Also update the team policy demo polar file to use the new Permission type.
2021-02-10 12:29:53 +01:00
Ximon EighteenandGitHub 248807ebc7 Fix master token access restrictions when not using the multi-user feature. (#415)
* Add a test that should (but doesn't in non-multi-user mode) panic because it tries to create a CA using the wrong master token.

* cargo fmt

* Add some comments explaining what the test does and how it works.

* FIX: Don't permit anonymous users to perform restricted actions in non-multi-user mode (this regression was introduced in the v0.8.1-bis branch, it was never released).
2021-02-10 11:21:30 +01:00
Ximon EighteenandGitHub c226bc6d18 Use Rust named enum fields for more readable code. (#413) 2021-02-10 10:57:52 +01:00
Jasper den HertogandGitHub 1cba1dba70 authenticate()/try_refresh_token() rfc-6749 style errors (#396)
Improved handling of OpenID Connect error responses when using a refresh token to obtain new tokens.
2021-02-10 10:42:43 +01:00
Tim Bruijnzeels 19befdaada Check for pre-existing publication server more carefully. 2021-02-05 16:57:23 +01:00
Ximon EighteenandGitHub bbfe9a824a Testbed mode should be more liberal in handling formatting variations in child and publisher registration XML. (#369) (#403)
Testbed mode should be more liberal in handling formatting variations in child and publisher registration XML. Synced with Lagosta commit d94470db. (#369, #403)
2021-01-29 17:11:30 +01:00
Ximon Eighteen cb5a510238 Add a module level RustDoc comment to the OpenID Connect provider. 2021-01-25 10:51:31 +01:00
Ximon EighteenandGitHub c1ca53e13a Don't depend on private internal serde Display trait (fixes #391) 2021-01-19 16:05:05 +01:00
Jasper den Hertog ed6c080760 typo 2021-01-15 16:10:49 +01:00
Tim Bruijnzeels 1d1935e69d Move use statement into fn body with feature - stop confusing my IDE. 2021-01-13 09:59:45 +01:00
Ximon Eighteen 27a613ab01 FIX: 'Login denied for user' incorrectly reported due to use of string request path instead of RequestPath causing Oso policy rule match failure. 2021-01-12 17:12:44 +01:00
Ximon Eighteen 2b6ccd1b44 FIX: Don't bounce a logged user back to the login screen if they authenticate successfully but are denied LOGIN access by the authorisation policy. 2021-01-12 14:49:32 +01:00
Ximon Eighteen 8ef1660a1f Move ActorDef constructors to ActorDef. 2021-01-12 14:48:40 +01:00
Ximon Eighteen 6295cb6a73 FIX: Purge the session decryption cache on a frequency closer to the order of magnitude of session::MAX_CACHCE_SECS. 2021-01-12 13:19:13 +01:00
Ximon Eighteen dd8d2a2cab cargo fmt. 2021-01-12 00:13:01 +01:00
Ximon Eighteen adef1b7ad9 Clippy goodness. 2021-01-12 00:12:02 +01:00
Ximon Eighteen 1d315168bd Additional OpenID Connect provider comments relevant to the changes to support AWS Cognito. 2021-01-12 00:04:12 +01:00
Ximon Eighteen 6ffe5ceb53 FIX: Support OpenID Connect providers that don't advertise support for any of the logout mechanisms that we understand, but which do accept a HTTP redirect to a specified URL, such as AWS Cognito. 2021-01-12 00:02:14 +01:00
Ximon Eighteen 848fd72b8d FIX: Don't require response_modes_supported to be present in the OpenID Connect Discovery response as it is an optional field with the default value that we require. With this fix we can connect to the AWS Cognito OpenID Connect provider. 2021-01-11 23:59:01 +01:00
Ximon Eighteen 87cdf7962f FIX: Pass user attributes to Lagosta, not just the role. Synced with Lagosta master branch commit ac2dab37. 2021-01-09 14:55:06 +01:00
Tim Bruijnzeels 37750bab0d Be more lenient on whitespace in XML, but have better warnings for offending json. (#369) 2021-01-08 14:04:55 +01:00
Ximon Eighteen 1c3f915390 Merge branch 'v0.8.1-bis' of github.com:NLnetLabs/krill into v0.8.1-bis 2021-01-07 13:19:28 +01:00
Ximon Eighteen 60ab21b2be FIX: Ensure at the entrypoint that all API requests are authenticated which is more consistent with the v0.8.2 released code, is simpler (less code in each handler fn) and cannot be forgotten unlike checks in each handler fn. 2021-01-07 13:19:25 +01:00
Tim Bruijnzeels ece0950419 Remove HATEOS links from publisher list (make API consistent #330) 2021-01-07 09:56:26 +01:00
Ximon Eighteen 394e325b7c cargo fmt 2021-01-06 14:27:59 +01:00
Ximon Eighteen db8647b60f FIX: Initial rough implementation: Don't fail Krill startup if the OpenID Connect provider is unavailable. Synced with Lagosta master commit 5f61a5c9. Also includes some minor log / error consistency/cleanup tweaks. 2021-01-06 13:56:39 +01:00
Tim Bruijnzeels a1c8889b56 Remove a CA (CLI and API only) #359 2021-01-05 16:08:23 +01:00
Ximon Eighteen e0be300283 Clippy goodness. 2021-01-05 12:45:20 +01:00
Ximon Eighteen 59cd7bb364 FIX: Show internal auth errors (e.g. OpenID Connect provider invalid response) distinctly from Krill "general" errors (which might imply a problem with Krill itself which is not the case). Synced with Lagosta master commit 259958f. 2021-01-05 12:44:11 +01:00
Ximon Eighteen c436f0d0a7 Remove strange unnecessary & in const ActorDefs and consume ActorDefs to make Actors. 2021-01-05 11:15:39 +01:00
Ximon Eighteen 076fa17655 Rename get_actor_def() to authenticate() which better reflects its purpose. 2021-01-05 11:01:54 +01:00
Ximon Eighteen ddde6b41d8 Add Actor module level intro rustdoc. 2021-01-05 11:01:14 +01:00
Ximon Eighteen 544c3bdde0 FIX: master token fallback fails if the primary provider cannot decode the bearer token, as we don't know if that's an internal / provider error that should be reported to the user, or is because the token is for the master token provider and so doesn't match. Try the master token provider first instead as error handling is easier this way around and failure is fast and provider delays won't slow down auth when using a master token. 2021-01-05 10:59:42 +01:00
Ximon Eighteen 1a6be4d753 FIX: UI tests time out due to slow route analysis of vast TA resources when TA isn't even needed. 2020-12-31 16:33:54 +01:00
Ximon Eighteen dd7d3f41b2 FIX: Avoid stack overflow triggered by addition of new Actor::auth_error field by flattening out chained async API handler invocation. This avoids deep recursive .or_else() macro expansion of calls that pass the large Request value (of which Actor is part) resulting in stack overflow. This fix also removes the need for the boosted recursion_limit compiler setting. 2020-12-31 15:57:02 +01:00
Ximon Eighteen 1b1d7f9a5d More Clippy goodness. 2020-12-30 15:58:32 +01:00
Ximon Eighteen de5fa9f9ce Clippy goodness. 2020-12-30 15:46:08 +01:00
Ximon Eighteen 8bc43d7640 rustfmt on recently modified files. 2020-12-30 15:46:08 +01:00
Ximon Eighteen 54fe369d87 Minor comment & whitespace tweaks. 2020-12-30 15:46:08 +01:00
Ximon Eighteen 1c2ee3d336 Separate actor definitions from actor instances, use Token type for password_hash, move request/response handling into the AuthProviders plus some additional error handling. 2020-12-30 15:46:08 +01:00
Ximon Eighteen 9f3e2c7588 Logging tweaks. 2020-12-30 15:46:08 +01:00