【配置/认证】Authentication for Hadoop(3.3.1) HTTP web-consoles : Hadoop的simple认证 不是银弹

导读:本篇文章讲解 【配置/认证】Authentication for Hadoop(3.3.1) HTTP web-consoles : Hadoop的simple认证 不是银弹,希望对大家有帮助,欢迎收藏,转发!站点地址:www.bmabk.com

官网:Authentication for Hadoop HTTP web-consoles

一. Introduction

可以通过Kerberos、Pseudo或Simple能够实现web页面的安全设置。
本文通过使用user.name的(Simple)方式实现web页面的安全设置:http://localhost:8088/cluster?user.name=babu.

此外我们还可以自定义一个插件实现自己的安全机制,参考AuthenticationHandler

By default Hadoop HTTP web-consoles (ResourceManager,
NameNode, NodeManagers and DataNodes) allow access without any form of authentication.
 
Hadoop HTTP web-consoles can be configured to require Kerberos
authentication using HTTP SPNEGO protocol (supported by browsers like Firefox and Internet Explorer).
 
In addition, Hadoop HTTP web-consoles support the equivalent of
Hadoop’s Pseudo/Simple authentication. If this option is enabled, the
user name must be specified in the first browser interaction using the
user.name query string parameter. e.g.
http://localhost:8088/cluster?user.name=babu.
 
If a custom authentication mechanism is required for the HTTP
web-consoles, it is possible to implement a plugin to support the
alternate authentication mechanism
(refer to Hadoop hadoop-auth for
details on writing an AuthenticationHandler).

 
 

二. Configuration

1. 在每一个hadoop节点配置core-site.xml

The following properties should be in the core-site.xml of all the nodes in the cluster.

<configuration>

    ......//此处省略已有配置


    <!-- Authentication for Hadoop HTTP web-consoles -->
    <property>
            <name>hadoop.http.filter.initializers</name>
            <value>org.apache.hadoop.security.AuthenticationFilterInitializer</value>
    </property>
    <property>
            <name>hadoop.http.authentication.type</name>
            <value>simple</value>
    </property>
    <property>
            <name>hadoop.http.authentication.token.validity</name>
            <value>3600</value>
    </property>
    <property>
            <name>hadoop.http.authentication.signature.secret.file</name>
            <value>/data/app/hadoop/etc/hadoop/secret/hadoop-http-auth-signature-secret</value>
    </property>
    <property>
            <name>hadoop.http.authentication.cookie.domain</name>
            <value></value>
    </property>
    <property>
            <name>hadoop.http.authentication.simple.anonymous.allowed</name>
            <value>false</value>
    </property>
    

    
</configuration>

2.创建密钥

//在每个hadoop 节点都操作
mkdir -p /data/app/hadoop/etc/hadoop/secret
cd /data/app/hadoop/etc/hadoop/secret
echo \"hadoop\" > hadoop-http-auth-signature-secret

3. 重启 hadoop 集群

# 关闭hadoop 集群
cd /data/app/hadoop
./sbin/stop-dfs.sh
./sbin/stop-yarn.sh

# 启动hadoop 集群
cd /data/app/hadoop
./sbin/start-dfs.sh
./sbin/start-yarn.sh

4. 访问示例

http://namenode_ip:18137 出现错误
http://namenode_ip:18137?user.name=hadoop  访问正确

 

三、不是银弹

简单的说,hadoop的simple认证的密钥文件并没有起作用,输入任何认证(例如:http://namenode_ip:18137?user.name=xxxx)都可以进入hadoop界面。

解决方案一

详见其他博主博文:

Hadoop Web 控制台安全认证——使用用户名 + 密码登陆设置方法 (Hadoop HTTP web-控制台认证 )

但似乎tengine要和管理节点(namenode和resourcemanager)放到一个位置,方案有待完善。

 

解决方案二-自定义插件ing

此外我们还可以自定义一个插件实现自己的安全机制,参考AuthenticationHandler

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

文章由半码博客整理,本文链接:https://www.bmabk.com/index.php/post/65372.html

(0)
小半的头像小半

相关推荐

半码博客——专业性很强的中文编程技术网站,欢迎收藏到浏览器,订阅我们!