2.0-rc.1 - update docs for redis plugin

This commit is contained in:
Feng 2016-10-02 18:42:55 +08:00
parent 52403ceb67
commit cec3f781a0
2 changed files with 41 additions and 19 deletions

View File

@ -5,6 +5,27 @@
Changes Changes
======= =======
.. _release_2.0_rc.1:
----------------
Version 2.0-rc.1
----------------
*Release Date: 2016-10-03*
1. `mqtt/superuser` POST called two times in `emqtt_auth_http` (#696)
2. Close MQTT TCP connection if authentication failed (#707)
3. Improve the plugin management. Developer don't need to add plugin's config to rel/sys.config
4. Add `BUILD_DEPS` in the plugin's Makefile::
BUILD_DEPS = emqttd
dep_emqttd = git https://github.com/emqtt/emqttd emq20
5. Improve the design of Redis ACL.
.. _release_2.0_beta.3: .. _release_2.0_beta.3:
------------------ ------------------

View File

@ -415,26 +415,25 @@ etc/plugins/emqttd_auth_redis.conf:
%% Variables: %u = username, %c = clientid %% Variables: %u = username, %c = clientid
%% HMGET mqtt_user:%u is_superuser
{supercmd, ["HGET", "mqtt_user:%u", "is_superuser"]}.
%% HMGET mqtt_user:%u password %% HMGET mqtt_user:%u password
{authcmd, ["HGET", "mqtt_user:%u", "password"]}. {authcmd, "HGET mqtt_user:%u password"}.
%% Password hash algorithm: plain, md5, sha, sha256, pbkdf2? %% Password hash algorithm: plain, md5, sha, sha256, pbkdf2?
{password_hash, sha256}. {password_hash, sha256}.
%% SMEMBERS mqtt_acl:%u %% HMGET mqtt_user:%u is_superuser
{aclcmd, ["SMEMBERS", "mqtt_acl:%u"]}. {supercmd, "HGET mqtt_user:%u is_superuser"}.
%% HGETALL mqtt_acl:%u
{aclcmd, "HGETALL mqtt_acl:%u"}.
%% If no rules matched, return... %% If no rules matched, return...
{acl_nomatch, deny}. {acl_nomatch, deny}.
%% Load Subscriptions form Redis when client connected. %% Load Subscriptions form Redis when client connected.
{subcmd, ["HGETALL", "mqtt_subs:%u"]}. {subcmd, "HGETALL mqtt_sub:%u"}.
Redis User Hash
Redis User HASH
--------------- ---------------
Set a 'user' hash with 'password' field, for example:: Set a 'user' hash with 'password' field, for example::
@ -442,16 +441,18 @@ Set a 'user' hash with 'password' field, for example::
HSET mqtt_user:<username> is_superuser 1 HSET mqtt_user:<username> is_superuser 1
HSET mqtt_user:<username> password "passwd" HSET mqtt_user:<username> password "passwd"
Redis ACL Rule SET Redis ACL Rule Hash
------------------ -------------------
The plugin uses a redis SET to store ACL rules:: The plugin uses a redis Hash to store ACL rules::
SADD mqtt_acl:<username> "publish topic1" HSET mqtt_acl:<username> topic1 1
SADD mqtt_acl:<username> "subscribe topic2" HSET mqtt_acl:<username> topic2 2
SADD mqtt_acl:<username> "pubsub topic3" HSET mqtt_acl:<username> topic3 3
Redis Subscription HASH .. NOTE:: 1: subscribe, 2: publish, 3: pubsub
Redis Subscription Hash
----------------------- -----------------------
The plugin can store static subscriptions in a redis Hash:: The plugin can store static subscriptions in a redis Hash::
@ -495,14 +496,14 @@ etc/plugins/emqttd_plugin_mongo.conf:
%% Variables: %u = username, %c = clientid %% Variables: %u = username, %c = clientid
%% Superuser Query %% Superuser Query
{superquery, pool, [ {superquery, [
{collection, "mqtt_user"}, {collection, "mqtt_user"},
{super_field, "is_superuser"}, {super_field, "is_superuser"},
{selector, {"username", "%u"}} {selector, {"username", "%u"}}
]}. ]}.
%% Authentication Query %% Authentication Query
{authquery, pool, [ {authquery, [
{collection, "mqtt_user"}, {collection, "mqtt_user"},
{password_field, "password"}, {password_field, "password"},
%% Hash Algorithm: plain, md5, sha, sha256, pbkdf2? %% Hash Algorithm: plain, md5, sha, sha256, pbkdf2?
@ -511,7 +512,7 @@ etc/plugins/emqttd_plugin_mongo.conf:
]}. ]}.
%% ACL Query: "%u" = username, "%c" = clientid %% ACL Query: "%u" = username, "%c" = clientid
{aclquery, pool, [ {aclquery, [
{collection, "mqtt_acl"}, {collection, "mqtt_acl"},
{selector, {"username", "%u"}} {selector, {"username", "%u"}}
]}. ]}.