[Dovecot] FTS question
Please advise:
Can I override the user parameter in solr indexing and searching?
To understand, why I wish for that, please consider my setup:
# Mail is fetched from a remote imap server # dovecot LDA stores into Maildir as system user
# Several virtual users exist in a static userdb # They all share the system users Maildir
# everybody can see, move, delete etc. all the mails # dovecot mail_log plugin is used for audit
So it is like all/only shared folders, isn't it? A cheap groupware, maybe… This works exceptionally well (2.0 and 2.2.11 as of now).
The problem: When e-mails are indexed by solr, the uid of the virtual user is passed on, and only this user will later find that mail in a server side body search.
I tried and made "user" an ignored field in solr schema, but then nothing will ever be found, because it is dropped when indexing, but will be asked for in searching.
So far, what I learned in a day. Maybe someone can help?
Thank You in advance
-- peter
Am 2014-02-13 21:15, schrieb PCh:
Please advise:
Can I override the user parameter in solr indexing and searching?
To understand, why I wish for that, please consider my setup:
# Mail is fetched from a remote imap server # dovecot LDA stores into Maildir as system user
# Several virtual users exist in a static userdb # They all share the system users Maildir
# everybody can see, move, delete etc. all the mails # dovecot mail_log plugin is used for audit
So it is like all/only shared folders, isn't it? A cheap groupware, maybe… This works exceptionally well (2.0 and 2.2.11 as of now).
The problem: When e-mails are indexed by solr, the uid of the virtual user is passed on, and only this user will later find that mail in a server side body search.
I tried and made "user" an ignored field in solr schema, but then nothing will ever be found, because it is dropped when indexing, but will be asked for in searching.
So far, what I learned in a day. Maybe someone can help?
Thank You in advance
What I can think of now:
# proxy solr and cut off the +user part of the fq parameter # this will still index any message multiple times due to different ids # and will return a single message multiple times (if indexed so)
What I wish for: an extra field in passdb "solr_user". I guess, I will not get that, if not compiling from source… What else can I wish for?
-- peter
On 14.2.2014, at 5.15, Peter Chiochetti pch@myzel.net wrote:
Can I override the user parameter in solr indexing and searching?
No, and I think that would the wrong solution for this, because it would have to be repeated for everything in Dovecot that uses username as part of the mailbox identifier.
To understand, why I wish for that, please consider my setup:
# Mail is fetched from a remote imap server # dovecot LDA stores into Maildir as system user
# Several virtual users exist in a static userdb # They all share the system users Maildir
# everybody can see, move, delete etc. all the mails # dovecot mail_log plugin is used for audit
Change the user to be the same for all the users. Use the new %{auth_user} variable in v2.2.11+ for logging the unchanged username in login_log_format_elements and mail_log_prefix instead of using %u.
Am 2014-02-14 05:43, schrieb Timo Sirainen:
On 14.2.2014, at 5.15, Peter Chiochetti pch@myzel.net wrote:
Can I override the user parameter in solr indexing and searching?
No, and I think that would the wrong solution for this, because it would have to be repeated for everything in Dovecot that uses username as part of the mailbox identifier.
Change the user to be the same for all the users. Use the new %{auth_user} variable in v2.2.11+ for logging the unchanged username in login_log_format_elements and mail_log_prefix instead of using %u.
Thank You very much Timo, exactly what I was wishing for!
It took me some time to translate your short script into config, but now it works, so instead of a blog post somewhere, here we go, probably no other changes from the default config:
# There is one system user "crew" where mail comes in. # There are several virtual users, that work with this # mail: move, reply, delete, etc. Think of groupware. # Anybody can do anything, but may have to justify…
# sample line from passwd file # Name:{PLAIN}password passdb { driver = passwd-file args = /etc/dovecot/passwd }
# On authentication, users are switched to "crew" userdb { driver = static args = uid=crew gid=crew home=/home/crew user=crew }
mail_plugins = $mail_plugins fts fts_solr mail_log notify
plugin { # Search fts = solr fts_solr = url=http://sage.bst.lan:8983/solr/ fts_autoindex = yes
# Audit mail_log_prefix = %{auth_user} mail_log_events = save copy delete undelete expunge mailbox_create mailbox_rename mailbox_delete mail_log_fields = uid box msgid from subject }
I have turned off PAM in conf.d/10-auth.conf to avoid waiting for a small timeout. This setup only works for a single system user, another userdb driver should make it coexist with more system users though.
I think its nice if a body search also looks at the subject, so in solr schema write : <copyField source="subject" dest="body"/>
-- peter
A small correction to the previous post. Below complete /etc/dovecot/local.conf file:
# There is one system user "crew" where mail comes in. # There are several virtual users, that work with this # mail: move, reply, delete, etc. Think of groupware. # Anybody can do anything, but may have to justify…
# sample line from passwd file # Name:{PLAIN}password passdb { driver = passwd-file args = /etc/dovecot/passwd }
# On authentication, users are switched to "crew" # This is the user to index and query SOLR userdb { driver = static args = uid=crew gid=crew home=/home/crew user=crew }
# Use Logname from passdb for audit trail mail_log_prefix = "%s(%{auth_user}): "
mail_plugins = $mail_plugins fts fts_solr mail_log notify
plugin { # Search fts = solr fts_solr = url=http://localhost:8983/solr/ fts_autoindex = yes # Audit mail_log_events = save copy delete undelete expunge mailbox_create mailbox_rename mailbox_delete mail_log_fields = uid box msgid from subject }
-- peter
participants (2)
-
Peter Chiochetti
-
Timo Sirainen