Skip to content

Commit 36e1529

Browse files
author
Vincent Royer
committed
Doc update
1 parent 2385fff commit 36e1529

File tree

3 files changed

+57
-31
lines changed

3 files changed

+57
-31
lines changed

docs/elassandra/source/enterprise.rst

Lines changed: 54 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
Enterprise
23
==========
34

@@ -772,8 +773,8 @@ Once authentication is enabled, create a new Cassandra superuser to avoid issue
772773

773774
.. code::
774775
775-
cqlsh> CREATE ROLE admin WITH PASSWORD='******' AND LOGIN=true AND SUPERUSER=true;
776-
cqlsh> ALTER ROLE cassandra WITH PASSWORD='******';
776+
CREATE ROLE admin WITH PASSWORD='******' AND LOGIN=true AND SUPERUSER=true;
777+
ALTER ROLE cassandra WITH PASSWORD='******';
777778
778779
Then configure the replication factor for the *system_auth* keyspace according to your cluster configuration (see `Configure Native Authentication <https://docs.datastax.com/en/cassandra/3.0/cassandra/configuration/secureConfigNativeAuth.html>`_).
779780
Finally, adjust roles and credential cache settings and disable JMX configuration of authentifcation and authorization cache.
@@ -843,7 +844,7 @@ Privileges are defined in the Cassandra table ``elastic_admin.privileges``.
843844

844845
.. IMPORTANT::
845846

846-
* Cassandra superuser have full access to Elasticsearch.
847+
* Cassandra roles with *superuser* = **true** have full access to Elasticsearch.
847848
* All cluster-level access should be granted using privileges.
848849
* Content-Based Security should be used with read-only accounts.
849850

@@ -855,8 +856,8 @@ Cassandra permission associated to a role are `granted <https://docs.datastax.co
855856

856857
.. code::
857858
858-
cassandra@cqlsh> GRANT SELECT ON KEYSPACE sales TO sales;
859-
cassandra@cqlsh> LIST ALL PERMISSIONS;
859+
GRANT SELECT ON KEYSPACE sales TO sales;
860+
LIST ALL PERMISSIONS;
860861
861862
role | username | resource | permission
862863
-----------+-----------+------------------+------------
@@ -897,14 +898,14 @@ Cassandra permissions associated to a role are mapped to Elasticserach Document
897898
| DESCRIBE | Retrieve stats about elasticsearch indices | indices:monitor/stats | Indices Stats |
898899
| | associated to the granted mbeans. | indices:monitor/segments | Indices Segments |
899900
+---------------------+---------------------------------------------------+-----------------------------------+--------------------------+
900-
| SELECT | SELECT on any table. | indices:data/read/* | All document reading API |
901+
| SELECT | SELECT on any table. | indices:data/read/.* | All document reading API |
901902
| | | indices:admin/get | Get Index |
902903
| | | indices:admin/exists | Indices Exists |
903904
| | | indices:admin/types/exists | Type Exists |
904905
| | | indices:admin/mapping | Get Mapping |
905906
| | | indices:admin/mappings/fields/get | Get Field Mapping |
906907
+---------------------+---------------------------------------------------+-----------------------------------+--------------------------+
907-
| MODIFY | INSERT, UPDATE, DELETE on any table. | indices:data/write/* | All document writing API |
908+
| MODIFY | INSERT, UPDATE, DELETE on any table. | indices:data/write/.* | All document writing API |
908909
+---------------------+---------------------------------------------------+-----------------------------------+--------------------------+
909910

910911

@@ -971,9 +972,9 @@ Strapdata provides a SSL transport client to work with a secured Elassandra clus
971972

972973
.. code ::
973974
974-
cassandra@cqlsh> CREATE ROLE monitor WITH PASSWORD = 'monitor' AND LOGIN = true;
975-
cassandra@cqlsh> INSERT INTO elastic_admin.privileges (role, actions,indices) VALUES('monitor','cluster:monitor/state','.*');
976-
cassandra@cqlsh> INSERT INTO elastic_admin.privileges (role, actions,indices) VALUES('monitor','cluster:monitor/nodes/liveness','.*');
975+
CREATE ROLE monitor WITH PASSWORD = 'monitor' AND LOGIN = true;
976+
INSERT INTO elastic_admin.privileges (role, actions,indices) VALUES('monitor','cluster:monitor/state','.*');
977+
INSERT INTO elastic_admin.privileges (role, actions,indices) VALUES('monitor','cluster:monitor/nodes/liveness','.*');
977978
978979
#. Add an **Authorization** header to your client containing your based-64 encoded login and password. This account must have
979980
appropriate `Cassandra permissions <https://docs.datastax.com/en/cql/3.3/cql/cql_using/useSecurePermission.html>`_ or privileges in the ``elastic_admin.privileges`` table.
@@ -1038,13 +1039,13 @@ Kibana needs a dedicated kibana account to manage kibana configuration, with the
10381039

