Add support for RFC 8070 "PKINIT Freshness"
- Dominant language
- C#
- Stars
- 567
- Forks
- 109
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
Kerberos as spec'ed does not provide a guarantee of current possession of the client key. This means client as-req's can be generated infinitively into the future once, and then be used without requiring knowledge of the client key. The "Freshness" spec introduces the idea of a freshness token sent in the krb-error message to indicate the client needs to include it in the message to continue, which requires current knowledge of the client key to sign the message.
**Describe the solution you'd like**
`KerberosClient` should detect the `PA_AS_FRESHNESS` PA-Data element, inject the token into a new PA-Data element, and retry the request.
`PublicKeyPreAuthenticationHandler` should be extended to check for the freshness token and validate correctness. A new setting should be included on `IRealmSettings` that indicates whether freshness is supported or not and if it is, should be injected if not present.
The freshness token should be a short lived value tying the client to the current time. An example token might be something like `AesGcm(value: upn | (now + 5 min), key: krbtgt)` and validated by decrypting and checking the timestamp hasn't passed
**Additional context**
https://tools.ietf.org/html/rfc8070
Contributor guide
Assessment
This issue has not been assessed yet.