Add Userdb extra field to existing configuration settings, not overriding them
Hi,
If i understood correctly the extra field feature ( https://doc.dovecot.org/configuration_manual/authentication/user_database_ex tra_fields/ ), any extra field that is passed from a SQL query will overwrite any existing settings on the dovecot.conf configuration file ( if present ) .
For example, if i want to enable a plugin ( ex: acl ) on a per user basis, i would add a column\field ( ex: "acl_enabled" = 1 ) into my auth DB , then add into the dovecot password\user queries :
.
IF(acl_enabled = 0, NULL, 'acl imap_acl') AS mail_plugins
.
While having in the dovecot.conf this setting :
.
mail_plugins = quota notify
protocol imap
mail_plugins = $mail_plugins imap_quota
.
From my test, this combination will lead to having the logging users with acl_enabled=1, a mail_plugins list of acl and imap_acl only, without the quota and notify plugins .
If i change the acl_value to 0, the returned mail_plugins list is empty and it will not overrive\overwrite the dovecot.conf mail_plugins configuration .
If it's correct, there is a way to merge both settings, like having in the dovecot.conf a minimal\base subset of settings and adding any additional values via SQL queries ?
Thanks and best regards
Stefano
On 13/01/2023 19:39 EET Stefano Cecconello stefano.cecconello@staff.aruba.it wrote:
Hi,
If i understood correctly the extra field feature ( https://doc.dovecot.org/configuration_manual/authentication/user_database_ex... ), any extra field that is passed from a SQL query will overwrite any existing settings on the dovecot.conf configuration file ( if present ) .
For example, if i want to enable a plugin ( ex: acl ) on a per user basis, i would add a column\field ( ex: “acl_enabled” = 1 ) into my auth DB , then add into the dovecot password\user queries :
… IF(acl_enabled = 0, NULL, 'acl imap_acl') AS mail_plugins …
While having in the dovecot.conf this setting : … mail_plugins = quota notify
protocol imap mail_plugins = $mail_plugins imap_quota
…
From my test, this combination will lead to having the logging users with acl_enabled=1, a mail_plugins list of acl and imap_acl only, without the quota and notify plugins . If i change the acl_value to 0, the returned mail_plugins list is empty and it will not overrive\overwrite the dovecot.conf mail_plugins configuration .
If it’s correct, there is a way to merge both settings, like having in the dovecot.conf a minimal\base subset of settings and adding any additional values via SQL queries ?
Thanks and best regards Stefano
You could try:
IF(acl_enabled = 0, NULL, 'acl imap_acl') AS mail_plugins_extra
and in config
mail_plugins = $mail_plugins $mail_plugins_extra
Aki
participants (2)
-
Aki Tuomi
-
Stefano Cecconello