Skip to content

Instantly share code, notes, and snippets.

View zmstone's full-sized avatar

zmstone zmstone

View GitHub Profile
@zmstone
zmstone / gist:b7b21b99b9e80f3081f2ccfeea52883e
Created April 17, 2024 14:39
emqx resource manager inconsistent_cache exception
*** System report during emqx_bridge_v1_compatibility_layer_SUITE:t_scenario_1/1 2024-04-17 16:25:18.258 ***🔗
=WARNING REPORT==== 17-Apr-2024::16:25:18.256973 ===
data: {data,<<"connector:test_bridge_type:bridgev2a">>,
<<"emqx_connector">>,emqx_bridge_v2_test_connector,
always_sync,sync,
#{ssl =>
#{depth => 10,verify => verify_none,
hibernate_after => 5000,enable => false,
log_level => notice,
versions => ['tlsv1.3','tlsv1.2'],
@zmstone
zmstone / connect-with-jwt.sh
Last active February 2, 2024 17:30
Test EMQX v5.5 JWT authentication and authorization (ACL)
#!/bin/bash -e
#password='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InB1YjEiLCJhY2wiOlt7InBlcm1pc3Npb24iOiJhbGxvdyIsImFjdGlvbiI6ImFsbCIsInRvcGljIjoiZXEgYS8jIn1dfQ.skzXjZOPU9jQLGqwvF2wh-Tr0oNN1GBc55NbSylHaQ0'
password="$(./jwt-generate.sh)"
json="$(echo $password | cut -d '.' -f 2)"
echo "${json}" | base64 -d 2>/dev/null || true
echo
mqttx sub -t 'a/#' -h localhost -p 1883 -i aaa -P "$password" -u pub1
@zmstone
zmstone / dcd-inspect.erl
Created November 16, 2023 10:00
inspect erlang DCD file
F=fun(Path) -> {ok,Log} = disk_log:open([{file, Path}, {name, tmp}, {mode, read_only}]), {_, L,0} = disk_log:bchunk(Log, start, 100), disk_log:close(Log), [binary_to_term(I) || I <- L] end.
@zmstone
zmstone / emqx-conf-cert-md5-as-user-name.conf
Last active October 3, 2023 15:53
EMQX v5 add a new zone and link a SSL listener to it
## Verified in EMQX 5.3.0
## listeners in addition to the default ones
listeners {
ssl.certhash {
enable = true
# bind to port 8884
bind = 8884
# link it to zone named 'certhash'
zone = certhash
ssl_options {
@zmstone
zmstone / emqx-eralng-dist-on-ipv6.sh
Last active October 7, 2023 16:15
start emqx erlang distribution on ipv6
env EMQX_CLUSTER__PROTO_DIST=inet6_tcp EMQX_NODE__NAME=emqx@ipv6.local.host bin/emqx console
@zmstone
zmstone / emqx-dashboard-sso.conf
Created September 28, 2023 06:03
emqx v5.3 enable ldap and saml sso
dashboard.sso = {
ldap {
backend = ldap
base_dn = a
enable = false
filter = "(& (objectClass=person) (uid=${username}))"
pool_size = 8
query_timeout = 5000
request_timeout = 10000
server = "localhost:389"
[
{
"fields": [
{
"aliases": [],
"name": "listeners",
"type": {
"kind": "struct",
"name": "broker:listeners"
}
#!/bin/bash
docker run --rm -it -e EMQX_AUTHENTICATION='[{mechanism="password_based",backend="http", url="http://node:4000/mqtt/authn//",method="post",body={username="${username}", password:"${password}"}, enable=true}]' \
emqx/emqx:5.0.14 emqx console
#!/bin/bash
docker run --rm -it -p 18084:18084 -e EMQX_DASHBOARD__LISTENERS__HTTPS__ENABLE="true" \
-e EMQX_DASHBOARD__LISTENERS__HTTPS__CACERTFILE='/opt/emqx/etc/certs/cacert.pem' \
-e EMQX_DASHBOARD__LISTENERS__HTTPS__CERTFILE='/opt/emqx/etc/certs/cert.pem' \
-e EMQX_DASHBOARD__LISTENERS__HTTPS__KEYFILE='/opt/emqx/etc/certs/key.pem' \
emqx/emqx:5.0.21 emqx console
{
"components": {
"schemas": {
"broker.sysmon_os": {
"properties": {
"cpu_check_interval": {
"default": "60s",
"description": "The time interval for the periodic CPU check.",
"label": "The time interval for the periodic CPU check.",
"summary": "The time interval for the periodic CPU check.",