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

官网: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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

roman_日积跬步-终至千里

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值