Zitat von Michael Borgelt via dovecot <[email protected]>:

Hello,
I am trying to configure last-login plugin for dovecot 2.4.1 and getting the following error.

doveconf -n
# 2.4.1-4 (7d8c0e5759): /etc/dovecot/dovecot.conf
# Pigeonhole version 2.4.1-4 (0a86619f)
doveconf: Fatal: Error in configuration file /etc/dovecot/conf.d/30-lastlogin.conf line 24: pattern: Unknown setting: pattern (dict_map_key_field_pattern or dict_map_key_field_service_pattern not found either.)

I am using the example config from the dovecot 2.4 documentation. https://doc.dovecot.org/2.4.0/core/plugins/last_login.html#mysql-example

Is this a bug in the config parser or in the example config?

doveconf -n output with pattern lines in 30-lastlogin.conf commented:

# 2.4.1-4 (7d8c0e5759): /etc/dovecot/dovecot.conf
# Pigeonhole version 2.4.1-4 (0a86619f)
# OS: Linux 6.12.27-amd64 x86_64 Debian 13.0
# Hostname: debian.dg4yfa.org
# 4 default setting changes since version 2.4.0
dovecot_config_version = 2.4.0
auth_mechanisms = plain login
auth_username_format = %{user|username|lower}
dovecot_storage_version = 2.4.0
first_valid_uid = 1000
fts_autoindex = yes
fts_autoindex_max_recent_msgs = 999
fts_search_add_missing = yes
imapsieve_url = sieve://127.0.0.1:4190
language_filters = normalizer-icu snowball stopwords
language_tokenizers = generic email-address
last_valid_uid = 65530
lda_mailbox_autocreate = yes
mail_driver = maildir
mail_inbox_path = ~/Maildir/.INBOX
mail_path = ~/Maildir
mail_plugins {
 virtual = yes
 fts = yes
 fts_flatcurve = yes
 quota = yes
}
mail_privileged_group = mail
protocols {
 imap = yes
 lmtp = yes
 sieve = yes
 pop3 = yes
}
quota_storage_size = 1G
sieve_execute_bin_dir = /usr/share/dovecot-pigeonhole/sieve
sieve_global_extensions {
 vnd.dovecot.pipe = yes
 vnd.dovecot.execute = yes
}
sieve_pipe_bin_dir = /usr/share/dovecot-pigeonhole/sieve
sieve_plugins = sieve_imapsieve sieve_extprograms
passdb pam {
}
userdb passwd {
 result_failure = return-fail
 result_success = continue
}
userdb passwd-file {
 auth_username_format = %{user | username}
 passwd_file_path = /etc/dovecot/users
 driver = passwd-file
 result_failure = return-ok
 result_internalfail = continue
}
namespace inbox {
 inbox = yes
 mailbox Drafts {
   special_use = "\\Drafts"
 }
 mailbox Entw&APw-rfe {
   special_use = "\\Drafts"
 }
 mailbox Junk {
   special_use = "\\Junk"
 }
 mailbox Spam {
   special_use = "\\Junk"
 }
 mailbox Trash {
   special_use = "\\Trash"
   quota_storage_extra = 100M
 }
 mailbox Sent {
   special_use = "\\Sent"
 }
 mailbox "Sent Messages" {
   special_use = "\\Sent"
 }
}
service imap-login {
 inet_listener imap {
 }
 inet_listener imaps {
 }
}
service pop3-login {
 inet_listener pop3 {
 }
 inet_listener pop3s {
 }
}
service submission-login {
 inet_listener submission {
 }
 inet_listener submissions {
 }
}
service lmtp {
 unix_listener lmtp {
 }
}
service imap {
}
service pop3 {
}
service submission {
}
service auth {
 unix_listener auth-userdb {
 }
}
service auth-worker {
}
service dict {
 unix_listener dict {
 }
}
ssl_server {
 cert_file = /etc/dovecot/private/dovecot.pem
 key_file = /etc/dovecot/private/dovecot.key
}
protocol lda {
 mail_plugins {
   sieve = yes
 }
}
namespace virtual {
 mail_driver = virtual
 mail_path = ~/Maildir/virtual
 prefix = virtual.
 separator = .
}
protocol imap {
 mail_plugins {
   imap_sieve = yes
   virtual = yes
   imap_quota = yes
   last_login = yes
 }
}
protocol lmtp {
 auth_username_format = %{user | username | lower}
 mail_plugins {
   sieve = yes
 }
}
service managesieve-login {
 inet_listener sieve {
   port = 4190
 }
 inet_listener sieve_deprecated {
   port = 2000
 }
}
service managesieve {
}
last_login {
 key = # hidden, use -P to show it
 precision = ms
 dict proxy {
   name = sql
 }
}
dict_server {
 dict sql {
   sql_driver = mysql
   mysql localhost {
     dbname = vmail
     password = # hidden, use -P to show it
     user = vmail
   }
   dict_map "shared/last-login/$service/$user/$remote_ip" {
     sql_table = last_login
     dict_map_value_field last_access {
       type = uint
     }
     dict_map_key_field service {
     }
     dict_map_key_field userid {
     }
     dict_map_key_field last_ip {
     }
   }
 }
}
language de {
 filters = lowercase snowball
}
language en {
 default = yes
 filters = lowercase snowball english-possessive stopwords
}
fts flatcurve {
 substring_search = yes
}
quota "User quota" {
 driver = count
 quota_warning warn-95 {
   quota_storage_percentage = 95
   execute quota-warning {
     args = 95 %{user}
   }
 }
 quota_warning warn-80 {
   quota_storage_percentage = 80
   execute quota-warning {
     args = 80 %{user}
   }
 }
}
service quota-warning {
 executable = script /usr/local/bin/quota-warning.sh
 user = dovecot
 unix_listener quota-warning {
   user = Debian-exim
 }
}
sieve_script personal {
 active_path = ~/.dovecot.sieve
 driver = file
 path = ~/sieve
}
sieve_script default {
 driver = file
 name = default
 path = /etc/dovecot/sieve/default/
 type = default
}
mailbox Spam {
 sieve_script report-spam {
   cause = copy
   path = /usr/lib/dovecot/sieve/report-spam.sieve
   type = before
 }
}
imapsieve_from Spam {
 sieve_script report-ham {
   cause = copy
   path = /usr/lib/dovecot/sieve/report-ham.sieve
   type = before
 }
}

Thank you,
Michael


--
Michael Borgelt
Email: [email protected]

_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Hello.
I was able to solve the problem by replacing 'pattern' in 'dict_map' configuration with 'value'. With the following config the last_login table in mysql is getting filled as expected:

last_login {
   dict proxy {
     name = sql
   }
   key = last-login/%{service}/%{user}/%{remote_ip}
   precision = ms
}

dict_server {
   dict sql {
     sql_driver = mysql
     mysql sql.example.com {
       dbname = mails
       user = dovecot
       password = pass
     }

     dict_map shared/last-login/$service/$user/$remote_ip {
       sql_table = last_login
       value_field last_access {
         type = uint
       }

       key_field userid {
         value = $user
       }
       key_field service {
         value = $service
       }
       key_field last_ip {
         value = $remote_ip
       }
     }
   }
}

The example in the dovecot documentation should be updated accordingly.

Regards
Michael.

--
Michael Borgelt
Email: [email protected]


--
Michael Borgelt
Email: [email protected]

_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to