Open thaynes2023 opened 9 months ago
I see this in the response. So I am not sure how to format the request apparently.
{ "responses": [ { "command": "Unknown command", "error": "Invalid/missing commands" } ] }
I was able to get it to work.
$mqtt->publish( '$CONTROL/dynamic-security/v1', ' { "commands": [ { "command": "createRole", "rolename": "'.$appkey.'", "textname": "", "textdescription": "", "acls": [ { "acltype": "subscribePattern", "topic": "'.$appkey.'/'.$devkey.'/#", "priority": -1, "allow": true} ] } ] } ', 2, true );
using php dynamic security plugin to build new roles.
$mqtt->publish( '$CONTROL/dynamic-security/v1', '[{ "commands":[ { "command": "createRole", "rolename": "'.$devkey.'", "textname": "", "textdescription": "", "acls": [ { "acltype": "subscribePattern", "topic": "'.$appkey.'/'.$devkey.'/#", "priority": -1, "allow": true} ] } ] } ]', 2, true );
I have viewed the tcpdump for the docker container in wireshark. I am getting a published received message back, I see it in the log too.
1705830107: New connection from 192.168.0.210:41152 on port 1883. 1705830107: New client connected from 192.168.0.210:41152 as php_admin (p2, c0, k60, u'PHPadmin'). 1705830107: No will message specified. 1705830107: Sending CONNACK to php_admin (1, 0) 1705830107: Received PUBLISH from php_admin (d0, q2, r1, m1, '$CONTROL/dynamic-security/v1', ... (496 bytes)) 1705830107: Sending PUBREC to php_admin (m1, rc0) 1705830108: Received DISCONNECT from php_admin 1705830108: Client php_admin disconnected.
I do not see these roles being created. I am running a cedalo / MQTT docker container.
I cannot get info out of the docker container for some reason it says the -u option is not recognized.
docker exec -it d53b6546e29f mosquitto_ctrl dynsec -u -P listRoles
Command '-u' not recognised.