Commit Graph

126 Commits

Author SHA1 Message Date
zhongwencool 2e10a5700c
Merge pull request #6515 from zhongwencool/fix-bann-utf8
fix(banned): create banned with utf8 failed by 500 response
2021-12-22 16:08:34 +08:00
zhongwencool b11a15fa00 fix(banned): create banned with utf8 failed by 500 2021-12-22 14:29:15 +08:00
JimMoen 6f28e103d0 fix(dashobard): statistical diagram timestamp use UTC time 2021-12-20 19:21:19 +08:00
JimMoen 3a3226fc78 fix(dashboard): enable dashboard by default 2021-12-17 11:20:23 +08:00
zhongwencool e4a21fd90d fix: merge from master 2021-12-15 16:24:25 +08:00
zhongwencool f95ef04cf7
Merge branch 'master' into api-key-secret 2021-12-15 16:01:09 +08:00
Thales Macedo Garitezi 95de2d3467
fix(monitor): fix return value on badrpc
If the rpc in `emqx_dashboard_monitor_api:get_collect/1` fails, an
empty map is return.  But the current function expects a 4-tuple,
which results in a 500 error returned on such occasions.

```
curl -su admin:public localhost:8888/api/v5/monitor/current | jq .
{
  "code": "INTERNAL_ERROR",
  "message": "error, function_clause, [{emqx_dashboard_monitor_api,format_current_metrics,[[#{},{0,0,0,0},{0,0,0,0}],{0,0,0,0}],[{file,\"emqx_dashboard_monitor_api.erl\"},{line,179}]},{emqx_dashboard_monitor_api,current_counters,2,[{file,\"emqx_dashboard_monitor_api.erl\"},{line,167}]},{minirest_handler,apply_callback,3,[{file,\"minirest_handler.erl\"},{line,112}]},{minirest_handler,init,2,[{file,\"minirest_handler.erl\"},{line,38}]},{cowboy_handler,execute,2,[{file,\"cowboy_handler.erl\"},{line,41}]},{cowboy_stream_h,execute,3,[{file,\"cowboy_stream_h.erl\"},{line,318}]},{cowboy_stream_h,request_process,3,[{file,\"cowboy_stream_h.erl\"},{line,302}]},{proc_lib,init_p_do_apply,3,[{file,\"proc_lib.erl\"},{line,226}]}]"
}
```
2021-12-14 17:56:32 -03:00
Thales Macedo Garitezi 0300403fc0
fix(admin): inconsistent return type on empty inputs
If an empty username or password are given during the initialization
of `emqx_dashboard_admin`, it'll return just the atom `ok`, which
breaks the expected `{ok, _}` in `emqx_dashboard_app:start/2`.

