Skip to content

Suggestions for improving kerberos.asciidoc (2.4.0) #107

@snussbaumermpreis

Description

@snussbaumermpreis

Hallo,

ggf. könnte das aktualisiert werden -> das genannten mod_auth_kerb Modul is deprecated und in neueren Versionen z.B. Ubuntu 24.04. nicht mehr verfügbar, es wurde durch mod_auth_gssapi ersetzt was sehr ähnlich funktioniert.

Es funktioniert mit mod_auth_gssapi und ich hätte hier folgende Anleitung die man vlt. angepasst verwenden könnte.

Checkmk Kerberos SSO (mod_auth_gssapi) – Zusammenfassung

Grundlagen

mod_auth_kerb existiert nicht mehr → mod_auth_gssapi verwenden

Doku: https://docs.checkmk.com/latest/en/kerberos.html

Wichtige Stolpersteine

  1. cookie_auth.conf

MUSS disabled sein

Grund:
Satisfy any umgeht Auth → kein 401 → Browser startet kein Kerberos → immer Login-Seite, kein SSO

  1. Kein 401 ⇒ kein SSO

Kerberos funktioniert nur, wenn Apache 401 + WWW-Authenticate: Negotiate liefert

Redirects (301/302) verhindern Kerberos-Handshake

Checkmk User-Pflicht

Kerberos allein reicht nicht

User muss in Checkmk existieren (LDAP Sync z.B.)

Fehlt der User:

Apache: Auth OK

Checkmk: nicht existenter User → Redirect zur Login-Seite

GSSAPI Modul installieren:
z.B. Ubuntu
apt-get install libapache2-mod-auth-gssapi

Apache Konfiguration

Datei:
/opt/omd/sites/${SITE}/etc/apache/conf.d/auth.conf


Define SITE mysite 

Define REALM MYREALM.COM 

Define SERVICENAME myserver.mydomain.com

Define KEYTAB /opt/omd/sites/${SITE}/etc/apache/checkmk.keytab 

 
 

# Optional: Debugging 

#LogLevel auth_gssapi:debug 

#LogFormat "%h %u %{REMOTE_USER}e %r %>s" withuser 

#CustomLog /opt/omd/sites/${SITE}/var/log/apache/access-user.log withuser 

 
 

<IfModule !mod_auth_gssapi.c> 

  LoadModule auth_gssapi_module /usr/lib/apache2/modules/mod_auth_gssapi.so 

</IfModule> 

 
 

<Location /${SITE}> 

  <If "! %{HTTP_COOKIE} =~ /(^|;\s*)auth_${SITE}/ 

        && ! %{REQUEST_URI} = '/${SITE}/check_mk/register_agent.py' 

        && ! %{REQUEST_URI} = '/${SITE}/check_mk/deploy_agent.py' 

        && ! %{REQUEST_URI} = '/${SITE}/check_mk/run_cron.py' 

        && ! %{REQUEST_URI} = '/${SITE}/check_mk/restapi.py' 

        && ! %{REQUEST_URI} = '/${SITE}/check_mk/webapi.py' 

        && ! %{REQUEST_URI} = '/${SITE}/check_mk/automation.py' 

        && ! %{REQUEST_URI} -strmatch '/${SITE}/check_mk/api/' 

        && ! %{REQUEST_URI} = '/${SITE}/check_mk/ajax_graph_images.py' 

        && ! %{QUERY_STRING} =~ /(secret=|auth|register_agent)/ 

        && ! %{REQUEST_URI} =~ m#^/${SITE}/(omd/|check_mk/((images|themes)/..(png|svg)|login.py|..(css|js)))# "> 

 
 

    Order allow,deny 

    Allow from all 

    Require valid-user 

 
 

    AuthType GSSAPI 

    AuthName "Checkmk GSSAPI Login" 

    GssapiCredStore keytab:${KEYTAB} 

    GssapiAllowedMech krb5 

    GssapiLocalName On 

    GssapiBasicAuth Off 

 
 

    # Fallback bei Kerberos-Fehler 

    ErrorDocument 401 '<html> 

      <head> 

        <meta http-equiv="refresh" content="1; URL=/${SITE}/check_mk/login.py"> 

      </head> 

      <body> 

        Kerberos authentication failed, redirecting to login page. 

        <a href="/${SITE}/check_mk/login.py">Click here</a>. 

      </body> 

    </html>' 

  </If> 

</Location> 

 
 

# Unauthentifizierte Ressourcen (Login + Assets) 

<LocationMatch /${SITE}/(omd/|check_mk/(images/..png|login.py|.*.(css|js)))> 

  Order allow,deny 

  Allow from all 

  Satisfy any 

</LocationMatch> 

Danke!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions