You are viewing documentation for the development version, it may be incomplete.
Join our translation project and help translate Zabbix documentation into your native language.

13 SAML setup with OneLogin

Vista general

Aquesta secció ofereix directrius per configurar l'inici de sessió únic i el subministrament d'usuaris a Zabbix des de OneLogin mitjançant l'autenticació SAML 2.0.

Configuració de OneLogin

Crear una aplicació

1. Inicieu sessió al vostre compte a OneLogin. Amb finalitats de prova, podeu crear un compte de desenvolupador gratuït a OneLogin.

2. A la interfície web de OneLogin, navegueu a Aplicacions → Aplicacions.

3. Feu clic a "Afegir aplicació" i cerqueu l'aplicació adequada. Les directrius d'aquesta pàgina es basen en l'exemple de l'aplicació SCIM Provisioner amb SAML (SCIM v2 Enterprise, SAML complet).

4. Per començar, és possible que vulgueu personalitzar el nom de visualització de la vostra aplicació. També podeu afegir la icona i els detalls de l'aplicació. Després d'això, feu clic a Desar.

Setting up SSO/SCIM provisioning

1. In Configuration -> Application details, set the Zabbix single sign-on endpoint http://<zabbix-instance-url>/zabbix/index_sso.php?acs as the value of these fields:

  • ACS (Consumer) URL Validator
  • ACS (Consumer) URL

Note the use of "http", and not "https", so that the acs parameter is not cut out in the request.

It is also possible to use "https". To make that work with Zabbix, it is necessary to add to conf/zabbix.conf.php the following line:

$SSO['SETTINGS'] = ['use_proxy_headers' => true];

Leave other options with their default values.

2. In Configuration -> API connection, set the following values:

  • SCIM Base URL: https://<zabbix-instance-url>/zabbix/api_scim.php
  • SCIM JSON Template: should contain all custom attributes that you would like to pass to Zabbix via SCIM such as user_name, user_lastname, user_email, and user_mobile:
{
         "schemas": [
           "urn:ietf:params:scim:schemas:core:2.0:User"
         ],
         "userName": "{$parameters.scimusername}",
         "name": {
           "familyName": "{$user.lastname}",
           "givenName": "{$user.firstname}"
         },
          "user_name": "{$user.firstname}",
          "user_lastname": "{$user.lastname}",
          "user_mobile": "{$user.phone}",
          "user_email": "{$user.email}"
       }

The attribute names are arbitrary. Different attribute names may be used, however, it is required that they match the respective field value in Zabbix SAML settings.

Note that for user provisioning to work, OneLogin needs to receive in response a 'name' attribute with 'givenName' and 'familyName', even if it was not required by the service provider. Thus it is necessary to specify this in the schema in the application configuration part.

  • SCIM Bearer Token: enter a Zabbix API token with Super admin permissions.

Click on Enable to activate the connection.

3. In the Provisioning page, enable the Provisioning option:

4. The Parameters page contains a list of default parameters:

  • Make sure that the 'scimusername' matches the user login value in OneLogin (e.g. email);
  • Mark the Include in User Provisioning option for the 'Groups' parameter;
  • Click on "+" to create the custom parameters that are required for SAML assertions and user provisioning such as user_name, user_lastname, user_email, and user_mobile:

When adding a parameter, make sure to mark both the Include in SAML assertion and Include in User Provisioning options.

  • Add a 'group' parameter that matches user roles in OneLogin. User roles will be passed as a string, separated by a semicolon ;. The OneLogin user roles will be the used for creating user groups in Zabbix:

Verify the list of parameters:

5. In the Rules page, create user role mappings to the default Groups parameter.

You may use a regular expression to pass specific roles as groups. The role names should not contain ; as OneLogin uses it as a separator when sending an attribute with several roles.

Configuració Zabbix

1. A Zabbix, aneu a Configuració SAML i ompliu les opcions de configuració basades en la configuració de OneLogin:

Camp Zabbix Camp de configuració a OneLogin Valor de mostra
ID d'entitat IdP URL de l'emissor
(veieu la pestanya SSO de la vostra aplicació a OneLogin)
URL del servei SSO Punt final SAML 2.0 (HTTP)
(veieu la pestanya SSO de la vostra aplicació a OneLogin)
URL del servei SLO SLO Endpoint (HTTP)
(veieu la pestanya SSO de la vostra aplicació a OneLogin)
Atribut nom d'usuari Paràmetre personalitzat email_usuari
Atribut del nom del grup Paràmetre personalitzat grup
Atribut del nom d'usuari Paràmetre personalitzat nom_usuari
Atribut del cognom de l'usuari Paràmetre personalitzat cognom_usuari

També és necessari per configurar l'assignació de grups d'usuaris. El mapatge de suport és opcional. Feu clic a Actualitzra per desar aquesta configuració.

2. Baixeu el certificat proporcionat per OneLogin i poseu-lo a "conf/certs" de la instal·lació frontal de Zabbix, com a idp.crt.

Establiu-hi permisos 644 executant:

 chmod 644 idp.crt

Podeu accedir a la descàrrega del certificat a OneLogin a Aplicacions -> SSO -> feu clic a Veure els detalls sota el certificat actual.

És possible emprar un nom i una ubicació de certificat diferents. En aquest cas, assegureu-vos d'afegir a conf/zabbix.conf.php la línia següent:

$SSO['IDP_CERT'] = 'path/to/certname.crt';

Aprovisionament d'usuaris SCIM

Amb l'aprovisionament d'usuaris habilitat, ara és possible afegir/actualitzar usuaris i els seus rols a OneLogin i passar-los de seguida a Zabbix.

Per exemple, podeu crear un usuari nou:

Afegir-lo a un rol d'usuari i a l'aplicació que subministrarà l'usuari:

En desar l'usuari, es lliurarà a Zabbix. A Aplicació -> Usuaris podeu comprovar l'estat de subministrament dels usuaris actuals de l'aplicació:

Si s'ha subministrat correctament, l'usuari es pot veure a la llista d'usuaris de Zabbix.