Dynamic Security Plugin - persisting in-memory to config file [message #1840954] |
Thu, 29 April 2021 08:31  |
Eclipse User |
|
|
|
After enabling dynamic-security plugin, could add dynamically client, group, role and ACLs. New MQTT clients could also connect using these newly created client/user too.
But these dynamically created config using mosquito_ctrl doesn't get persisted. After restart of the broker all the dynamically created configuration were not available.
Is there anything I need to do beyond this to persist the dynamically created configuration using 'dynsec'. Thanks in advance.
autosave_on_changes true
autosave_interval 5
persistence true
persistence_location /var/lib/mosquitto/
|
|
|
|
|
|
|
Re: Dynamic Security Plugin - persisting in-memory to config file [message #1865481 is a reply to message #1865442] |
Sat, 04 May 2024 02:46  |
Eclipse User |
|
|
|
I looked at the source file to debug under /plugins/dynamic-security/plugin.c. Noticed the below code - added a copy dynamic-security.json.new and also dynamic-security.json and with 755 permission to the /etc/mosquitto folder the server starts without complaining and is able to write security config to dynamic-security.json. It modifies the permission of this file to 0600 and deletes the .new file. Very weird that these undocumented behavior.
so /etc/mosquitto to have 0755
and add a duplicate dynamic-security.json.new file with 0600 before adding any new configuration.
Quote:
snprintf(file_path, file_path_len, "%s.new", config_file);
mosquitto_log_printf(MOSQ_LOG_ERR,"file_path %s file_path_len %d config_file %s \n", file_path,file_path_len,config_file);
fptr = mosquitto__fopen(file_path, "wt", true);
if(fptr == NULL){
mosquitto_free(json_str);
mosquitto_free(file_path);
mosquitto_log_printf(MOSQ_LOG_ERR, "Error saving Dynamic security plugin config: File is not writable - check permissions.\n");
return;
}
Can someone confirm this behavior is expected?
|
|
|
Powered by
FUDForum. Page generated in 0.04618 seconds