Skip to content

feat(picky-krb): add IAKerb proxy message encoding/decoding - #531

Merged
Benoît Cortier (CBenoit) merged 3 commits into
Devolutions:masterfrom
Rostyslav-Romanets:add-iakerb-messages
Sep 29, 2026
Merged

Benoît Cortier (CBenoit) merged 3 commits into
Devolutions:masterfrom
Rostyslav-Romanets:add-iakerb-messages

Conversation

@Rostyslav-Romanets

@Rostyslav-Romanets Rostyslav-Romanets commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

This PR implements encoding and decoding of the IAKERB_PROXY message (IAKrbProxyMessage) according to the IAKERB specification. The implementation is also covered with unit-tests.

What is IAKERB

IAKERB extends Kerberos to support scenarios where the client cannot directly access the KDC. Instead, KDC messages are encapsulated in GSS-API tokens and exchanged through an IAKERB proxy. The server forwards these messages to the LocalKDC, allowing the client to obtain the required Kerberos tickets without direct network access to the KDC.

Microsoft recently introduced IAKERB support in Windows Insider builds as part of its effort to reduce NTLM dependency: https://techcommunity.microsoft.com/blog/windows-itpro-blog/reducing-ntlm-dependency-iakerb-and-localkdc-in-windows-insider-preview/4524615.

Related PRs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Decoding does not enforce outer framing boundaries or handle valid unknown header extensions.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 High severity · 1 Medium severity · 1 Low severity

Open (3)
What changed in this PR

Adds IAKERB proxy message support for downstream Kerberos proxy integrations.

Changes:

  • Adds IAKERB headers, constants, error codes, and mechanism OID.
  • Implements proxy message encoding/decoding.
  • Adds DER round-trip tests.
File Description
picky-krb/​src/​messages.rs Defines the IAKERB header and tests.
picky-krb/​src/​gss_api.rs Implements proxy token encoding and decoding.
picky-krb/​src/​constants.rs Adds IAKERB token and error constants.
picky-asn1-x509/​src/​oids.rs Registers the IAKERB mechanism OID.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread picky-krb/src/gss_api.rs Resolved
Comment thread picky-krb/src/messages.rs Resolved
Comment thread picky-krb/src/messages.rs Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Malformed known optional header fields can be silently accepted as absent.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (3)

Comment thread picky-krb/src/messages.rs
Comment on lines +494 to +500
let Asn1RawDer(raw) = Asn1RawDer::deserialize(deserializer)?;
let IAKerbHeaderHelper {
target_realm,
cookie,
flags,
} = picky_asn1_der::from_bytes(&raw)
.map_err(|err| D::Error::custom(format!("Cannot deserialize IAKerbHeader: {err:?}")))?;

@Rostyslav-Romanets Rostyslav-Romanets Sep 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parse the sequence by tag instead, propagating errors for known [2]/[3] fields and skipping only genuinely unknown extension tags.

This requires manual deserialization implementation. I don't think that's a good idea.
It would be better to fix the Optional type so that it returns an error if a value is present but malformed. But this should be done in a separate PR, since it touches many structures.

@CBenoit Benoît Cortier (CBenoit) Sep 29, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I think that the picky-asn1-der abstractions are not very good, and I’m considering a migration to the der crate instead of using serde for what it’s not good at. For now, I’ll merge as is, but I would gladly accept separate PRs to improve this. Thanks!

@CBenoit Benoît Cortier (CBenoit) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for contributing this. LGTM!

@CBenoit

Copy link
Copy Markdown
Member

Looks like merge is blocked on the code formatting, can you just run cargo fmt, please? Thank you.

@CBenoit
Benoît Cortier (CBenoit) merged commit 6f98044 into Devolutions:master Sep 29, 2026
12 checks passed
Benoît Cortier (CBenoit) added a commit that referenced this pull request Oct 7, 2026
picky-krb 0.12.5 (#531) added `GssApiMessageError::InvalidMechanismOid`
to an exhaustive public enum in a patch release.
That is a semver-breaking change.
Every published `sspi` (0.21.x, 0.22.x, 0.23.0) matches this enum
exhaustively, so none of them compile against 0.12.5 (`error[E0004]:
non-exhaustive patterns`).
This broke fresh dependency resolves downstream, for example in IronRDP.

0.12.5 will be yanked manually on crates.io.
This PR re-releases the same code as **0.13.0**.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Marc-André Moreau (mamoreau-devolutions) pushed a commit to Devolutions/sspi-rs that referenced this pull request Oct 19, 2026
…751)

This PR adds support for the IAKERB extension according to the [IAKERB
specification](https://datatracker.ietf.org/doc/html/draft-ietf-kitten-iakerb-03).

The main changes are focused on the `Kerberos` state machine.
Previously, the `Preauthentication` state handled the entire KDC message
exchange withing a single async `intialize_security_context` call. This
approach does not work with IAKERB, where KDC messages are exchanged via
a server that acts as a proxy. The `Preauthentication` state has
therefore been split into multiple states, allowing the state machine to
save `Kerberos` state between KDC message exchanges.

Additionaly, the `AS` and `TGS` exchanges have been extracted into
separate state machines. These new state machines are KDC
transport-agnostic and can be used with both external KDC and an IAKERB
proxy.

## What is IAKERB
IAKERB extends Kerberos to support scenarios where the client cannot
directly access the KDC. Instead, KDC messages are encapsulated in
GSS-API tokens and exchanged through an IAKERB proxy. The server
forwards these messages to the LocalKDC, allowing the client to obtain
the required Kerberos tickets without direct network access to the KDC.

Microsoft recently introduced IAKERB support in Windows Insider builds
as part of its effort to reduce NTLM dependency:
https://techcommunity.microsoft.com/blog/windows-itpro-blog/reducing-ntlm-dependency-iakerb-and-localkdc-in-windows-insider-preview/4524615.

## Related PRs
* picky-rs: Devolutions/picky-rs#531
* IronRDP: Devolutions/IronRDP#1987
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants