Commit graph

93 commits

Author SHA1 Message Date
Firstyear b5cdf9dcf2
Indicate that this is an ip list, not a range ()
* Indicate that this is an ip list, not a range

We mistakenly commented that this was a range, not a list. This
has led to some confusion. Be clear it's a list of ip's, not a range.

* Support Ip Ranges instead of Ip Addresses in X-Forward-For

* Docs feedback
2025-05-13 01:53:58 +00:00
James Hodgkinson 036f069c2d fix: clippy 2025-05-09 13:10:09 +10:00
William Brown bb53f17b80 Order keys in application JWKS / Fix rotation bug
When we return the JWKS for applications to validate, the order of
that set can matter for applications which assume that the first
key in the list is the current valid key. This sorts the resultant
JWKS to ensure that the latest key is always first.

When a key was requested for rotation, if the rotation time was in
the past then the key would not be rotated. In this situation, the
server now assumes that any "past" time indicates the rotation should
occur *now* instead.
2025-05-09 13:10:09 +10:00
Firstyear aaf43c7b06
Drop fernet in favour of JWE ()
This drops the use of fernet from OAuth2 in favour of JWE. To achieve
this cleanly, we swap OAuth2 to using our internel key object handler
so that in future we can consider the use of pkcs11 devices. This also
makes it easier in general to handle any future cryptographic changes.
2025-04-30 16:42:22 +10:00
James Hodgkinson be4818e121
Update dependencies, fix a bunch of clippy lints () 2025-04-24 11:25:25 +10:00
Firstyear e97f4bc54c
20250402 3423 proxy protocol ()
Implement the PROXY protocol for IP address information from load balancers. This improves our handling and configuration of x-forward-for as well to include trusted IP ranges.
2025-04-23 01:10:01 +00:00
Firstyear 919e0ba6fe
20250225 ldap testing in testkit ()
Add support for ldap servers in integration tests

This allows the ldap interface to be enabled during tests, which is
a final requirement to complete ldap application passwords.
2025-03-11 12:35:31 +10:00
Firstyear 63deda350c
20250225 improve test performance ()
* Ignore tests that are no longer used.

Each time a library or binary is added, that requires compilation to create
the *empty* test harness, which then is executed and takes multiple seconds
to start up, do nothing, and return success.

This removes test's for libraries that aren't actually using or running
any tests.

Additionally, each time a new test binary is added, that adds a ton of
compilation time, but also test execution time as the binary for each
test runner must start up, execute, and shutdown. So this merges all
the testkit integration tests to a single running which significantly
speeds up test execution.

* Improve IDL exists behaviour, improve memberof verification

Again to improve test performance. This improves the validation of idx
existance to be a faster SQLite call, caches the results as needed.

Memberof was taking up a large amount of time in verify phases of test
finalisation, and so a better in memory version has been added.

* Disable TLS native roots when not needed

* Cleanup tests that are hitting native certs, or do nothing at all
2025-03-04 10:36:53 +10:00
Firstyear 25c1c1573e
20250213 patch used wrong acp ()
Migrations and server bootstrap are very interconnected processes
and in this we'll be addressing and improving both.

Server bootstrap was performed by creating base entries in phases,
eventually bringing up enough of the *oldest* supported server
minimum remigration level, to then allow triggering of migrations.

Migrations then applied "patches" effectively ontop of this minimum
level to update entries to what they should be in newer versions of
the server.

This scheme has it's pros and cons, but the major con was that to
remove a migration meant squashing it's content back into the
minimum remigration level, and this was a human process that was
quite error prone and difficult to automate. As well, this scheme
also led to cases where the patch migrations would sometimes *not*
reflect all the needed changes or content, or in one case was actually
undone by a patchlevel fix up that was required to address a bug.

Invariably this led to issues, and cases where a new server may have
different content to a migrated one - not exactly what we want!

This is a new migration scheme that addresses this fragility. However
what it trades is verbosity of the content.

Rather than having a base set of entries and patching/updating small
sections ontop, we have migration data folders that contain the full
set of entries as they should appear at that migration level. This
makes the bootstrap process easier as we can just apply the migration
level as a whole, and targetted to what precise version we want.

This also makes migrations more durable as the content is explicitly
copied and all entries fully applied, so there is no risk that a
migration or data change can be forgotten or applied incorrectly. We
are expressing the full state of what our builtin and provided entries
should be.

