我如何保护hbase?

时间:2012-02-15 21:18:31

标签: hbase

我在ec2上使用hbase,只是意识到我的脚本不使用用户名/密码来访问hbase。有没有办法添加简单的用户名/密码验证?

更新:对像mysql这样的快速/脏事感兴趣,可以创建用户名和授予权限。

1 个答案:

答案 0 :(得分:2)

如果您不想使用Kerberos路由(这是最好的事情),并且您的HBase请求是从一个点(如应用程序服务器) ),您始终可以尝试限制与Zookeeper客户端的IP连接。

默认情况下,zookeeper客户端端口为2181(例如,请参阅http://blog.cloudera.com/blog/2013/07/guide-to-using-apache-hbase-ports/)。

一种简单的方法是使用iptables functionnality(如果你运行linux),使用类似的东西:

iptables -A INPUT -i lo -m comment --comment "enable loopback connections" -j ACCEPT
# use the actual range of IPs that includes all of your cluster's nodes
iptables -A INPUT -p tcp --destination-port 2181 -m iprange --src-range '174.121.3.0-174.121.3.10' -j ACCEPT
iptables -A INPUT -p tcp --destination-port 2181 -j DROP -m comment --comment "Disable tcp trafic toward port 2181 (zookeeper)"
# Export result so what it can be restored on reboot with iptables-restore < /etc/iptablesv4.conf (put it in something like /etc/rc.d/rc.local)
iptables-save > /etc/iptablesv4.conf

您需要在群集的每个节点上执行此操作,因为HBase客户端将找到任何可用的zookeeper端点以成功建立连接。