10391040
.. code::
10401041
1041-
cassandra@cqlsh> CREATE ROLE kibana WITH PASSWORD = '*****' AND LOGIN = true;
1042-
cassandra@cqlsh> CREATE KEYSPACE "_kibana" WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1':'1'};
1043-
cassandra@cqlsh> GRANT CREATE ON KEYSPACE "_kibana" TO kibana;
1044-
cassandra@cqlsh> GRANT ALTER ON KEYSPACE "_kibana" TO kibana;
1045-
cassandra@cqlsh> GRANT SELECT ON KEYSPACE "_kibana" TO kibana;
1046-
cassandra@cqlsh> GRANT MODIFY ON KEYSPACE "_kibana" TO kibana;
1047-
cassandra@cqlsh> LIST ALL PERMISSIONS OF kibana;
1042+
CREATE ROLE kibana WITH PASSWORD = '*****' AND LOGIN = true;
1043+
CREATE KEYSPACE "_kibana" WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1':'1'};
1044+
GRANT CREATE ON KEYSPACE "_kibana" TO kibana;
1045+
GRANT ALTER ON KEYSPACE "_kibana" TO kibana;
1046+
GRANT SELECT ON KEYSPACE "_kibana" TO kibana;
1047+
GRANT MODIFY ON KEYSPACE "_kibana" TO kibana;
1048+
LIST ALL PERMISSIONS OF kibana;
10481049
10491050
role | username | resource | permission
10501051
--------+----------+--------------------+------------
@@ -1057,14 +1058,14 @@ Add cluster monitoring access rights to the *kibana* user, and refresh the privi
10571058

10581059
.. code::
10591060
1060-
cassandra@cqlsh> INSERT INTO elastic_admin.privileges (role,actions,indices) VALUES ('kibana','cluster:monitor/.*','.*');
1061-
cassandra@cqlsh> SELECT * FROM elastic_admin.privileges ;
1061+
INSERT INTO elastic_admin.privileges (role,actions,indices) VALUES ('kibana','cluster:monitor/.*','.*');
1062+
SELECT * FROM elastic_admin.privileges;
10621063
10631064
role | actions | indices | fields | query
10641065
--------+--------------------+---------+--------+-------
10651066
kibana | cluster:monitor/.* | .* | null | null
10661067
1067-
Finally, user accounts must have :
1068+
Finally, Kibana user accounts must have :
10681069

10691070
* the SELECT permission on vizualized indices, especially on your default kibana index.
10701071
* the SELECT permission on the kibana keyspace to read kibana configuration.
@@ -1073,12 +1074,37 @@ Finally, user accounts must have :
10731074
.. TIP::
10741075

10751076
Once a user if authenticated by kibana, kibana keeps this information. In order to logout from your browser, clear cookies and data associated to your kibana server.
1077+
1078+
Kibana and Content-Based Security
1079+
.................................
1080+
1081+
As explain in the `cassandra documentation <http://cassandra.apache.org/doc/latest/cql/security.html#database-roles>`_, you can grant a role to another role and create a hierarchy of roles.
1082+
Then you can gives some elasticsearch privileges to a base role inherited by some user roles allowed to login, and specify a query filter or field-level filter to this base role.
1083+
1084+
In the following example, the base role *group_a* have read access to index *my_index* with a document-level filter defined by a term query.
1085+
Then the user role *bob* (allowed to log in) inherits of the privileges from the base role *group_a* to read the kibana configuration and the index *my_index* only for documents where *category* is *A*.
1086+
1087+
.. code::
1088+
1089+
REVOKE SELECT ON KEYSPACE my_index FROM kibana;
1090+
CREATE ROLE group_a WITH LOGIN = false;
1091+
GRANT SELECT ON KEYSPACE "_kibana" to group_a;
1092+
INSERT INTO elastic_admin.privileges (role, actions, indices, query) VALUES('group_a','indices:data/read/.*','my_index', '{ "term" : { "category" : "A" }}');
1093+
CREATE ROLE bob WITH PASSWORD = 'bob' AND LOGIN = true;
1094+
GRANT group_a TO bob;
1095+
1096+
Don't forget to refresh the privileges cache by issuing the following command :
1097+
1098+
.. code::
1099+
1100+
POST /_aaa_clear_privilege_cache
1101+
10761102
10771103
Elasticsearch Spark connector
10781104
.............................
10791105

