Commit Graph
126 Commits
Author SHA1 Message Date
Tim BruijnzeelsandGitHub 1cc69885db Use more descriptive errors from rpki-rs #845 2022-07-18 19:24:43 +02:00
Tim BruijnzeelsandGitHub bbb2267587 Migrate RPKI objects in history (#841)
Ensures that Krill is more robust with regards to stricter validation of RPKI object types in future.
2022-07-18 15:51:26 +02:00
Tim BruijnzeelsandGitHub d68c07b59c Sign BGP router certificates (#827) 2022-07-07 13:20:00 +02:00
330da84de5 Migrate 8181 8183 6942 support to rpki rs (#820)
* Use types which were ported into rpki-rs.
* Update dependency to rpki-rs 0.14.3-dev.
* IGNORE old_events test for now, see issue: #819
* Quick fix for compilation using --all-features. See issue #821

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2022-05-12 15:24:50 +02:00
Tim Bruijnzeels 12c4a1fc9a Merge release 0.9.5 into dev 2022-04-13 16:58:52 +02:00
388b931645 V0.9.5 rc9 prep (#812)
* Improve efficiency of connection status tracking #811
* Update version and readme for 0.9.5-rc9

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2022-04-06 15:11:55 +02:00
Tim Bruijnzeels 4e1df9294a Merge 0.9.5-rc8 (main) into dev 2022-03-30 14:05:02 +02:00
ffb7d6ecdd V0.9.5 rc7 prep (#803)
* Use PriorityQueue with time based Priority.
* Improve session sweep logging (make it less noisy)
* Update config file with new refresh settings - cap jitter at 50% of refresh
* Let api schedule repo sync tasks rather than execute it synchronously.
* Update version and readme for RC7
* Use the highest priority in case a task was already in the queue.
* Use consistent capitalization of Krill in config files.
* Update readme regarding ca-parent sync changes
* Update to Lagosta with updated dependencies
* Update developer documentation with new scheduler behaviour.
* Add hidden api end-point for scheduling suspend all - used in testing.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2022-03-28 16:01:51 +02:00
Tim Bruijnzeels 92ea597f01 Make CA sync strategy configurable #799 2022-03-06 23:28:16 +01:00
Tim Bruijnzeels ee81d03db7 Improve migration preparation resilience. 2022-02-23 14:17:18 +01:00
Tim BruijnzeelsandXimon Eighteen 5780c771f6 Support prepare-upgrade krill: prepares the new data to migrate. (#777)
* Support "prepare-upgrade" through "krillup" binary.
* Package the new `krillup` binary and man page into a separate DEB/RPM.
* Also switches to building in a Rocky Linux container due to repeated CentOS 8 vault repo timeouts.
* Mention correct config file location on CLI help.
* Remove incorrect reference to non-existent help subcommand for krillup.
* Add locking to upgrade process.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2022-02-18 18:02:55 +01:00
Tim Bruijnzeels aff4407144 Improve usability of http errors to operators. (#782) 2022-02-18 18:02:55 +01:00
Ximon EighteenandGitHub b0be88bc10 HSM support for keys (#21) (#733)
Adds support for PKCS#11 v2.20 and/or KMIP 1.2 compatible HSMs.
Includes backward compatible extensions to the krill.conf syntax.
Includes HSM related developer docs.
Excludes HSM specific API (REST, krillc, Prometheus) or UI extensions.
2022-01-14 14:19:24 +01:00
Tim Bruijnzeels 18ee87f6e0 Allow configuring RFC6492/8181 client timeouts #743 2021-12-16 10:30:10 +01:00
Tim BruijnzeelsandGitHub ee1f513f8c Allow configuring RFC6492/8181 client timeouts #743 2021-12-16 09:49:14 +01:00
Tim Bruijnzeels 3b94ff2fa6 Proof of concept ASPA support (#685) 2021-11-05 15:59:17 +01:00
61e7fc01e4 Add random jitter to ca publish next update times (#692)
Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2021-10-20 10:34:27 +02:00
Tim BruijnzeelsandGitHub 30772b6f36 Suspend krill 092 higher only (#670) (PR #672) 2021-09-23 15:57:05 +02:00
Tim Bruijnzeels 72df8caac4 Fix typo. 2021-09-13 13:32:22 +02:00
Tim Bruijnzeels 3cc9547e1e Hide ca-child metrics if there are no CAs with children. 2021-09-13 13:32:22 +02:00
Tim Bruijnzeels 4eae590e99 Keep child state (active/pending) in status and show in CLI and metrics. (#656) 2021-09-13 13:32:22 +02:00
Tim Bruijnzeels 5d5728dc68 Improve help text in default config. 2021-09-13 13:32:22 +02:00
Tim Bruijnzeels 80a7885382 Document metrics and disabling them in default config file. (#654) 2021-09-13 13:32:22 +02:00
Tim Bruijnzeels 5c90624ffd Restrict ca_refresh_seconds to 10-60 minutes. 2021-08-30 10:47:28 +02:00
Tim Bruijnzeels 4c554fb78f Change ca_refresh in config to ca_refresh_seconds to be explicit. 2021-08-30 10:47:28 +02:00
Tim Bruijnzeels eb420f9d02 Clarify suspend directive in example config file. (#623) 2021-08-30 10:47:28 +02:00
Tim Bruijnzeels 4dc54f3a8c Automatically suspend inactive child CAs *if* configured to do so. (#623) 2021-08-30 10:47:28 +02:00
6b9d437d11 Add rsync uri to (new) TALs in testbed setup. (#624) (#633)
Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2021-08-17 10:43:38 +02:00
Tim BruijnzeelsandGitHub 25fa398ec7 Mark roas lost resources (#602) 2021-08-04 12:51:49 +02:00
Ximon EighteenandGitHub 47d23f87a7 Permit disabling automatic sending of prompt=login to the OIDC provider (#616)
Adds a new `prompt_for_login` configuration file setting in the `[auth_openidconnect`]` block (defaults to true for backward compatibility) which can be used to avoid advising the OpenID Connect provider to prompt for login details even if the user has a valid provider login session. Resolves #614.
2021-08-03 11:20:38 +02:00
Ximon Eighteen f39e8499d1 Set bgp_risdumps_enabled = false in UI integration tests as we don't test this part of the UI and it causes Krill to do more work on already slow GH Actions runner VMs, and tests seem to be locking up with the last message being "Updated announcements based on BGP Ris Dumps". 2021-07-30 21:58:00 +02:00
Tim Bruijnzeels 90d8a59524 Merge 0.9.1-rc1 release into 'dev'. 2021-07-16 15:03:54 +02:00
Tim Bruijnzeels 5bb32aa9b3 Fix config tests after changing text in template. 2021-07-14 10:13:15 +02:00
Tim BruijnzeelsandGitHub d85dca7b98 Make 'service_uri' default pick up ip and port 2021-07-13 16:06:49 +02:00
Tim BruijnzeelsandGitHub 51c58ec58b Use next update time as mft EE expiry time (#589) 2021-07-13 15:52:00 +02:00
Tim Bruijnzeels fb31fc39e4 Improve comment in krill.conf and fix related tests. 2021-06-23 14:50:24 +02:00
Tim Bruijnzeels 0ba522446a Use more descriptive KrillIoError where feasible (#495) 2021-05-12 11:26:23 +02:00
Tim BruijnzeelsandGitHub 17b928b7cc Use more descriptive KrillIoError where feasible (#495) 2021-05-04 13:53:03 +02:00
Ximon EighteenandGitHub 13b6f7d1f3 Security tweaks (#382) (#484)
* Encrypt session state using ChaCha20-Poly1305 instead of AES-GCM.
* Replace config file users login use of insecure unsalted SHA2 password hashing with secure scrypt salted password hashing.
* Log the start of the request before determining the actor.
* Allow sufficient time for password hashing delays during login with config file user based tests..
* Synced with Lagosta commit b49f23de.
2021-04-20 00:47:22 +02:00
Tim BruijnzeelsandGitHub b43a6815cf Inconsistent and unacceptable token references (#433) (#483) 2021-04-19 22:23:02 +02:00
Tim BruijnzeelsandGitHub 3b139e4a9f Clippy and spelling fixes (#471)
* Fix clippy warnings.
* Fix spelling - as agreed use american spelling in code (like RFCs do as well).
2021-04-15 14:42:32 +02:00
8a36517126 Error handling fixes and improvements (#464)
Fixes:
* Just use the token we have if we would ideally refresh before expiration but don't have a refresh token.
* Don't hide useful OpenID Connect error details (such as self-signed cert rejected instead of just request failed). (fixes #427)
* Lagosta fixes from branch issue-379-handle-connection-issues commit 58f5ccc7 (relates to #442).

Functional improvements:
* Return or log less in some error scenarios (#419).
* Upgrade to Oso 0.11.2 to get a MUCH better error report when a ?= query in a .polar file fails, plus the Mutex around Oso is no longer needed.
* Log when OIDC discovery completes successfully.
* Be cautious, just log connection issues to the OpenID Connect provider for now, don't retry discovery.
* Use a lower timeout for the OpenID Connect HTTP client than the normal Krill HTTP client.
* Log more cause chains where available.

Code quality improvements:
* Apply review feddback: unwrap locks and crash out via panic to be consistent with the rest of Krill.
* Factor out the repeated RAII guard handling.
* Split login() out into helper methods.
* Removed TODO comment.

Testing improvements:
* Removed left-behind debug screenshot.
* Add a test to show a bug whereby access is wrongly denied if a token is pending expiration and has no refresh token. 
* Add a test to make sure Krill handles timeout of requests to the OIDC provider correctly. Also adds support for a lower timeout in test mode ala how it's done elsewhere in Krill, and more faithfully replicates the normal Krill HTTP client configuration when configuring the OIDC HTTP client. Also factored the OIDC HTTP client code out as it is getting too large to live in provider.rs.
* Extend the OpenID Connect provider not available test to show that Krill copes with the provider being unavailable and coming back to life again.
* Re-worked the test/mock relationship so that the mock no longer has hard-coded users and username based behaviour activation but rather now the test sets the desired behaviour and is thus easier to understand and more flexible.
* Extended the OpenID Connect mock so that its endpoints can be disabled and enabled during tests, and be disabled before Krill even does initial discovery.
* Use example.com based bad ACR ID token.
* Remove support for the NoResponse mock failure mode as it blocks the tiny http server thread indefinitely also preventing a test using it from exiting, and adds little no perceived benefit over the SlowResponse failure mode (which does at least stop blocking within the expected test run time).
* The mock OpenID Connect provider must be shutdown before the UI test result is asserted, otherwise the test process never terminates.
* Use the expected OpenID Connect provider timeout when in test mode.
* Extend the openid connect test to test the 'hybrid' user attributes case.
* Give the login more time to complete before expiring the access token. (#466).
* Wait for the right backend status BEFORE clicking the ROAs tab. (#465)

Other:
* OpenID Connect log message consistency tweaks.
* Sync with updated correspoinding Lagosta branch commit d2a92fe1 with latest Lagosta master merged in and a yarn build empty catch block fix.
* Sync with commit b9a2f5b3 in the corresponding PR branch in Lagosta to get a testbed REST API client fix.

Co-authored-by: Tim Bruijnzeels <tim@nlnetlabs.nl>
2021-04-13 12:13:18 +02:00
a715c82f7f Remove embedded repo/ca choices (#461)
* Remove embedded repository contact option, migrate commands and events.
* Migrate old CA init events. Test upgrade from 0.6.0.
* Migrate embedded in CA history.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2021-04-01 17:18:28 +02:00
Ximon EighteenandGitHub f3e8023be5 Support fine grained access per CA (resolves #437) (#443)
- Various changes to support a grey policy in between black and white approach of permitting or denying access to CAs entirely, whereby a user can have a different role in one CA than in another.
- Introduces the NoResourceType for requests not relating to a specific "resource", e.g. CA, such as LOGIN. NoResourceType maps to `nil` in Oso policy language.
- Add support for Permission constants in Polar files. Build the Permission enum using a macro.
- Added CA_ADMIN (for bulk operations) and CA_DELETE permissions.
- Support loading more than one custom auth policy file.
- Checks were missing on some API calls if the user had the necessary permission *on the relevant resources*.
- Rename the team policy as a demo to indicate that it is educational only.
- Split a role-per-ca demo out of the team policy demo.
- Extend the with_ta Cypress test to cover the role-per-ca ca demo policy (as it creates the needed data).
- Don't misrepresent an external policy file in log statements as being internal.
- Better comments describing what the tests are doing.
- Remove unused role parameter in team access demo policy.
- Add disallow() in Oso policies as a way to define deny rules.
2021-03-25 21:35:38 +01:00
23be0b5ef7 Make testbed fully configurable through config section
* Let users configure the AIA to use with TA certificates. Set 'ta_aia' in the config file. (#409)
* Use explicit configuration section for testbed, no longer rely on magic env variables.

Note: this will all be revised again if/when the Publication server and TA vs CA code is fully separated in future.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
2021-03-22 16:53:41 +01:00
e662c1553b Change to a hybrid event sourcing model for CAs and Repository. (#426)
This allows us to keep the full history of semantically important events, while not spamming the history and avoiding excessive use of disk space. See issues #370 and #423.

This is a substantial change. Highlights follow:
* Added a developer documentation section
* No longer using events for manifest/crl generation (#370)
* No longer using events for publication deltas (#423)
* Removed pre 0.6.0 migration code - people will have to upgrade to at least 0.6.0 first
* Added migration code for 0.6.0-0.8.1 to this
* Migrate repository by doing a keyroll. (#370)
* Remove archiving code for commands (no longer applicable)

Minor other fixes:
* Use a swap file when writing (avoid corrupt json if disk is full) (#370)
* Make removing publisher content idempotent for publishers already removed.

Co-authored-by: Ximon Eighteen <3304436+ximon18@users.noreply.github.com>
Co-authored-by: Jasper den Hertog <jasper@plainspace.com>
2021-03-17 12:08:36 +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 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 98215e8e49 FIX: broken init_multi_user_config_file test. 2021-01-12 21:17:22 +01:00
Tim Bruijnzeels 6792c6bc67 Forgot to add xml file resource for unit test (#369) 2021-01-11 11:24:49 +01:00