Skip to content

feat: gate DIGEST-MD5 and NTLM behind requirefips build tag - #619

Open
macdewee wants to merge 2 commits into
go-ldap:masterfrom
macdewee:drosiek-fips
Open

feat: gate DIGEST-MD5 and NTLM behind requirefips build tag#619
macdewee wants to merge 2 commits into
go-ldap:masterfrom
macdewee:drosiek-fips

Conversation

@macdewee

Copy link
Copy Markdown

Gates non-FIPS-compliant algorithms (MD4, MD5, RC4, DES — used by DIGEST-MD5 and NTLM) behind the requirefips build tag. When built with -tags requirefips, these mechanisms return an error and their dependencies (go-ntlmssp, x/crypto/md4, crypto/md5) are absent from the binary. No behavior change for normal builds — the code was moved, not rewritten.

Known limitation: gokrb5 still pulls in x/crypto/md4 and crypto/rc4 via its RC4-HMAC Kerberos enctype support. To be addressed in a separate PR.

macdewee and others added 2 commits July 15, 2026 14:19
DIGEST-MD5 (MD5/MD4) and NTLM (MD4, HMAC-MD5, RC4, DES) use algorithms
that are not FIPS 140-2/3 approved and cannot be made compliant — the
protocols are inherently non-FIPS by design.

Under -tags requirefips, both mechanisms are replaced by stubs that
return a clear error directing users to GSSAPIBind (Kerberos) or
SimpleBind over TLS. This physically removes go-ntlmssp and the direct
x/crypto/md4 and crypto/md5 imports from the binary, satisfying the
strict FedRAMP High requirement that non-FIPS crypto must be absent
from the binary, not merely unreachable at runtime.

Non-FIPS builds are unchanged. A fips140.Enabled() runtime guard is
also added as a defence-in-depth safety net for binaries built without
the tag but running under GOFIPS140.

Known limitation: gokrb5 pulls in x/crypto/md4 and crypto/rc4 for its
RC4-HMAC Kerberos enctype support regardless of build tags. This will
be addressed in a separate upstream or Elastic fork PR.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds two steps to the PR workflow:
- build/vet/test with -tags requirefips to catch regressions in the
  FIPS stubs
- dependency graph check that fails if any forbidden non-FIPS package
  (currently go-ntlmssp) appears in a requirefips build

TODO in the dep check: extend the forbidden list to include
x/crypto/md4 and x/crypto/rc4 once gokrb5 RC4-HMAC enctype support
is gated behind a build tag.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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