Docker image of NGINX with SPNEGO (Kerberos) module precompiled for GSSAPI-based authentication.
This image is intended to be used in environments with FreeIPA or Windows Server for secure, enterprise-grade SSO authentication.
Replace hostnames with your actual server FQDNs.
ipa service-add HTTP/test.example.com
Replace hostnames with your actual server FQDNs.
setspn -A HTTP/test.example.com <user>
User must exist!
ipa-getkeytab -s <freeipa-server> \
-p HTTP/[email protected] \
-k nginx.keytab
ktpass -princ HTTP/test.example.com@<WINDOWS_DOMAIN> -mapuser <user>@<windows_domain> -pass <user_password> -out ./nginx.keytab -ptype KRB5_NT_PRINCIPAL -crypto RC4-HMAC-NT
Place your SPNEGO-enabled NGINX site configuration file in ./default
. You can use default configuration as example
docker run -it --rm \
-v $(pwd)/default:/etc/nginx/sites-available/default \
-v $(pwd)/nginx.keytab:/etc/nginx/nginx.keytab \
--net=host \
suprematic/nginx-spnego:latest
Note:
--net=host
is used to allow NGINX to bind to system ports.
From a Kerberos-authenticated client:
curl -vv --negotiate -u : http://test.example.com/
Depend on your system configuration, you should be authenticated before (for linux):
kinit <username>
If everything is configured correctly, the server should respond without prompting for credentials.
Some browsers may require additional configurations! For example, MS Edge requires that site must be added into 'Local Intranet' list and available via HTTPS.
Here’s a README.md
description for your SPNEGO-based authentication project to protect internal Kubernetes HTTP applications. It explains the architecture, purpose, and how to use it:
This solution is ideal for internal web applications deployed in a Kubernetes cluster where centralized authentication via FreeIPA, Active Directory, or another Kerberos-compatible realm is required. It integrates seamlessly with an Ingress controller and supports secure header-based identity propagation.
- NGINX + SPNEGO: Runs as a standalone deployment behind an internal service.
- Ingress Auth Integration: The Ingress controller delegates authentication to the SPNEGO service using the
auth-url
andauth-response-headers
annotations. - Kerberos Keytab: Provided securely via Kubernetes Secret.
- User Identity: Passed to backend applications via the
X-Authenticated-User
HTTP header.
Defines the NGINX server block, enabling SPNEGO authentication via the auth_gss
directive. The user identity is exposed with the X-Authenticated-User
header.
Contains the keytab file (http-headers.keytab
) for the SPNEGO service principal (e.g., HTTP/[email protected]
), base64-encoded.
Runs the custom NGINX image (suprematic/nginx-spnego
) with:
- Mounted keytab at
/etc/nginx/nginx.keytab
- Mounted
nginx.conf
from the ConfigMap - Logs to
stdout
andstderr
for easy access
A ClusterIP service exposes the NGINX pod at port 80.
Ingress configuration for the protected application. Uses auth-url
to delegate requests to the SPNEGO service and propagates the X-Authenticated-User
header to the backend.