Skip to content

feat(pam): NTLM authentication for MSSQL proxy#241

Open
saifsmailbox98 wants to merge 5 commits into
mainfrom
saif/pam-226-add-ntlm-auth-support-for-mssql-in-pam
Open

feat(pam): NTLM authentication for MSSQL proxy#241
saifsmailbox98 wants to merge 5 commits into
mainfrom
saif/pam-226-add-ntlm-auth-support-for-mssql-in-pam

Conversation

@saifsmailbox98
Copy link
Copy Markdown
Contributor

@saifsmailbox98 saifsmailbox98 commented May 20, 2026

Description 📣

Gateway MSSQL proxy can now perform NTLM authentication with the target SQL Server when the account is configured for Windows auth. Uses go-ntlmssp for the handshake; the client-to-gateway leg remains unchanged.

Infisical/infisical#6544

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

# Here's some code block to paste some code snippets

Gateway MSSQL proxy now supports NTLM (Windows Authentication) in
addition to SQL auth. When AuthMethod is "ntlm", the proxy performs
a 3-message NTLM handshake with the server (negotiate, challenge,
authenticate) using go-ntlmssp, instead of sending SQL credentials
in LOGIN7.

The client-to-gateway leg is unchanged — clients always use SQL auth
with dummy credentials, and the proxy injects the real NTLM auth on
the server leg.
@linear
Copy link
Copy Markdown

linear Bot commented May 20, 2026

PAM-226

@infisical-review-police
Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-241-feat-pam-ntlm-authentication-for-mssql-proxy

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

Comment thread packages/pam/handlers/mssql/proxy.go Outdated
Comment thread packages/pam/handlers/mssql/tds.go
…x SSPI length sentinel

Extract SSPI token before checking for error tokens — the NTLM
challenge contains random binary that can match the 0xAA error byte.
Also fix the SSPI length boundary: 0xFFFF is a sentinel per TDS spec,
so use strict less-than.
@saifsmailbox98
Copy link
Copy Markdown
Contributor Author

@claude review once

Comment thread packages/pam/handlers/mssql/proxy.go
Comment thread packages/pam/handlers/mssql/proxy.go Outdated
go-ntlmssp uses splitNameForAuth to extract domain from the username.
Without the DOMAIN\ prefix, the domain is empty in the NTLMv2 hash
and authenticate message, which may fail on domain-member SQL Servers
authenticating against a remote DC.
@saifsmailbox98 saifsmailbox98 requested a review from x032205 May 20, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant