Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot create role using dynamic security API #2982

Open
thaynes2023 opened this issue Jan 21, 2024 · 2 comments
Open

cannot create role using dynamic security API #2982

thaynes2023 opened this issue Jan 21, 2024 · 2 comments

Comments

@thaynes2023
Copy link

thaynes2023 commented Jan 21, 2024

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.

image

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.

@thaynes2023
Copy link
Author

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"
}
]
}

@thaynes2023
Copy link
Author

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 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant