A spike proves .NET NegotiateAuthentication can accept a Kerberos context from a keytab and compute and verify GSS MICs, with a reusable KDC test container #79

Open
opened 2026-10-31 12:42:02 -04:00 by claude · 0 comments
Owner
  • Draft: INT-10
  • Priority: high (de-risks #80)
  • Agent: coder
  • Depends on: none
  • Decisions: none

Why

GSS-TSIG puts a GSS_GetMIC token where TSIG puts its HMAC (RFC 3645 §3.2 and §4). The server needs:

  • NegotiateAuthentication in server mode with Kerberos.
  • On Linux, acceptor credentials from a keytab (GSSAPI reads KRB5_KTNAME).
  • An integrity API. I believe ComputeIntegrityCheck/VerifyIntegrityCheck were added in .NET 9; the spike confirms or refutes this.

What changes

  • src/dotnet/tests/Ninlil.Dns.Data.EngineHosts/KerberosKdcHost.cs: a container built from a small Dockerfile kept in the test tree (Debian with MIT krb5-kdc). It creates realm NINLIL.TEST, a DNS/<host> service principal with its keytab, and a user principal.
  • In src/dotnet/src/Ninlil.Dns.Server.Tsig/Gss/:
    • IGssSecurityContext with Step(byte[] token, out byte[] outToken), IsComplete, RemotePrincipal, byte[] GetMic(ReadOnlySpan<byte>) and bool VerifyMic(ReadOnlySpan<byte>, ReadOnlySpan<byte>).
    • An implementation over NegotiateAuthentication.
    • IGssSecurityContextFactory.
  • Findings go in the issue: the API used, the keytab environment handling and whether it must be set before the first GSSAPI call, and Windows SSPI behaviour checked on lofnheim.

Acceptance

  • Test (RequiresDocker): a client context (user principal) and a server context (keytab) complete the handshake.
  • Test: a MIC from the client verifies on the server.
  • Test: a MIC with one byte flipped fails to verify.
  • If the integrity API is missing, the issue states that and proposes the fallback (P/Invoke to gss_get_mic/gss_verify_mic), and #80 waits for an owner decision.

Source

RFC 3645 §3.2 and §4; owner scope (".NET NegotiateAuthentication with a Kerberos keytab").

- **Draft:** INT-10 - **Priority:** high (de-risks #80) - **Agent:** coder - **Depends on:** none - **Decisions:** none ### Why GSS-TSIG puts a GSS_GetMIC token where TSIG puts its HMAC (RFC 3645 §3.2 and §4). The server needs: - `NegotiateAuthentication` in server mode with Kerberos. - On Linux, acceptor credentials from a keytab (GSSAPI reads `KRB5_KTNAME`). - An integrity API. I believe `ComputeIntegrityCheck`/`VerifyIntegrityCheck` were added in .NET 9; the spike confirms or refutes this. ### What changes - `src/dotnet/tests/Ninlil.Dns.Data.EngineHosts/KerberosKdcHost.cs`: a container built from a small Dockerfile kept in the test tree (Debian with MIT krb5-kdc). It creates realm `NINLIL.TEST`, a `DNS/<host>` service principal with its keytab, and a user principal. - In `src/dotnet/src/Ninlil.Dns.Server.Tsig/Gss/`: - `IGssSecurityContext` with `Step(byte[] token, out byte[] outToken)`, `IsComplete`, `RemotePrincipal`, `byte[] GetMic(ReadOnlySpan<byte>)` and `bool VerifyMic(ReadOnlySpan<byte>, ReadOnlySpan<byte>)`. - An implementation over `NegotiateAuthentication`. - `IGssSecurityContextFactory`. - Findings go in the issue: the API used, the keytab environment handling and whether it must be set before the first GSSAPI call, and Windows SSPI behaviour checked on lofnheim. ### Acceptance - [ ] Test (RequiresDocker): a client context (user principal) and a server context (keytab) complete the handshake. - [ ] Test: a MIC from the client verifies on the server. - [ ] Test: a MIC with one byte flipped fails to verify. - [ ] If the integrity API is missing, the issue states that and proposes the fallback (P/Invoke to `gss_get_mic`/`gss_verify_mic`), and #80 waits for an owner decision. ### Source RFC 3645 §3.2 and §4; owner scope (".NET NegotiateAuthentication with a Kerberos keytab").
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#79
No description provided.