```
{'EXIT',
 {{failed_to_start_app,emqx_dashboard,
   {emqx_dashboard,
    {bad_return,
     {{emqx_dashboard_app,start,[normal,[]]},
      {'EXIT',
       {{badmatch,ok},
        [{emqx_dashboard_app,start,2,
          [{file,
            "/home/thales/dev/emqx/emqx/apps/emqx_dashboard/src/emqx_dashboard_app.erl"},
           {line,32}]},
         {application_master,start_it_old,4,
          [{file,"application_master.erl"},{line,293}]}]}}}}}}}}
```
2021-12-14 17:51:50 -03:00
firest 8493b61cb5 refactor(eqmx_limiter): use the new hierarchical token bucket to replace the old ratelimit code 2021-12-10 14:37:23 +08:00
zhongwencool 0614c157ec fix(elvis): elvis warning 2021-12-09 16:42:10 +08:00
zhongwencool cf11f3f8ee feat(api-key): support api_key/secret 2021-12-09 16:42:10 +08:00
Zaiming (Stone) Shi 5525cb3262 refactor: only apply environment variables on base config 2021-12-06 08:00:42 +01:00
zhongwencool 1f6e2e7397 chore: add test for sub fields 2021-12-01 12:01:44 +08:00
Zaiming (Stone) Shi d2fa0a71f4 refactor: give psk auth a better namespace 2021-12-01 00:33:20 +01:00
zhongwencool f697028b70
Fix ping not return pong (#6285)
* fix: ./bin/emqx ping return pong

* chore: waiting longer for logger flush log to disk

* fix: change swagger page's limit from 100 to 1000

* chore: type wrong

* fix: sync log to disk by logger_disk_log_h:filesync
2021-11-26 17:02:45 +08:00
zhouzb 63f1d88ed3 chore(dashboard): disable by default 2021-11-22 22:23:06 +08:00
Shawn f0c61068e8 fix(authn): test cases issues 2021-11-22 17:35:33 +08:00
Shawn c66c6b53b2 feat(connector): add APIs for connector 2021-11-22 17:35:33 +08:00
Shawn bcf5f499da feat(connector): add APIs for connector 2021-11-22 17:35:33 +08:00
Zaiming Shi 6ca6d60858 fix(dashboard): change hash from sha3_256 to sha256
old version os has no support for it
2021-11-20 21:21:11 +01:00
Zaiming Shi 6edd862dd5 refactor: no more EMQX_ENTERPRISE compile flag
The compile flag was introduced in EQM X 4.3 series
where CE and EE code was diverged large enough which made
non-practicle to determin edition at runtime.

such approach made testing quite challenging as we'll have to
build with different compile flags inorder to run per-edition
test cases

In this commit, we try to retrieve edition info from EMQX's
description text, (put to PT for fast access) at runtime
so we can test ALL editions from a super-set edition (EE).
2021-11-20 20:41:06 +01:00
JimMoen e361cd5733
Fix dashboard APIs return (#6177)
* fix(dashboard_api): delete non-exist user wrongly return 204

* fix(dashboard): dashboard user should use `tags` not `tag`

* fix(dashboard): create/update user return 200 with full users list

* fix(dashboard): logout status code 204

* fix(dashboard): update pwd status code 204

* test: test suite for dashboard APIs

* refactor(dashboard): user info mnesia record name use description

* style: make elvis happy

* fix(api): dashboard swagger check request should not override env

* fix(dashboard): add/modify dashboard returns single record

* ci: update emqx-fvt version to new tag 1.0.2-dev1
2021-11-18 14:36:12 +08:00
JimMoen b3f9220d02 style: make elvis happy 2021-11-15 16:30:44 +08:00
JimMoen 106aa559e0 fix(api): DELETE success wrongly returned code 200 2021-11-15 16:30:44 +08:00
DDDHuang 1476accd63
fix: monitor bad mnesia write & rpc call (#6060) 2021-11-15 15:28:19 +08:00
DDDHuang bc6e49804f
feat: support CORS request
feat: support CORS request
2021-11-11 20:27:39 +08:00
zhongwencool 7a5da76197
Mgmt http api banned (#5998)
* fix(swagger): don't transform [log,publish] to a list.pwd

* chore: replace banned-api by hocon schema

* fix(api): code style warning
2021-11-11 16:35:29 +08:00
zhongwencool eea789451b
feat: sha3_256 dashboard account's password (#6084) 2021-11-09 15:41:28 +08:00
Ilya Averyanov 796553b5ea fix(authn api): eliminate possible atom leak 2021-11-01 16:51:48 +03:00
Ilya Averyanov 800b4b32c7
refactor(authn api): use config schemas for request validations (#5999) 2021-11-01 17:52:03 +08:00
zhongwencool e62fde321c
Emqx alarm (#5994)
* chore(alarm): normalize_message outside emqx_alarm

* chore(alarm): don't cache config in emqx_alarm; remove dirty_write/read; add desc/example to alarm; add more test

* chore(alarm_api): alarm_api with hocon schema

* fix: activted's nullable is true

* fix(swagger): translate map to object

* fix(cluster_rpc): debug failed cluster_rpc test

* fix: Update schema description

Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>

Co-authored-by: Zaiming (Stone) Shi <zmstone@gmail.com>
2021-10-28 18:03:51 +08:00
Zaiming (Stone) Shi 4dbe3ccf71
refactor(dashboard): rename 'password' field to 'pwdhash' (#5990)
* refactor(dashboard): rename 'password' field to 'pwdhash'

rename as it is not plaintext password stored in db

* refactor(emqx_dashboard): rename records

* test(emqx_dashboard_token): add test case to cover match specs
2021-10-26 20:41:33 +08:00
zhongwencool 90795a6f42
Rewrite http api with hocon schema (#5980)
* feat: rewrite http api with hocon

* fix: crash when default_username is empty

* chore: udpate rewrite api with emqx_conf's cluster_rpc

* fix: spec wrong
2021-10-22 17:01:29 +08:00
zhongwencool d784e63b9f
emqx_conf (#5939)
* feat(emqx_conf): move conf manager for emqx_machine to emqx_conf

* chore(emqx_conf): change emqx:get_config/2 to emqx_conf:get/2

* fix: common test failed

* fix: badmatch by typo wrong key

* fix(emqx_conf): get the wrong core nodes

* fix(emqx_conf): get core node's tnx_id not latest tnx_id

* fix: add ro_transation when copy conf file

* fix: delete debug info

* fix: change ekka_rlog to mria_rlog

* fix: remove cluster_rpc from emqx_machine.

* fix: don't call ekka:start/0 explicitly

* fix: ekka should be start in emqx_machine
2021-10-21 18:08:51 +08:00
k32 37a1c45af0 fix(dialyzer): Fix problems found by dialyzer 2021-10-18 22:04:05 +02:00
k32 07ea6e5689 fix(mria): Fix startup sequence 2021-10-18 22:04:05 +02:00
k32 d14b8e7da9 chore(mria): ekka_rlog -> mria_rlog 2021-10-18 22:04:05 +02:00
k32 326923850c chore(mria): Get rid of copy_mnesia callback 2021-10-18 22:04:05 +02:00
k32 e14a62d4d6 chore(mria): ekka_mnesia:start/stop -> mria:start/stop 2021-10-18 22:04:05 +02:00
k32 9965d6e028 chore(mria): ekka_mnesia:create_table -> mria:create_table 2021-10-18 22:04:05 +02:00
k32 ae2056da1b chore(mria): Fix clear_table and ro_transaction calls 2021-10-18 22:04:05 +02:00
k32 ff48322e0c chore(mria): ekka_mnesia:running_nodes -> mria:running_nodes 2021-10-18 22:04:05 +02:00
k32 b515a45a4f chore(mria): Rename module: ekka_mnesia -> mria 2021-10-18 22:04:05 +02:00
zhongwencool c73205a589
Ct helpers migrate (#5943)
* chore: common test

* chore: delete emqx_ct_helpers deps
2021-10-18 13:45:52 +08:00
Tobias Lindahl aa19c2a908 chore: Remove emqx_ct_helpers as dependency 2021-10-15 10:40:57 +02:00
Zaiming (Stone) Shi c5b2bc86a2
chore(dashboard): enable by default (#5926) 2021-10-14 21:05:02 +08:00
lafirest 8a2c5e2422 feat(rate_limiter): implement hierarchical token buckets 2021-10-14 10:20:05 +08:00
zhongwencool d80f20aca3
feat(swagger): define mgmt config_api by hocon schema (#5814)
* feat(swagger): define mgmt config_api by hocon schema

* fix: enum can't defined by integer, use union.

* fix: hocon schema union to enum
2021-10-13 14:04:43 +08:00
lafirest 3524942766 fix: change all ~s in io format to ~ts
we should use unicode to replace latin1
2021-10-12 15:09:24 +08:00
Zaiming Shi e9991dca02 chore(dashboard): Allow test mode of the dashboard 2021-09-30 09:28:47 +02:00