[comment]: # translation:outdated

[comment]: # ({cee0eb99-cee0eb99})
# 3 Autenticação
[comentário]: # (tags: ldap, saml)

[comment]: # ({/cee0eb99-cee0eb99})

[comment]: # ({9217fb1a-9217fb1a})
### Visão geral

A seção *Administração → Autenticação* permite especificar o
método de autenticação de usuário global para Zabbix e senha interna
requisitos. Os métodos disponíveis são internos, HTTP, LDAP e SAML
autenticação.

[comment]: # ({/9217fb1a-9217fb1a})

[comment]: # ({0e754ffa-0e754ffa})
### Autenticação padrão

Por padrão, o Zabbix usa autenticação interna do Zabbix para todos os usuários. Isto
é possível alterar o método padrão para [LDAP](#ldap_authentication)
em todo o sistema ou ative a autenticação LDAP apenas para grupos de usuários específicos.

Para definir o LDAP como método de autenticação padrão para todos os usuários, navegue até
a guia *LDAP* e configure os parâmetros de autenticação, depois volte para
a guia *Autenticação* e alterne o seletor *Autenticação padrão* para
LDAP.

Observe que o método de autenticação pode ser ajustado no [user
group](/manual/config/users_and_usergroups/usergroup). Ainda que
A autenticação LDAP está definida globalmente, alguns grupos de usuários ainda podem ser
autenticado pelo Zabbix. Esses grupos devem ter [frontend
access](/manual/config/users_and_usergroups/usergroup#configuration) set
para Interno. Vice-versa, se a autenticação interna for usada globalmente,
Os detalhes de autenticação LDAP podem ser especificados e usados para usuários específicos
grupos cujo [frontend
access](/manual/config/users_and_usergroups/usergroup#configuration) é
definido como LDAP. Se um usuário estiver incluído em pelo menos um grupo de usuários com
autenticação LDAP, este usuário não poderá usar
Método de autenticação.

[HTTP](#http_authentication) e [SAML 2.0](#saml_authentication)
métodos de autenticação podem ser usados além do padrão
Método de autenticação.

[comment]: # ({/0e754ffa-0e754ffa})

[comment]: # ({new-d3760aa9})
##### LDAP

Um servidor LDAP externo pode ser utilizado para verificar os nomes e
senhas dos usuários. Observe que o usuário deverá ser cadastrado no
servidor LDAP e no Zabbix e que o campo de **senha** do perfil de
usuário não estará mais disponível.

A autenticação LDAP do Zabbix funciona tanto com o Microsoft Active
Directory quanto com o OpenLDAP.

![](../../../../../assets/en/manual/web_interface/frontend_sections/administration/auth_ldap.png)

Parâmetros de configuração:

|Parâmetro|Descrição|
|----------|-----------|
|*Servidor LDAP*|Nome do servidor LDAP. Por exemplo: ldap://ldap.zabbix.com<br>Para conexão segura ao LDAP use o protocolo *ldaps*.<br>ldaps://ldap.zabbix.com|
|*Porta*|Porta do servidor LDAP. O padrão é 389.<br>Para o LDAP seguro a porta padrão costuma ser 636.|
|*Base DN*|Caminho base para pesquisar contas de usuário:<br>ou=Users,ou=system (para o OpenLDAP),<br>DC=company,DC=com (para o Microsoft Active Directory)|
|*Atributo de pesquisa*|Atributo de conta LDAP utilizado na pesquisa:<br>uid (para o OpenLDAP),<br>sAMAccountName (para o Microsoft Active Directory)|
|*Bind DN*|Conta LDAP para conexão e pesquisa no servidor LDAP, exemplos:<br>uid=ldap\_search,ou=system (para o OpenLDAP),<br>CN=ldap\_search,OU=user\_group,DC=company,DC=com (para o Microsoft Active Directory)<br><br>Obrigatório, conexão anônima não é suportada.|
|*Senha para o bind*|Senha da conta de BIND no LDAP.|
|*Teste de autenticação*|Cabeçalho para a seção de teste|
|*Login*|Nome de um usuário de teste (que esteja atualmente conectado à interface web do Zabbix). Este nome de usuário deverá existir no servidor LDAP.<br>O Zabbix não irá ativar a autenticação LDAP sem antes conseguir testar um usuário.|
|*Senha do usuário*|Senha do usuário de teste no LDAP.|

::: notetip
É recomendável criar uma conta em separado para o
processo de conexão (*Bind DN*) que possua o mínimo de privilégios
possível no LDAP ao invés de utilizar uma conta real de usuário
(utilizada para se autenticar na interface web do Zabbix).\
Esta abordagem proê mais segurança e não requer mudança na *Senha para o
Bind* quando as contas de usuário mudarem suas próprias senhas no
servidor LDAP.
:::

::: notetip
Alguns grupos de usuários podem continuar sendo
autenticados internamente no Zabbix. Estes grupos precisam ter o campo
[acesso à interface
web](/pt/manual/config/users_and_usergroups/usergroup#configuration)
definido como interno.
:::

[comment]: # ({/new-d3760aa9})

[comment]: # ({new-096ce00b})
##### HTTP

A autenticação baseada em Apache (HTTP) pode ser utilizada para
verificar nomes e senhas. Assim como na autenticação LDAP o usuário
precisará existir no Zabbix também, e a senha do Zabbix não será
utilizada.

::: noteimportant
Atenção! Certifique-se de que a autenticação
apache esteja correta e funcional antes de alterar para este modo de
autenticação.
:::

::: noteclassic
No caso da autenticação apache todos os usuário (mesmo os
com o [acesso à interface
web](/pt/manual/config/users_and_usergroups/usergroup#configuration)
definido como interno) serão autorizados somente pelo
apache!
:::

[comment]: # ({/new-096ce00b})

[comment]: # ({new-b032eddc})
### LDAP authentication

External LDAP authentication can be used to check user names and
passwords. Note that a user must exist in Zabbix as well, however its
Zabbix password will not be used.

Zabbix LDAP authentication works at least with Microsoft Active
Directory and OpenLDAP.

![](../../../../../assets/en/manual/web_interface/frontend_sections/administration/auth_ldap.png)

Configuration parameters:

|Parameter|Description|
|---------|-----------|
|*Enable LDAP authentication*|Mark the checkbox to enable LDAP authentication.|
|*LDAP host*|Name of LDAP server. For example: ldap://ldap.zabbix.com<br>For secure LDAP server use *ldaps* protocol.<br>ldaps://ldap.zabbix.com<br>With OpenLDAP 2.x.x and later, a full LDAP URI of the form ldap://hostname:port or ldaps://hostname:port may be used.|
|*Port*|Port of LDAP server. Default is 389.<br>For secure LDAP connection port number is normally 636.<br>Not used when using full LDAP URIs.|
|*Base DN*|Base path to search accounts:<br>ou=Users,ou=system (for OpenLDAP),<br>DC=company,DC=com (for Microsoft Active Directory)|
|*Search attribute*|LDAP account attribute used for search:<br>uid (for OpenLDAP),<br>sAMAccountName (for Microsoft Active Directory)|
|*Bind DN*|LDAP account for binding and searching over the LDAP server, examples:<br>uid=ldap\_search,ou=system (for OpenLDAP),<br>CN=ldap\_search,OU=user\_group,DC=company,DC=com (for Microsoft Active Directory)<br>Anonymous binding is also supported.|
|*Case-sensitive login*|Unmark the checkbox to disable case-sensitive login (enabled by default) for usernames.<br>E.g. disable case-sensitive login and log in with, for example, 'ADMIN' user even if the Zabbix user is 'Admin'.<br>*Note* that with case-sensitive login disabled the login will be denied if multiple users exist in Zabbix database with similar usernames (e.g. Admin, admin).|
|*Bind password*|LDAP password of the account for binding and searching over the LDAP server.|
|*Test authentication*|Header of a section for testing|
|*Login*|Name of a test user (which is currently logged in the Zabbix frontend). This user name must exist in the LDAP server.<br>Zabbix will not activate LDAP authentication if it is unable to authenticate the test user.|
|*User password*|LDAP password of the test user.|

::: notewarning
In case of trouble with certificates, to make a
secure LDAP connection (ldaps) work you may need to add a
`TLS_REQCERT allow` line to the /etc/openldap/ldap.conf configuration
file. It may decrease the security of connection to the LDAP
catalog.
:::

::: notetip
It is recommended to create a separate LDAP account
(*Bind DN*) to perform binding and searching over the LDAP server with
minimal privileges in the LDAP instead of using real user accounts (used
for logging in the Zabbix frontend).\
Such an approach provides more security and does not require changing
the *Bind password* when the user changes his own password in the LDAP
server.\
In the table above it's *ldap\_search* account name.
:::

[comment]: # ({/new-b032eddc})

[comment]: # ({new-cc7ae197})
### SAML authentication

SAML 2.0 authentication can be used to sign in to Zabbix. Note that a
user must exist in Zabbix, however, its Zabbix password will not be
used. If authentication is successful, then Zabbix will match a local
username with the username attribute returned by SAML.

::: noteclassic
 If SAML authentication is enabled, users will be able to
choose between logging in locally or via SAML Single Sign-On.

:::

[comment]: # ({/new-cc7ae197})

[comment]: # ({new-6700a0b3})
#### Setting up the identity provider

In order to work with Zabbix, a SAML identity provider
([onelogin.com](https://onelogin.com), [auth0.com](https://auth0.com),
[okta.com](https://okta.com), etc.) needs to be configured in the
following way:

-   *Assertion Consumer URL* should be set to
    `<path_to_zabbix_ui>/index_sso.php?acs`
-   *Single Logout URL* should be set to
    `<path_to_zabbix_ui>/index_sso.php?sls`

`<path_to_zabbix_ui>` examples: %% <https://example.com/zabbix/ui>,
<http://another.example.com/zabbix>,
<http://><any\_public\_ip\_address>/zabbix %%

[comment]: # ({/new-6700a0b3})

[comment]: # ({new-be70e1a1})
#### Setting up Zabbix

::: noteimportant
It is required to install php-openssl if you want
to use SAML authentication in the frontend.
:::

To use SAML authentication Zabbix should be configured in the following
way:

1\. Private key and certificate should be stored in the
*ui/conf/certs*/, unless custom paths are provided in
[zabbix.conf.php](authentication#advanced_settings).

By default, Zabbix will look in the following locations:

-   ui/conf/certs/sp.key - SP private key file
-   ui/conf/certs/sp.crt - SP cert file
-   ui/conf/certs/idp.crt - IDP cert file

2\. All of the most important settings can be configured in the Zabbix
frontend. However, it is possible to specify additional settings in the
[configuration file](authentication#advanced_settings).

![](../../../../../assets/en/manual/web_interface/frontend_sections/administration/auth_saml.png)

Configuration parameters, available in the Zabbix frontend:

|Parameter|Description|
|---------|-----------|
|*Enable SAML authentication*|Mark the checkbox to enable SAML authentication.|
|*IDP entity ID*|The unique identifier of SAML identity provider.|
|*SSO service URL*|The URL users will be redirected to when logging in.|
|*SLO Service URL*|The URL users will be redirected to when logging out. If left empty, the SLO service will not be used.|
|// Username attribute//|SAML attribute to be used as a username when logging into Zabbix.<br>List of supported values is determined by the identity provider.<br><br>Examples:<br>uid<br>userprincipalname<br>samaccountname<br>username<br>userusername<br><urn:oid:0.9.2342.19200300.100.1.1><br><urn:oid:1.3.6.1.4.1.5923.1.1.1.13><br><urn:oid:0.9.2342.19200300.100.1.44>|
|*SP entity ID*|The unique identifier of SAML service provider.|
|*SP name ID format*|Defines which name identifier format should be used.<br><br>Examples:<br><urn:oasis:names:tc:SAML:2.0:nameid-format:persistent><br><urn:oasis:names:tc:SAML:2.0:nameid-format:transient><br><urn:oasis:names:tc:SAML:2.0:nameid-format:kerberos><br><urn:oasis:names:tc:SAML:2.0:nameid-format:entity>|
|*Sign*|Mark the checkboxes to select entities for which SAML signature should be enabled:<br>*Messages*<br>*Assertions*<br>*AuthN requests*<br>*Logout requests*<br>*Logout responses*|
|*Encrypt*|Mark the checkboxes to select entities for which SAML encryption should be enabled:<br>*Assertions*<br>*Name ID*|
|*Case-sensitive login*|Mark the checkbox to enable case-sensitive login (disabled by default) for usernames.<br>E.g. disable case-sensitive login and log in with, for example, 'ADMIN' user even if the Zabbix user is 'Admin'.<br>*Note* that with case-sensitive login disabled the login will be denied if multiple users exist in Zabbix database with similar usernames (e.g. Admin, admin).|

[comment]: # ({/new-be70e1a1})

[comment]: # ({new-be372f8e})
##### Advanced settings

Additional SAML parameters can be configured in the Zabbix frontend
configuration file (*zabbix.conf.php*):

-   $SSO\['SP\_KEY'\] = '<path to the SP private key file>';
-   $SSO\['SP\_CERT'\] = '<path to the SP cert file>';
-   $SSO\['IDP\_CERT'\] = '<path to the IDP cert file>';
-   $SSO\['SETTINGS'\]

::: noteclassic
 Zabbix uses [OneLogin's SAML PHP
Toolkit](https://github.com/onelogin/php-saml/tree/3.4.1) library
(version 3.4.1). The structure of $SSO\['SETTINGS'\] section should be
similar to the structure used by the library. For the description of
configuration options, see official library
[documentation](https://github.com/onelogin/php-saml/tree/3.4.1/#user-content-settings).

:::

Only the following options can be set as part of $SSO\['SETTINGS'\]:

-   *strict*
-   *baseurl*
-   *compress*
-   *contactPerson*
-   *organization*
-   *sp* (only options specified in this list)
    -   *attributeConsumingService*
    -   *x509certNew*
-   *idp* (only options specified in this list)
    -   *singleLogoutService* (only one option)
        -   *responseUrl*
    -   *certFingerprint*
    -   *certFingerprintAlgorithm*
    -   *x509certMulti*
-   *security* (only options specified in this list)
    -   *signMetadata*
    -   *wantNameId*
    -   *requestedAuthnContext*
    -   *requestedAuthnContextComparison*
    -   *wantXMLValidation*
    -   *relaxDestinationValidation*
    -   *destinationStrictlyMatches*
    -   *rejectUnsolicitedResponsesWithInResponseTo*
    -   *signatureAlgorithm*
    -   *digestAlgorithm*
    -   *lowercaseUrlencoding*

All other options will be taken from the database and cannot be
overridden. The *debug* option will be ignored.

In addition, if Zabbix UI is behind a proxy or a load balancer, the
custom *use\_proxy\_headers* option can be used:

-   *false* (default) - ignore the option;
-   *true* - use X-Forwarded-\* HTTP headers for building the base URL.

**Configuration example:**

    $SSO['SETTINGS'] = [
        'security' => [
            'signatureAlgorithm' => 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha384'
            'digestAlgorithm' => 'http://www.w3.org/2001/04/xmldsig-more#sha384',
            // ...
        ],
        // ...
    ];

[comment]: # ({/new-be372f8e})

[comment]: # ({new-2e5c6dcf})

##### Frontend configuration with Kerberos/ADFS

The Zabbix frontend configuration file (*zabbix.conf.php*) can be used to configure SSO with Kerberos authentication and ADFS:

```php
$SSO['SETTINGS'] = [
    'security' => [
        'requestedAuthnContext' => [
            'urn:oasis:names:tc:SAML:2.0:ac:classes:Kerberos',
        ],
        'requestedAuthnContextComparison' => 'exact'
    ]
]; 
```

In this case, in the SAML configuration *SP name ID* field set:

    urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified

[comment]: # ({/new-2e5c6dcf})
