Ubuntu上Apache HBase的安全设置清单
一 基础加固与网络边界
sudo ufw enable、sudo ufw default deny incoming、sudo ufw default allow outgoingsudo ufw allow 22/tcp;按实际端口开放,例如:sudo ufw allow 16000:16020/tcp(示例端口范围,请替换为你的配置)sudo ufw status、sudo ufw delete allow 22/tcp二 身份鉴别与访问控制
<property><name>hbase.security.authentication</name><value>kerberos</value></property><property><name>hbase.security.authorization</name><value>true</value></property><property><name>hbase.coprocessor.region.classes</name><value>org.apache.hadoop.hbase.security.token.TokenProvider</value></property>kadmin.local -q "addprinc -randkey hbase/_HOST@REALM"kadmin.local -q "xst -k /etc/security/keytabs/hbase.service.keytab hbase/_HOST@REALM"<property><name>hbase.master.keytab.file</name><value>/etc/security/keytabs/hbase.service.keytab</value></property><property><name>hbase.master.kerberos.principal</name><value>hbase/_HOST@REALM</value></property>hbase.regionserver.keytab.file 与 hbase.regionserver.kerberos.principalkinit 获取票据再访问集群。<property><name>hbase.client.keytab.file</name><value>/path/client.keytab</value></property><property><name>hbase.client.keytab.principal</name><value>client@EXAMPLE.COM</value></property>hbase.security.authentication 必须一致,否则无法通信。hbase.rpc.protection=privacy(可选值:authentication、integrity、privacy;privacy 提供加密,约带来 ~10% 性能开销)。三 授权与最小权限
grant/revoke 授予最小权限:
grant 'alice', 'RW', 'tbl1'(表级读写)grant 'bob', 'R', 'tbl1', 'cf1'(列族级只读)grant 'thrift_server', 'RWCA'hbase.thrift.kerberos.principal、hbase.thrift.dns.interface、hbase.thrift.dns.nameserver)。四 加密与 Web 接口防护
<property><name>hbase.ssl.enabled</name><value>true</value></property>hbase.master.info.port、hbase.regionserver.info.port五 系统与运维安全
ulimit -n(建议 ≥32768)与 nproc(建议 ≥32000)
/etc/security/limits.conf 增加:
hbase soft nofile 32768、hbase hard nofile 32768hbase soft nproc 32000、hbase hard nproc 32000/etc/pam.d/common-session 增加:session required pam_limits.sohbase.regionserver.dns.interface、hbase.regionserver.dns.nameserver