1080-
The `elasticsearch-hadoop <https://github.com/strapdata/elasticsearch-hadoop/>`_ connector can access a secured Elassandra cluster by providing the
1081-
sames SSL/TLS and Username/Pasword authentication parameters as the orginal `elasticsearch-hadoop security <https://www.elastic.co/guide/en/elasticsearch/hadoop/current/security.html>`_ connector.
1106+
The `elasticsearch-hadoop <https://github.com/strapdata/elasticsearch-hadoop>`_ connector can access a secured Elassandra cluster by providing the
1107+
sames SSL/TLS and Username/Pasword authentication parameters as the orginal `elasticsearch-hadoop <https://www.elastic.co/guide/en/elasticsearch/hadoop/current/security.html>`_ connector.
10821108
Here is an example with a spark-shell.
10831109

10841110
.. code::
@@ -1098,19 +1124,19 @@ The *spark* role have no cassandra permission, but user *john* inherits its priv
10981124

10991125
.. code::
11001126
1101-
cassandra@cqlsh> CREATE ROLE spark;
1102-
cassandra@cqlsh> INSERT INTO elastic_admin.privileges (role,actions,indices) VALUES ('spark','cluster:monitor/.*','.*');
1103-
cassandra@cqlsh> INSERT INTO elastic_admin.privileges (role,actions,indices) VALUES ('spark','indices:admin/shards/search_shards','.*');
1104-
cassandra@cqlsh> SELECT * FROM elastic_admin.privileges WHERE role='spark';
1127+
CREATE ROLE spark;
1128+
INSERT INTO elastic_admin.privileges (role,actions,indices) VALUES ('spark','cluster:monitor/.*','.*');
1129+
INSERT INTO elastic_admin.privileges (role,actions,indices) VALUES ('spark','indices:admin/shards/search_shards','.*');
1130+
SELECT * FROM elastic_admin.privileges WHERE role='spark';
11051131
11061132
role | actions | indices | fields | query
11071133
--------+------------------------------------+---------+--------+-------
11081134
spark | cluster:monitor/.* | .* | null | null
11091135
spark | indices:admin/shards/search_shards | .* | null | null
11101136
11111137
(2 rows)
1112-
cassandra@cqlsh> GRANT spark TO john;
1113-
cassandra@cqlsh> LIST ROLES of john;
1138+
GRANT spark TO john;
1139+
LIST ROLES of john;
11141140
11151141
role | super | login | options
11161142
-------+-------+-------+---------

docs/elassandra/source/integration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@ The `Elasticsearch JDBC driver <https://github.com/Anchormen/sql4es>`_. can be u
126126
Running Spark with Elassandra
127127
-----------------------------
128128

129-
A modified version of the `elasticsearch-hadoop <https://github.com/elastic/elasticsearch-hadoop>`_ connector is available for elassandra at `https://github.com/strapdata/elasticsearch-hadoop`_.
130-
This connector works with spark as describe in the elasticsearch documentation available at `https://www.elastic.co/guide/en/elasticsearch/hadoop/current/index.html`_.
129+
For elassandra 5.5, a modified version of the `elasticsearch-hadoop <https://github.com/elastic/elasticsearch-hadoop>`_ connector is available for elassandra on the `strapdata repository <https://github.com/strapdata/elasticsearch-hadoop>`_.
130+
This connector works with spark as describe in the elasticsearch documentation available at `elasticsearch/hadoop <https://www.elastic.co/guide/en/elasticsearch/hadoop/current/index.html>`_.
131131

132132
For example, in order to submit a spark job in client mode.
133133

docs/elassandra/source/operations.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ By default, when using the Elasticsearch API to replace a document by a new one,
4747
Elassandra insert a row corresponding to the new document including null for unset fields.
4848
Without these null (cell tombstones), old fields not present in the new document would be kept at the Cassandra level as zombie cells.
4949

50-
Moreover, indexing with ``op_type=create`` (See `Elasticsearch indexing `<https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#operation-type>`_ ) require a Cassandra PAXOS transaction
50+
Moreover, indexing with ``op_type=create`` (See `Elasticsearch indexing <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#operation-type>`_ ) require a Cassandra PAXOS transaction
5151
to check if the document exists in the underlying datacenter. This comes with useless performance cost if you use automatic generated
5252
document ID (See `Automatic ID generation <https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html#_automatic_id_generation>`_.
5353
), as this ID will be the Cassandra primary key.

0 commit comments

Comments
 (0)