chore(bridge): cover username/password auth for cassandra bridges
This commit is contained in:
parent
ae5c24445b
commit
539ec2f774
|
@ -100,7 +100,7 @@ batchlog_replay_throttle_in_kb: 1024
|
||||||
# users. It keeps usernames and hashed passwords in system_auth.roles table.
|
# users. It keeps usernames and hashed passwords in system_auth.roles table.
|
||||||
# Please increase system_auth keyspace replication factor if you use this authenticator.
|
# Please increase system_auth keyspace replication factor if you use this authenticator.
|
||||||
# If using PasswordAuthenticator, CassandraRoleManager must also be used (see below)
|
# If using PasswordAuthenticator, CassandraRoleManager must also be used (see below)
|
||||||
authenticator: AllowAllAuthenticator
|
authenticator: PasswordAuthenticator
|
||||||
|
|
||||||
# Authorization backend, implementing IAuthorizer; used to limit access/provide permissions
|
# Authorization backend, implementing IAuthorizer; used to limit access/provide permissions
|
||||||
# Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthorizer,
|
# Out of the box, Cassandra provides org.apache.cassandra.auth.{AllowAllAuthorizer,
|
||||||
|
|
|
@ -22,9 +22,9 @@ services:
|
||||||
- -c
|
- -c
|
||||||
- |
|
- |
|
||||||
/opt/cassandra/bin/cassandra -f -R > /cassandra.log &
|
/opt/cassandra/bin/cassandra -f -R > /cassandra.log &
|
||||||
/opt/cassandra/bin/cqlsh -e "CREATE KEYSPACE mqtt WITH REPLICATION = { 'class':'SimpleStrategy','replication_factor':1};"
|
/opt/cassandra/bin/cqlsh -u cassandra -p cassandra -e "CREATE KEYSPACE mqtt WITH REPLICATION = { 'class':'SimpleStrategy','replication_factor':1};"
|
||||||
while [[ $$? -ne 0 ]];do sleep 5; /opt/cassandra/bin/cqlsh -e "CREATE KEYSPACE mqtt WITH REPLICATION = { 'class':'SimpleStrategy','replication_factor':1};"; done
|
while [[ $$? -ne 0 ]];do sleep 5; /opt/cassandra/bin/cqlsh -u cassandra -p cassandra -e "CREATE KEYSPACE mqtt WITH REPLICATION = { 'class':'SimpleStrategy','replication_factor':1};"; done
|
||||||
/opt/cassandra/bin/cqlsh -e "describe keyspaces;"
|
/opt/cassandra/bin/cqlsh -u cassandra -p cassandra -e "describe keyspaces;"
|
||||||
tail -f /cassandra.log
|
tail -f /cassandra.log
|
||||||
networks:
|
networks:
|
||||||
- emqx_bridge
|
- emqx_bridge
|
|
@ -33,8 +33,8 @@
|
||||||
|
|
||||||
% DB defaults
|
% DB defaults
|
||||||
-define(CASSA_KEYSPACE, "mqtt").
|
-define(CASSA_KEYSPACE, "mqtt").
|
||||||
-define(CASSA_USERNAME, "root").
|
-define(CASSA_USERNAME, "cassandra").
|
||||||
-define(CASSA_PASSWORD, "public").
|
-define(CASSA_PASSWORD, "cassandra").
|
||||||
-define(BATCH_SIZE, 10).
|
-define(BATCH_SIZE, 10).
|
||||||
|
|
||||||
%% cert files for client
|
%% cert files for client
|
||||||
|
|
|
@ -37,6 +37,11 @@
|
||||||
%%
|
%%
|
||||||
%% sudo docker run --rm -d --name cassandra --network host cassandra:3.11.14
|
%% sudo docker run --rm -d --name cassandra --network host cassandra:3.11.14
|
||||||
|
|
||||||
|
%% Cassandra default username & password once enable `authenticator: PasswordAuthenticator`
|
||||||
|
%% in cassandra config
|
||||||
|
-define(CASSA_USERNAME, <<"cassandra">>).
|
||||||
|
-define(CASSA_PASSWORD, <<"cassandra">>).
|
||||||
|
|
||||||
all() ->
|
all() ->
|
||||||
emqx_common_test_helpers:all(?MODULE).
|
emqx_common_test_helpers:all(?MODULE).
|
||||||
|
|
||||||
|
@ -62,8 +67,8 @@ init_per_suite(Config) ->
|
||||||
{ok, Conn} =
|
{ok, Conn} =
|
||||||
ecql:connect([
|
ecql:connect([
|
||||||
{nodes, cassandra_servers()},
|
{nodes, cassandra_servers()},
|
||||||
{username, <<"admin">>},
|
{username, ?CASSA_USERNAME},
|
||||||
{password, <<"public">>},
|
{password, ?CASSA_PASSWORD},
|
||||||
{keyspace, "mqtt"}
|
{keyspace, "mqtt"}
|
||||||
]),
|
]),
|
||||||
ecql:close(Conn),
|
ecql:close(Conn),
|
||||||
|
@ -175,8 +180,8 @@ cassandra_config() ->
|
||||||
#{
|
#{
|
||||||
auto_reconnect => true,
|
auto_reconnect => true,
|
||||||
keyspace => <<"mqtt">>,
|
keyspace => <<"mqtt">>,
|
||||||
username => <<"default">>,
|
username => ?CASSA_USERNAME,
|
||||||
password => <<"public">>,
|
password => ?CASSA_PASSWORD,
|
||||||
pool_size => 8,
|
pool_size => 8,
|
||||||
servers => iolist_to_binary(
|
servers => iolist_to_binary(
|
||||||
io_lib:format(
|
io_lib:format(
|
||||||
|
|
|
@ -171,7 +171,7 @@ for dep in ${CT_DEPS}; do
|
||||||
FILES+=( '.ci/docker-compose-file/docker-compose-dynamo.yaml' )
|
FILES+=( '.ci/docker-compose-file/docker-compose-dynamo.yaml' )
|
||||||
;;
|
;;
|
||||||
cassandra)
|
cassandra)
|
||||||
FILES+=( '.ci/docker-compose-file/docker-compose-cassandra-tcp.yaml' )
|
FILES+=( '.ci/docker-compose-file/docker-compose-cassandra.yaml' )
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "unknown_ct_dependency $dep"
|
echo "unknown_ct_dependency $dep"
|
||||||
|
|
Loading…
Reference in New Issue