Skip to content

LDAP/SSO

SentriKat supports LDAP/Active Directory authentication and SAML 2.0 Single Sign-On for enterprise environments.

PRO Feature

LDAP and SAML SSO require a PRO license. DEMO users authenticate with local accounts only.

LDAP / Active Directory

Configuration

Configure LDAP via environment variables in your .env file:

LDAP_ENABLED=true
LDAP_SERVER=ldap://ldap.example.com
LDAP_PORT=636
LDAP_BIND_DN=cn=sentrikat,ou=services,dc=example,dc=com
LDAP_BIND_PASSWORD=your-bind-password
LDAP_BASE_DN=ou=users,dc=example,dc=com

These six variables are the ones overridable from the environment. All other LDAP options (SSL mode, user filter, group mappings) are configured from the web UI and stored in the database.

After setting these variables, restart SentriKat:

docker compose restart sentrikat

Environment Variables

Variable Description Example
LDAP_ENABLED Enable LDAP authentication true
LDAP_SERVER LDAP server URL ldap://ldap.example.com or ldaps://...
LDAP_PORT Connection port 389 (LDAP) or 636 (LDAPS)
LDAP_BIND_DN Service account DN cn=sentrikat,ou=services,dc=example,dc=com
LDAP_BIND_PASSWORD Service account password Required
LDAP_BASE_DN User search base ou=users,dc=example,dc=com

All other LDAP options (user filter, group bases/filters, TLS client certificates) are configured from the web UI (Admin > Settings > LDAP) and stored in the database — they are not read from the environment.

Active Directory Example

For Microsoft Active Directory, use these settings:

LDAP_ENABLED=true
LDAP_SERVER=ldaps://dc01.corp.example.com
LDAP_PORT=636
LDAP_BIND_DN=CN=SentriKat Service,OU=Service Accounts,DC=corp,DC=example,DC=com
LDAP_BIND_PASSWORD=your-bind-password
LDAP_BASE_DN=DC=corp,DC=example,DC=com

Set the AD-specific user filter ((sAMAccountName={username})) and the group bases/filters from Admin > Settings > LDAP.

Group-to-Role Mapping

Map LDAP/AD groups to SentriKat roles in Admin > Settings > LDAP > Group Mapping:

LDAP Group SentriKat Role Description
CN=SentriKat-Admins,OU=Groups,... org_admin Full org management
CN=SentriKat-Managers,OU=Groups,... manager Product and vuln management
CN=SentriKat-Users,OU=Groups,... viewer Read-only access

If a user does not belong to any mapped group, they are assigned the default role configured in Admin > Settings > LDAP > Default Role.

Testing LDAP

Validate your LDAP configuration before enabling it for all users:

# Test from within the Docker container
docker compose exec sentrikat flask ldap test

# Or test via the admin panel
# Admin > Settings > LDAP > Test Connection

Expected output:

LDAP Connection: OK
Bind: OK
User Search (test): Found 1 result
Group Search: Found 3 groups

Warning

Always test LDAP with a non-admin account first. If LDAP is misconfigured and you enable it, local admin login remains available as a fallback at /auth/local-login.

SAML 2.0 SSO

Overview

SentriKat acts as a SAML 2.0 Service Provider (SP). You configure your Identity Provider (IdP) to trust SentriKat and send signed assertions.

Supported Identity Providers

SentriKat has been tested with:

  • Microsoft Entra ID (Azure AD)
  • Okta
  • Google Workspace
  • Keycloak
  • ADFS

SentriKat SP Metadata

Your SentriKat instance exposes SP metadata at:

https://sentrikat.example.com/auth/saml/metadata

Provide this URL to your IdP when configuring the trust relationship.

IdP Configuration

  1. In the Azure Portal, go to Enterprise Applications > New Application
  2. Select Create your own application > Non-gallery
  3. Under Single sign-on, choose SAML
  4. Set the following:
    • Entity ID: https://sentrikat.example.com/auth/saml/metadata
    • Reply URL (ACS): https://sentrikat.example.com/auth/saml/acs
    • Sign-on URL: https://sentrikat.example.com/auth/saml/login
  5. Under Attributes & Claims, map:
    • email -> user.mail
    • displayName -> user.displayname
  6. Download the Federation Metadata XML
  1. In Okta Admin, go to Applications > Create App Integration
  2. Choose SAML 2.0
  3. Set the following:
    • Single sign-on URL: https://sentrikat.example.com/auth/saml/acs
    • Audience URI: https://sentrikat.example.com/auth/saml/metadata
  4. Add attribute statements:
    • email -> user.email
    • displayName -> user.firstName + " " + user.lastName
  5. Download the IdP Metadata XML
  1. In Keycloak Admin, go to Clients > Create
  2. Set Client Protocol to saml
  3. Set Client ID to https://sentrikat.example.com/auth/saml/metadata
  4. Configure endpoints:
    • Master SAML URL: https://sentrikat.example.com/auth/saml/acs
  5. Under Mappers, add email and displayName
  6. Export the realm's SAML metadata

SentriKat SAML Settings

Configure SAML in your .env file:

SAML_ENABLED=true
SAML_IDP_METADATA_URL=https://login.microsoftonline.com/.../federationmetadata/2007-06/federationmetadata.xml
SAML_ENTITY_ID=https://sentrikat.example.com/auth/saml/metadata
SAML_ACS_URL=https://sentrikat.example.com/auth/saml/acs
SAML_CERT_FILE=/certs/saml-sp.crt
SAML_KEY_FILE=/certs/saml-sp.key

Tip

If your IdP does not support a metadata URL, download the XML file and mount it into the container. Set SAML_IDP_METADATA_FILE=/config/idp-metadata.xml instead.

Enabling SSO

  1. Configure the environment variables above
  2. Restart SentriKat: docker compose restart sentrikat
  3. Go to Admin > Settings > Authentication
  4. Enable SAML SSO
  5. Optionally, check Enforce SSO to disable local password login for non-admin users

TOTP Two-Factor Authentication

New in v1.0.2

TOTP 2FA was added in SentriKat v1.0.2.

SentriKat supports Time-based One-Time Password (TOTP) two-factor authentication for all user accounts, including local, LDAP, and SSO users.

Enabling TOTP

Global Enforcement

Require all users to set up TOTP:

  1. Go to Admin > Settings > Authentication
  2. Enable Require Two-Factor Authentication
  3. Save

Users will be prompted to set up TOTP on their next login.

Per-User Setup

Individual users can enable TOTP from their profile:

  1. Go to Profile > Security
  2. Click Enable Two-Factor Authentication
  3. Scan the QR code with an authenticator app (Google Authenticator, Authy, 1Password, etc.)
  4. Enter the verification code to confirm
  5. Save recovery codes in a secure location

Supported Authenticator Apps

Any TOTP-compatible authenticator works:

  • Google Authenticator
  • Microsoft Authenticator
  • Authy
  • 1Password
  • Bitwarden

Recovery

If a user loses access to their authenticator:

  1. An admin can disable TOTP for the user in Admin > Users > Select user > Disable 2FA
  2. The user can use a recovery code (generated during setup)

Hybrid Authentication

You can enable both LDAP and SAML simultaneously. SentriKat resolves authentication in this order:

  1. SAML SSO (if user clicks "Sign in with SSO")
  2. LDAP bind (if LDAP is configured)
  3. Local database (fallback)

Warning

The local super_admin account always authenticates against the local database, regardless of SSO settings. This ensures you are never locked out.

Next Steps