20. Hue. Установка и настройка
Использованные материалы
Добавление сервиса Hue
- В консоли Cloudera Manager в меню выбираем ‘Add Service’:
Перенастройка размещения log’ов
- В настройках Hue, используя категорию ‘Logs’, изменяем следующие параметры, добавляя ‘/data’ вместо ‘/var’:
Property | Value | Description |
---|---|---|
Hue Server Log Directory | /data/log/hue |
Directory where Hue Server will place its log files. |
Kerberos Ticket Renewer Log Directory | /data/log/hue |
Directory where Kerberos Ticket Renewer will place its log files. |
Hue Load Balancer Log Directory | /data/log/hue-httpd |
Directory where Hue Load Balancer will place its log files. |
- Нажимаем Save Changes.
4. Настройка TLS для Hue
Hue как клиент TLS
Hue действует как клиент TLS при взаимодействии с другими сервисами, такими как Hadoop, HBase, Oozie и Amazon S3. Это означает, что Hue должен аутентифицировать демонов HDFS, MapReduce, YARN, сервер HBase Thrift и т. Д. Для этого Hue нужны цепочки сертификатов их хостов в своем хранилище доверенных сертификатов. Хранилище доверенных сертификатов Hue - это один файл PEM, содержащий корень CA и все промежуточные сертификаты для аутентификации сертификата, установленного на каждом сервере с поддержкой TLS. На этих серверах размещаются различные службы, с которыми общается Hue. Примечание. Сертификат зависит от хоста. Он подписан центром сертификации (CA) и сообщает запрашивающему клиенту (Hue), что «этот хост» является тем же, что представлен открытым ключом хоста. Hue использует цепочку подписывающих центров в своем хранилище доверенных сертификатов для проверки ЦС, подписавшего сертификат хоста.
4.1. Создание Hue Truststore File в PEM формате
Сертификаты сервера хранятся в формате JKS и должны быть преобразованы в PEM. Чтобы создать хранилище доверенных сертификатов Hue, извлеките каждый сертификат из хранилища ключей с помощью keytool, преобразуйте его в формат PEM с помощью openssl и добавьте в хранилище доверенных сертификатов.
Этот шаг уже выполнен при раскидывании ключей и сертификатов с помощью ансибль-плэйбука cloudera_setup_tls.
4.2. Enabling TLS/SSL for the Hue Server with Cloudera Manager
- В настройках службы Hue, используя фильтр ‘TLS’, изменяем следующие параметры:
Property | Value | Description |
---|---|---|
Enable LDAP TLS use_start_tls |
☐ | If true, attempts to establish a TLS (Transport Layer Security) connection with an LDAP server that was specified with ldap://. Not required when using an LDAP URL with prefix ldaps://, because that already specifies TLS. This option is also known as "Use StartTLS". |
Enable TLS/SSL for Hue | ☑ | Encrypt communication between clients and Hue with TLS/SSL. |
Hue TLS/SSL Server Certificate File (PEM Format) ssl_certificate |
/opt/cloudera/security/pki/agent.pem |
Path to TLS/SSL certificate on host running Hue web server. |
Hue TLS/SSL Server Private Key File (PEM Format) ssl_private_key |
/opt/cloudera/security/pki/agent.key |
Path to TLS/SSL private key on host running Hue web server. |
Hue TLS/SSL Private Key Password ssl_password |
По умолчанию: changeit. | Password for private key in Hue TLS/SSL Server Certificate and Private Key file. |
You can also store ssl_password more securely in a script and set this parameter instead:
ssl_password_script=<your_hue_passwords_script.sh>
For more, see Storing Hue Passwords in a Script.
To apply this configuration property to other role groups as needed, edit the value for the appropriate role group. See Modifying Configuration Properties Using Cloudera Manager.
- Нажимаем Save Changes.
4.3. Настройка Hue, как TLS клиент
- В настройках службы Hue изменяем следующий параметр:
Property | Value | Description |
---|---|---|
Hue TLS/SSL Server CA Certificate (PEM Format) ssl_cacerts |
/etc/ipa/ca.crt | The path to the TLS/SSL file containing the certificate of the certificate authority (CA) and any intermediate certificates used to sign the server certificate. Used when Hue is acting as a TLS/SSL server. The certificate file must be in PEM format, and is usually created by concatenating all of the appropriate root and intermediate certificates. |
- Нажимаем Save Changes.
4.4. Включение TLS для Hue Load Balancer
Чтобы настроить балансировщик нагрузки Hue для использования HTTPS или для работы в качестве сервера TLS, вам потребуется самозаверяющий сертификат SSL и файл закрытого ключа. Если файл закрытого ключа защищен паролем, вам необходимо настроить Hue Load Balancer на использование соответствующего ключевого пароля.
- В настройках службы Hue изменяем следующие параметры:
Property | Value | Description |
---|---|---|
Hue Load Balancer TLS/SSL Server Certificate File (PEM Format) SSLCertificateFile |
/opt/cloudera/security/pki/agent.pem |
The path to the TLS/SSL file containing the server certificate key used for TLS/SSL. Used when Hue Load Balancer is acting as a TLS/SSL server. The certificate file must be in PEM format. |
Hue Load Balancer TLS/SSL Server Private Key File (PEM Format) SSLCertificateKeyFile |
/opt/cloudera/security/pki/agent.key |
The path to the TLS/SSL file containing the private key used for TLS/SSL. Used when Hue Load Balancer is acting as a TLS/SSL server. The certificate file must be in PEM format. |
Hue Load Balancer TLS/SSL Server SSLPassPhraseDialog SSLPassPhraseDialog |
/opt/cloudera/security/pki/tls_key.pass |
The path to the file containing the passphrase used to encrypt the private key of the Hue Load Balancer server. The passphrase file is optional. |
- Нажимаем Save Changes.
4.5. Включение TLS связи Hue с HiveServer2
В CDH 5.5.x и более поздних версиях HiveServer2 по умолчанию включен для связи TLS.
Чтобы обеспечить связь между Hue и HiveServer2 с использованием TLS, Hue требуется сертификат Hive и цепочка сертификатов.
- В настройках службы Hue ищем “Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini” и добавляем сюда:
[beeswax] [[ssl]] #enabled=true # Эта опция отсутствует в исходниках # https://github.com/cloudera/hue/blob/master/apps/beeswax/src/beeswax/conf.py#L251 cacerts=/etc/ipa/ca.crt validate=true
- Нажимаем Save Changes.
- Перезапускаем все зависимые сервисы по приглашению Cloudera Manager Console.
4.7. Securing Database Connections using TLS/SSL
Hue использует разных клиентов для внутренней связи с каждой базой данных. Параметры для конкретного клиента, такие как безопасное соединение, можно настроить с помощью Cloudera Manager.
Не понял этот шаг. Позже разберёмся.
Настройка LDAP-аутентификации в Cloudera Hue
- В настройках службы Hue изменяем следующие параметры:
Property | Value | Description |
---|---|---|
Hue Service Advanced Configuration Snippet (Safety Valve) for hue_safety_valve.ini |
|
Обновление участников локальных групп участниками групп из FreeIPA при попытке входа.
Для новых пользовательских каталогов в HDFS устанавливать режим 750, вместо дефолтного 755. Режим 750 будет препятствовать импорту данных в Hive-таблицу из файла. При импорте средствами Hue, создаётся каталог /user/dmr/.scratchdir с правами 777, куда копируется файл перед его импортом. Но hive не сможет этот файл прочесть, так как на родительском каталоге установлен режим 750. И что делать? |
Hue Server Advanced Configuration Snippet (Safety Valve) for hive-site.xml |
Nama: hive.server2.authentication
Value: KERBEROS (Обязательно (?) заглавными буквами, иначе случалось, что добавление ролей, списки существующих ролей, какая-то ещё информация была недоступна.) |
Иначе при входе в Hue высвечивается ошибка:⚠Bad status: 3 (PLAIN auth failed: javax.security.sasl.AuthenticationException: Error validating LDAP user [Caused by javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]]) (code THRIFTTRANSPORT): TTransportException(‘Bad status: 3 (PLAIN auth failed: javax.security.sasl.AuthenticationException: Error validating LDAP user [Caused by javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]])’,) |
- В настройках службы Hue, используя категорию ‘Security’, изменяем следующие параметры:
Property | Value | Description |
---|---|---|
Authentication Backend backend |
desktop.auth.backend.LdapBackend | Mode of authenticating login credentials. Select desktop.auth.backend.LdapBackend to use LDAP to authenticate login credentials. LDAP requires you to also set the LDAP URL, Active Directory Domain, and optionally LDAP certificate if you are using secure LDAP. Select desktop.auth.backend.PamBackend to use PAM to authenticate login credentials. |
LDAP URL ldap_url |
ldaps://dev-ipa01p.test.lan ldaps://dev-ipa02p.test.lan ldaps://dev-ipa03p.test.lan Адреса IPA разделённые пробелом в одну строку. |
The URL of the LDAP server. The URL must be prefixed with ldap:// or ldaps://. The URL can optionally specify a custom port, for example: ldaps://ldap_server.example.com:1636. Note that usernames and passwords will be transmitted in the clear unless either an ldaps:// URL is used, or "Enable LDAP TLS" is turned on (where available). Also note that encryption must be in use between the client and this service for the same reason.
For more detail on the LDAP URL format, see RFC 2255 . A space-separated list of URLs can be entered; in this case the URLs will each be tried in turn until one replies. |
LDAP Server CA Certificate ldap_cert |
/etc/ipa/ca.crt |
The location on disk of the certificate, in .pem format, used to confirm the authenticity of the LDAP server certificate. This is the Certificate Authority (CA) certificate, and it was used to sign the LDAP server certificate. If not set, all certificates are trusted, which means that an attacker could potentially intercept otherwise encrypted usernames and passwords. |
Enable LDAP TLS use_start_tls |
☐ Отключаем StartTLS, так как используем |
If true, attempts to establish a TLS (Transport Layer Security) connection with an LDAP server that was specified with ldap://. Not required when using an LDAP URL with prefix ldaps://, because that already specifies TLS. This option is also known as "Use StartTLS". |
LDAP Username Pattern ldap_username_pattern |
uid= |
LDAP Username Pattern for use with non-Active Directory LDAP implementations. Must contain the special ' |
Use Search Bind Authentication search_bind_authentication |
☑ | Search Bind Authentication connects to the LDAP server using credentials provided in the 'bind_dn' and 'bind_password' configurations. If these configurations are not set, then an anonymous search is performed. |
Create LDAP users on login create_users_on_login |
☑ | Create users in Hue when they try to login with their LDAP credentials. For use when using LdapBackend for Hue authentication. |
LDAP Search Base base_dn |
cn=accounts, dc=example,dc=org |
The distinguished name to use as a search base for finding users and groups. This should be similar to 'dc=hadoop,dc=mycompany,dc=com'. |
LDAP Bind User Distinguished Name bind_dn |
uid=binddn_cluser1,cn=sysaccounts, cn=etc,dc=example,dc=org В одну строку. |
Distinguished name of the user to bind as. This is used to connect to LDAP/AD for searching user and group information. This may be left blank if the LDAP server supports anonymous binds. |
LDAP Bind Password bind_password |
********** | The password of the bind user. |
LDAP Username for Test LDAP Configuration test_ldap_user |
dmr | An optional user name for validating LDAP user configurations. If a test user name is provided, Hue's LDAP library uses it as a search parameter when running the command, Test Hue LDAP Configuration (under Hue > Actions). For example, (&(objectClass=*)(sAMAccountName=test_ldap_user)). If "*" is provided, then all user attributes are returned. If test user name is not provided then Test Hue LDAP Configuration action will check only LDAP server connectivity. |
LDAP Group Name for Test LDAP Configuration test_ldap_group |
cluster1_hue_users | An optional group name for validating LDAP group configurations. If a test group name is provided, Hue's LDAP library uses it as a search parameter when running the command, Test Hue LDAP Configuration (under Hue > Actions). For example, (&(objectClass=*)(sAMAccountName=test_ldap_group)). If test group name is not provided then Hue LDAP Configuration action will check only LDAP server connectivity. |
LDAP User Filter user_filter |
(&(objectClass=person)(memberOf=cn=cluster1_hue_*, cn=groups,cn=accounts,dc=example,dc=org)) В одну строку. |
The base filter for searching for users. For Active Directory, this is typically '(objectClass=user)'.
В Hue будут допущены только участники групп cluster1_hue_admins, cluster1_hue_users, etc. В том числе участники вложенных групп. |
LDAP Username Attribute user_name_attr |
uid | The username attribute in the LDAP schema. For Active Directory, this is typically 'sAMAccountName'. |
LDAP Group Filter group_filter |
(objectClass=ipausergroup) | Base filter for searching for groups. For Active Directory, this is typically '(objectClass=group)'. |
LDAP Group Name Attribute group_name_attr |
cn | The group name attribute in the LDAP schema. For Active Directory, this is typically 'cn'. |
LDAP Group Membership Attribute group_member_attr |
member | The attribute of the group object that identifies the members of the group. For Active Directory, this is typically 'member'. |
- Нажимаем Save Changes.
- Перезапускаем все зависимые сервисы по приглашению Cloudera Manager Console.
- Во FreeIPA создаём необходимые группы для аутентификации в Hue. Авторизация к таблицам будет обеспечиваться с помощью Sentry, через WEB UI сервиса Hue.
$ ADM_USER='dmr' \ ADM_PASS='JL9d]qtw$p=2=M2K=~z?|EU,1' \ CL_NAME="CLUSTER1" # UPPERCASE \ CL_NAME_L=${CL_NAME,,} # lowercase $ ansible mgm -i cluster.inv -m shell -a "echo '${ADM_PASS}' | kinit ${ADM_USER} && \ ipa group-add --desc='Hue admins for cluster ${CL_NAME}' ${CL_NAME_L}_hue_admins" $ ansible mgm -i cluster.inv -m shell -a "echo '${ADM_PASS}' | kinit ${ADM_USER} && \ ipa group-add --desc='Hue users for cluster ${CL_NAME}' ${CL_NAME_L}_hue_users"
- Создаём администраторскую роль:
Enabling SPNEGO as an Authentication Backend for Hue (обычно не требуется)
- In Cloudera Manager, set the authentication backend to SpnegoDjangoBackend.
- Go to the Cloudera Manager Admin Console. From the Clusters tab, select the Hue service.
- Click the Configuration tab.
- Select Scope > Service-Wide.
- Select Category > Security.
- Locate the Authentication Backend property and select desktop.auth.backend.SpnegoDjangoBackend.
- Click Save Changes.
- Restart the Hue service.
Так как Hue был переключён на SPNEGO, то я зашёл в его WEB UI без пароля через Firefox и Chromium, настроенными на kerberos. В HDFS появилась папка /home/dmr.
⚠
При переключении Hue на SPNEGO высветилась ошибка:
General Error(s)
- Role is missing Kerberos keytab. Go to the Kerberos Credentials page and click the Generate Missing Credentials button.
После перезапуска кластера, всё в норме.
Прочие настройки
- В настройках службы Hue изменяем следующие параметры:
Property | Value | Description |
---|---|---|
Time Zone time_zone |
Hue (Service-Wide)
Europe/Moscow |
Time zone name. |
Top Banner Custom HTML banner_top_html |
TEST1 cluster |
An optional, custom one-line HTML code to display as a banner on top of all Hue Server web pages. Useful in displaying cluster identity of the Hue Server. |
Secret Key secret_key |
Hue Server Default Group 2]<,OXrfT!7AxuYw}\g0LZz#@76J%t Рекомендованная длина этой строки из случайных смиволов равна от 30 до 60. |
Random string used for secure hashing in the session store. |