【问题标题】:How restrict users to access only system table in cassandra如何限制用户只能访问 cassandra 中的系统表
【发布时间】:2017-06-20 08:16:09
【问题描述】:

我们有一个用例,我们创建一个用户并提供对所有键空间的 CREATE、ALTER、SELECT、MODIFY 和 AUTHORIZE 权限,因为它们可以创建键空间并在需要时删除它们。但是,我们希望限制用户对系统密钥空间进行任何更改。

LIST ALL PERMISSIONS OF test;

 role | username | resource        | permission
------+----------+-----------------+------------
 test |     test | <all keyspaces> |     CREATE
 test |     test | <all keyspaces> |      ALTER
 test |     test | <all keyspaces> |     SELECT
 test |     test | <all keyspaces> |     MODIFY
 test |     test | <all keyspaces> |  AUTHORIZE

我尝试在所有键空间上授予它后撤销它,但它不起作用。

REVOKE SELECT on keyspace system from test;

有没有办法在不授予对每个键空间的访问权限的情况下实现这一点?

【问题讨论】:

    标签: cassandra datastax cql datastax-enterprise


    【解决方案1】:

    您不能限制系统键空间中的某些表。它们是任何驱动程序功能所必需的,因此不能被阻止。如果你有一个有效的用户登录,它们必须是打开的,即使你改变了角色,Cassandra 也会自动授予所有用户访问它们的权限。


    源代码:

    building the list of always readable tables

    // We want these system cfs to be always readable to authenticated users since many tools rely on them
    // (nodetool, cqlsh, bulkloader, etc.)
    for (String cf : Arrays.asList(SystemKeyspace.LOCAL, SystemKeyspace.PEERS))
        READABLE_SYSTEM_RESOURCES.add(DataResource.table(SystemKeyspace.NAME, cf));
    
    SchemaKeyspace.ALL.forEach(table -> READABLE_SYSTEM_RESOURCES.add(DataResource.table(SchemaKeyspace.NAME, table)));
    

    此代码构建了READABLE_SYSTEM_RESOURCES,任何经过身份验证的用户始终可以读取。

    hasAccess returning (passing) if trying to select from those tables

    if ((perm == Permission.SELECT) && READABLE_SYSTEM_RESOURCES.contains(resource))
        return;
    

    描述这个的文档 http://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/secureObjectPerms.html

    【讨论】:

      猜你喜欢
      • 2020-03-27
      • 2019-06-10
      • 2023-04-11
      • 2014-12-09
      • 2012-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多