mirror of
https://github.com/modoboa/modoboa.git
synced 2026-04-25 17:06:01 +03:00
[GH-ISSUE #2739] Calls to doveadm as part of custom PasswordHasher implementation spams auth log #1690
Labels
No labels
bug
bug
dependencies
design
documentation
duplicate
enhancement
enhancement
enhancement
feedback-needed
help-needed
help-needed
installer
invalid
looking-for-sponsors
modoboa-contacts
new-ui
new-ui
pr
pull-request
pyconfr
python
question
security
stale
webmail
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/modoboa-modoboa#1690
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @PatTheMav on GitHub (Jan 3, 2023).
Original GitHub issue: https://github.com/modoboa/modoboa/issues/2739
Impacted versions
Steps to reproduce
auth.logCurrent behavior
The current model setup in Modoboa relies on a custom
PasswordHasherimplementation that usesdoveadm pw -lto list all available password schemes in the localdovecotimplementation.From my observations this can lead to lots of unnecessary calls made during model initialisation, each of which results in a call to
sudoand corresponding log entries, depending on the amount of users configured in the modoboa instance:Biggest culprit seems to be the
generate_rightscommand, which seems to initialise Models anew for each iteration of a loop, leading to pages of entries inauth.logjust for a single invocation of the cron job.While this issue can be alleviated somewhat by setting
DOVECOT_SUPPORTED_SCHEMESinsettings.py(which also allows "limiting" the schemes to only strong hashes), it makes the setup unresponsive to changes in the dovecot configuration (which seems like the original intent of the implementation).Expected behavior
Ideally the results of the call should be cached, or maybe even retrieved in a separate cron job and stored in a config. While the configuration could change between calls to the user tables, the probability is comparatively low and the reduction of log spam would be appreciated.
@MrGeneration commented on GitHub (Jan 11, 2023):
I have radicale related parts disabled on my instance. After upgrading to 2.0.3 however OPs described behavior appeared on my system as well but for opendkim.
opendkim umask 077 && $PYTHON $INSTANCE/manage.py modo manage_dkim_keysTries to call
doveadm pw -l. SettingDOVECOT_SUPPORTED_SCHEMESdid silence this behavior.It may or may not have the same origin - personally I don't see why dkim key management should interact with dovecot at all.
Just leaving this here in case someone else has this issue and personally because I believe this might possibly even a bug.
@PatTheMav commented on GitHub (Jan 11, 2023):
That's to be expected - the call to
doveadmis implemented in a check for the application configuration class (where it's called in a list comprehension):github.com/modoboa/modoboa@3714c002c9/modoboa/core/app_settings.py (L534)So every time this object is created,
doveadmwill be called for every available password hashing algorithm because modoboa wants to ensure that only hashing algorithms also supported by the local dovecot instance are available in the Django admin settings.Depending on how the cron job is implemented this settings object will be required and hence these calls will be made.
@tonioo commented on GitHub (Jan 12, 2023):
@PatTheMav Good catch. Indeed, the current implementation does too many calls and we could easily lower it down. The setting was mainly added for cases where dovecot is not available on the same host than Modoboa... Caching the result is a good idea but it means it should be stored somewhere into the database.