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
Comment thread picky-krb/src/messages.rs
Comment thread picky-krb/src/messages.rs Outdated

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
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