Cassandra文档学习(五:Security)

Securing Cassandra

Cassandra向开源社区提供了4种安全机制:

内部认证 (Internal authentication)

认证配置:若想要配置Cassandra的内部认证机制,需要修改Cassandra.yaml文档的authenticator属性设置并且增加system_auth keyspace的replication factor,如下所述:使用默认的用户名密码(cassandra/cassandra)启动Cassandra,创建一个新的超级用户。(单点安装的话不需要修改复制因子的个数)

  1. authenticator: PasswordAuthenticator
  2. 重启Cassandra
  3. 用默认的用户名密码登录
  4. 为system_auth增加replication factor数,如果是多数据中心,确保使用NetworkTopologyStrategy,ALTER KEYSPACE “system_auth” WITH REPLICATION = {‘class’ : ‘NetworkTopologyStrategy’, ‘dc1’ : 3,’dc2’ : 2};注意:当认证默认Cassandra用户是,system_auth keyspace 使用 QUORUM 一致性,而对于其他用户,认证时都是使用 LOCAL ONE一致性水平。
  5. nodetool repair system_auth ,保证修改在节点间进行传播
  6. 重启Cassandra
  7. 使用默认用户名密码登录cqlsh
  8. 创建新的超级用户:CREATE ROLE WITH PASSWORD=’’ AND SUPERUSER = true AND LOGIN = true;
  9. 使用新用户登录
  10. 因为默认的Cassandra用户是没办法删除的,所以我们需要修改其密码和权限以避免安全隐患。
  11. 现在你可以给你的角色授予访问数据库对象的权限了。
  12. 读取角色权限是一个花费内存的操作,roles可以被缓存从而降低内存负担。调整一下属性:roles_validity_in_ms: 2000
  13. roles caches的定期刷新:roles_update_interval_in_ms: 2000
  14. 读取 credentials authentication也是损耗内存:validity_in_ms: 2000
  15. credentials_update_interval_in_ms: 2000
    using cqlsh with authentication:平时我们登录时都需要使用 -u-p ,配置一下内容,可以直接登录
  16. 创建或者修改cqlshrc文件:[authentication] username = fred
    password = !!bang!!
  17. 保存文件至home.cassandra directory and name it cqlshrc,where home is set by the user’s HOME/USERPROFILE environmental variable。
  18. 为该文件设置权限避免密码被修改:C:>chmod 440 home.cassandra\cqlshrc
  19. 检查 home.cassandra\cqlshrc_history确保密码是否可以被修改(compromised).

内部授权(internal authorization)

使用Cassandra的内部授权可以指定一下对象的权限:

  1. keyspace
  2. table
  3. function
  4. aggregate
  5. roles
  6. MBeans
    配置内部授权:
  7. authorizer:CassandraAuthorizer
  8. 增加system_auth keyspace的replication factor数
  9. 修改配置:permissions_validity_in_ms: 2000
  10. permissions_update_interval_in_ms: 2000

JMX Authentication and Authorization

TODO

SSL encryption

TODO

Configuring firewall port access

必须开放以下端口来允许节点间的双向沟通:
Table: Public port
Port number Description
22 SSH port
Table: Cassandra inter-node ports
Port number Description
7000 Cassandra inter-node cluster communication.
7001 Cassandra SSL inter-node cluster communication.
7199 Cassandra JMX monitoring port.
Table: Cassandra client ports
Port number Description
9042 Cassandra client port.
9160 Cassandra client port (Thrift).
9142 Default for native_transport_port_ssl, useful when both encrypted and unencrypted connections a

Configuring gossip settings

TODO

Configuring the heap dump directory

TODO

Configuring virtual nodes

TODO

Using multiple network interfaces

TODO

Configuring the snitch for multiple networks

TODO

Configuring the snitch for cross-region communication in cloud inplementations

TODO

Configuring logging

TODO

Commitlog archive configuration

TODO

Generating tokens

TODO

Hadoop support

TODO

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值