![]() |
This is a machine translation based on the English version of the article. It might or might not have already been subject to text preparation. If you find errors, please file a GitHub issue that states the paragraph that has to be improved. |
1. Introducción
El single sign-on a la GUI de Checkmk con Kerberos no está soportado oficialmente por Checkmk, pero puedes configurarlo fácilmente tú mismo. Estas instrucciones te mostrarán cómo hacerlo.
Los siguientes requisitos previos deben cumplirse antes de que la configuración en Checkmk pueda modificarse retroactivamente a SSO (Single sign-on) con Kerberos:
La versión de Apache es 2.4 o posterior.
En el servidor Checkmk está instalado el módulo
libapache-mod-auth-kerb
(omod_auth_kerb
en Red Hat Enterprise Linux y CentOS oapache2-mod_auth_kerb
en SUSE).El cliente Kerberos está instalado y configurado en el servidor Checkmk.
Se ha instalado un Keytab -por ejemplo, como
/etc/krb5.keytab
- y el usuario del site puede leerlo.El servidor Checkmk se ha configurado como Servicio Principal.
El navegador del cliente se ha configurado para acceder mediante Kerberos.
Opcional:
Si quieres que los usuarios sin SSO puedan seguir iniciando sesión a través de la página de inicio de sesión normal, se debe activar la autenticación mediante cookies.
2. Integración de Kerberos
Para cambiar Checkmk a la autenticación mediante Kerberos, elimina el archivo ~/etc/apache/conf.d/auth.conf
y reescríbelo. Las entradas que aparecen al principio del contenido del siguiente archivo son sólo ejemplos. Por tanto, modifica todas las líneas que empiecen por la expresión Define
para adaptarlas a tu entorno:
Define SITE MyCheckmkSite
Define REALM MyRealm.org
Define SERVICENAME myservice.mydomain.tld
Define KEYTAB /omd/sites/${SITE}/etc/apache/cmk_http.keytab
<IfModule !mod_auth_kerb.c>
LoadModule auth_kerb_module /usr/lib/apache2/modules/mod_auth_kerb.so
</IfModule>
<Location /${SITE}>
<If "! %{HTTP_COOKIE} =~ /^(.*;)?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 Kerberos
AuthName "Checkmk Kerberos Login"
KrbMethodNegotiate on
KrbMethodK5Passwd off
KrbLocalUserMapping on
# Environment specific: Path to the Keytab, Realm and ServicePrincipal
KrbAuthRealm ${REALM}
KrbServiceName HTTP/${SERVICENAME}@${REALM}
Krb5Keytab ${KEYTAB}
# When Kerberos auth fails, show the login page to the user
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>
# These files are accessible unauthenticated (login page and needed ressources)
<LocationMatch /${SITE}/(omd/|check_mk/(images/.*\.png|login\.py|.*\.(css|js)))>
Order allow,deny
Allow from all
Satisfy any
</LocationMatch>
Una vez ejecutada la configuración de ejemplo mostrada, sólo se permitirán autentificaciones mediante Kerberos. Ahora debes decidir si quieres seguir admitiendo basic auth
con o sin cookies -para usuarios sin SSO, o como alternativa-. Lo que tendrás que configurar para ello se explica en los dos capítulos siguientes.
3. Permitir autenticación básica
Si quieres seguir permitiendo la autenticación a través de basic auth
además del SSO a través de Kerberos, tienes que editar una línea de la configuración anterior.
Para ello, cambia el valor de la siguiente línea a on
:
KrbMethodK5Passwd on
4. Verificar la autenticación mediante cookies
Para que la autenticación sea más cómoda, Checkmk también admite el inicio de sesión mediante una cookie. En un site de Checkmk nuevo y sin modificar, ésta es actualmente la opción por defecto.
Por último, pero no por ello menos importante, deberías comprobar si esta opción de autenticación sigue activada y si debería seguir así.
Puedes comprobar el estado actual de tu site con el siguiente comando:
OMD[mysite]:~$ omd config show MULTISITE_COOKIE_AUTH
Si recibes un valor on
aquí y quieres mantener activada la autenticación de cookies -por ejemplo, como alternativa-, no es necesario hacer nada más en este momento.
Si, por el contrario, quieres desactivar MULTISITE_COOKIE_AUTH
, puedes hacerlo con el siguiente comando:
OMD[mysite]:~$ omd config set MULTISITE_COOKIE_AUTH off
A continuación, elimina el archivo cookie_auth.conf
del directorio Apache del site:
OMD[mysite]:~$ rm ~/etc/apache/conf.d/cookie_auth.conf
5. Diagnóstico
Puedes check con los siguientes comandos, si tu configuración de Kerberos funciona:
root@linux# kinit -p username
root@linux# klist