Finally this rips out a number of places where migration data was being
used as test case data. Not all of these have been replaced (notably
in authsession with Account), but the majority have and have been replaced
with clearer use of constants rather than building whole entries just to
access the name and throw them away for example.
2025-02-28 10:18:48 +10:00
Sebastiano Tocci 9611a7f976
Fixes : add configurable maximum queryable attributes for LDAP () 2025-02-21 12:14:47 +10:00
Jason 99e37e987a
Allow POST on oauth userinfo () 2025-02-04 06:22:32 +00:00
Firstyear b3be758b74
20250114 3325 SCIM access control ()
Add an extended query operation to return effective access controls so that UI's can dynamically display what is or is not editable on an entry.
2025-01-20 11:28:22 +00:00
micolous 16591007dd
Add OAuth2 response_mode=fragment ()
* Add response_mode=fragment to discovery documents
* Add test for `response_mode=query`
* refactor OAuth 2.0 tests back into regular functions, because macros are messy
* Disallow some `response_type` x `response_mode` combinations per spec
2025-01-08 15:41:01 +10:00
Firstyear ea0e63cc2a
20240927 SCIM put () 2024-11-30 06:56:17 +00:00
Firstyear 9973385381
20241109 3185 max age () 2024-11-10 06:20:15 +09:00
dependabot[bot] d174cbfd72
Bump jsonschema from 0.21.0 to 0.26.0 in the all group ()
* Bump jsonschema from 0.21.0 to 0.26.0 in the all group

Bumps the all group with 1 update: [jsonschema](https://github.com/Stranger6667/jsonschema).


Updates `jsonschema` from 0.21.0 to 0.26.0
- [Release notes](https://github.com/Stranger6667/jsonschema/releases)
- [Changelog](https://github.com/Stranger6667/jsonschema/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Stranger6667/jsonschema/compare/rust-v0.21.0...rust-v0.26.0)

---
updated-dependencies:
- dependency-name: jsonschema
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>

* fixing up change in JSONschema errors

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
Co-authored-by: Firstyear <william@blackhats.net.au>
2024-10-30 01:31:48 +00:00
James Hodgkinson 5a709520dc
OAuth2 Device flow foundations () 2024-10-26 12:08:48 +10:00
Firstyear b0824fef18
htmx by default ()
* htmx by default

* restore the webmanifest

* fixing unused import

---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2024-10-26 01:44:00 +00:00
CEbbinghaus dc56a3217d
Chore: Refactor Groups to be more generic () 2024-10-25 00:36:20 +00:00
Firstyear 31420c3ff9
ipinfo should be single value () 2024-10-23 02:39:40 +00:00
George Wu 7eb54be487
Change some OperationError into HTTP Bad Request (400). () 2024-10-21 02:57:23 +00:00
Firstyear 5a3e5f1e07
20241017 3107 token ttl () 2024-10-18 03:28:52 +00:00
Firstyear 2075125439
Working scim entry get for person () 2024-10-15 04:29:45 +00:00
James Hodgkinson c8b3b6214c
Cache buster buster () 2024-10-15 01:54:46 +00:00
Firstyear d3891e301f
20240810 SCIM entry basic () 2024-09-12 12:53:43 +10:00
Firstyear 938ad90f3b
20240906 Attribute as an Enum Type ()
Changes attribute from a string to an enum - this provides many performance improvements and memory savings throughout the server.
2024-09-09 00:53:10 +00:00
James Hodgkinson 3eae7be0bb
OAuth2 Token Type ()
* fix(OAuth2): Invalid `token_type` for token introspection
Fixes 

* fix(aut): `assert_eq` instead of `assert ==`

* fix(OAuth2): IANA registry access token types

* fix(OAuth2): deserialize case insensitively
2024-08-25 23:30:20 +00:00
James Hodgkinson 7c3deab2c4
enforcen den clippen ()
* enforcen den clippen
* updating outdated oauth2-related docs
* sorry clippy, we tried
2024-08-21 00:32:56 +00:00
Firstyear 329750981e
Update to 1.4.0-dev () 2024-08-01 00:02:11 +10:00
Alin Trăistaru 562f352516
fix typos ()
* fix typos and misspellings
* use proper capitalization
* Apply suggestions from code review
---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2024-07-18 03:22:20 +00:00
Firstyear d7a5097527
htmx logout tidy up () 2024-07-15 07:11:00 +00:00
Firstyear f9a77ee1f3
2818 2511 oauth2 urls ()
* Allow multiple origins
* Docs
* Capitalization 'n stuff

---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2024-07-05 23:17:26 +00:00
James Hodgkinson 3c01a96348
Better WebAuthn and other error responses () 2024-06-05 09:57:16 +10:00
James Hodgkinson 1d0a606e69
WIP: serialization and domain info setting wonkiness () 2024-05-28 11:49:30 +10:00
Firstyear afd674d346
Add mail support to groups ()
* Add mail support to groups

* Update libs/client/src/group.rs

---------

Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2024-04-23 07:08:28 +00:00
Firstyear d7834b52e6
Begin the basis of the key provider model ()
This completely reworks how we approach and handle cryptographic keys in Kanidm. This is needed as a foundation for replication coordination which will require handling and rotation of cryptographic keys in automated ways. 

This change influences many other parts of the code base in it's implementation.

The primary influences are:

* Modification of how domain user signing keys are revoked or rotated.
* Merging of all existing service-account token keys are retired (retained) keys into the domain to simplify token signing and validation
* Allowing multiple configurations of local command line tools to swap between instances using disparate signing keys.
* Modification of key retrieval to be key id based (KID), removing the need to embed the JWK into tokens

A side effect of this change is that most user authentication sessions and oauth2 sessions will have to be re-established after upgrade. However we feel that session renewal after upgrade is an expected side effect of an upgrade. 

In the future this lays the ground work to remove a large number of legacy key handling processes that have evolved, which will allow large parts of code to be removed.
2024-04-15 23:44:37 +00:00
Firstyear b4d9cdd7d5
20240301 systemd uid ()
Fixes  Fixes  - gid numbers can be part of the systemd nspawn range.

Previously we allocated gid numbers based on the fact that uid_t is a u32, so we allowed 65536 through u32::max. However, there are two major issues with this that I didn't realise. The first is that anything greater than i32::max (2147483648) can confuse the linux kernel. 

The second is that systemd allocates 524288 through 1879048191 to itself for nspawn.

This leaves with with only a few usable ranges.

1000 through 60000
60578 through 61183
65520 through 65533
65536 through 524287
1879048192 through 2147483647

The last range being the largest is the natural and obvious area we should allocate from. This happens to nicely fall in the pattern of 0x7000_0000 through 0x7fff_ffff which allows us to take the last 24 bits of the uuid then applying a bit mask we can ensure that we end up in this range. 

There are now two major issues.

We have now changed our validation code to enforce a tighter range, but we may have already allocated users into these ranges. 

External systems like FreeIPA allocated uid/gid numbers with reckless abandon directly into these ranges. 

As a result we need to make two concessions.

We *secretly* still allow manual allocation of id's from 65536 through to 1879048191 which is the nspawn container range. This happens to be the range that freeipa allocates into. We will never generate an ID in this range, but we will allow it to ease imports since the users of these ranges already have shown they 'don't care' about that range. This also affects SCIM imports for longer term migrations. 

Second is id's that fall outside the valid ranges. In the extremely unlikely event this has occurred, a startup migration has been added to regenerate these id values for affected entries to prevent upgrade issues. 

An accidental effect of this is freeing up the range 524288 to 1879048191 for other subuid uses.
2024-03-07 03:25:54 +00:00
Vladimir Dronnikov 221445d387
expose group patch for parity ()
Co-authored-by: James Hodgkinson <james@terminaloutcomes.com>
2024-03-07 09:54:20 +10:00
James Hodgkinson 4c1fa0d644
Adding a builtin class for all built-in things ()
* adding builtin class to builtin objects
* Resolve issues with builtin PR

---------

Co-authored-by: William Brown <william@blackhats.net.au>
2024-03-06 01:33:14 +00:00
Firstyear fbc021f487
20240221 2489 cleanup api v1 () 2024-02-27 09:25:02 +00:00
James Hodgkinson 4efdb7208f
of course I started looking at clippy things and now I can't stop () 2024-02-21 00:52:10 +00:00
Firstyear d42268269a
20240125 2217 client credentials grant ()
* Huge fix of a replication problem.
* Update test
* Increase min replication level
* Client Credentials Grant implementation
2024-02-01 02:00:29 +00:00
Firstyear 8dc884f38e
2390 1980 allow native applications () 2024-01-16 10:44:12 +10:00
Firstyear 0e44cc1dcb
Minor fixes for oidc with single page applications () 2024-01-08 23:57:14 +00:00
Firstyear fd71a748ca
Add improved domain migration framework and default MFA () 2023-12-21 14:44:20 +10:00
Firstyear d09c2448ff
1481 2024 access control rework ()
Rework default access controls to better separate roles and access profiles.
2023-12-17 23:10:13 +00:00
Firstyear ac299b5286
Update to the latest compact-jwt version () 2023-11-24 02:53:22 +00:00
James Hodgkinson 12f1de8358
Update OpenAPI schema gen to actually... be kinda sorta valid. ()
* updating lockfile

* OpenAPI validation issues
Fixes 

* clippy sez no

* adding another validator, more specs
2023-11-07 11:35:17 +10:00
James Hodgkinson 7025a9ff55
Feature: kanidm CLI pulling OpenAPI schema ()
* diag is super noisy when you actually turn on logging... even though it wasn't an error?
* adding api download-schema to the CLI
* docs
2023-11-03 17:37:27 +10:00
James Hodgkinson cf35a7e667
Feature: configurable replication poll interval ()
* Feature: configurable replication poll interval ()
* Updating log messages because REPL != LDAP
2023-11-02 02:07:53 +00:00