Using sqlite as dict for last_auth plugin

Oleg petol petol777 at gmail.com
Tue Oct 4 14:37:51 UTC 2022


Hi!

It is required to collect statistics about the time of the last IMAP and
POP3 login of the user and the delivery of letters to him via lmtp.
The last-login plugin is perfect.
But I don't want to use heavy databases as the mail system service is
served by the Oracle DB.

The most suitable option, as I see, is to store statistics in the sqlite
DB, but after going through all the options in the configuration file, I
could not use sqlite.

When writing in configuration:
plugin {
  driver=sqlite
  last_login_dict = sqlite:statsdb
  last_login_key = last-login/%s/%u/%r
  last_login_precision = ms
}

I am getting an error:
Oct  4 17:01:41 nms4 dovecot:
imap(new_ver_test at test2.aroma.ru)<154597><q0VJ5jXq9o4KAQDI>:
Error: last_login_dict: dict_init(sqlite:statsdb) failed: Unknown dict
module: sqlite

I did the last-login plugin setup exactly according to the instructions:
https://doc.dovecot.org/configuration_manual/mail_location/obox/last_login_plugin/

I am using standard debian packages.
Desperate, I built latest dovecot version from source, but got exactly the
same error.

Tell me, please, is it possible to use a dictionary in sqlite format to
collect last-login plugin statistics?
And how should I describe it in the configuration file?

Sincerely,
Oleg

Additional Information:

# /sbin/dovecot --build-options
Build options: ioloop=epoll notify=inotify openssl io_block_size=8192
SQL driver plugins: mysql postgresql sqlite
Passdb: checkpassword ldap pam passwd passwd-file shadow sql
Userdb: checkpassword ldap(plugin) passwd prefetch passwd-file sql

# /sbin/dovecot -n
# 2.3.13 (89f716dc2): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.5.13 (cdd19fe3)
# OS: Linux 5.10.0-18-amd64 x86_64 Debian 11.5
# Hostname: nms4.some.host
auth_default_realm = some.host
auth_verbose = yes
dict {
  statsdb = sqlite:/etc/dovecot/dovecot-dict-sql.conf.ext
}
disable_plaintext_auth = no
first_valid_uid = 89
mail_debug = yes
mail_gid = vmail
mail_location = maildir:~/Maildir
mail_plugins = quota
mail_privileged_group = mail
mail_uid = vmail
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
copy include variables body enotify environment mailbox date index ihave
duplicate mime foreverypart extracttext
namespace inbox {
  inbox = yes
  location =
  mailbox Drafts {
    special_use = \Drafts
  }
  mailbox Junk {
    special_use = \Junk
  }
  mailbox Sent {
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    special_use = \Trash
  }
  prefix =
}
passdb {
  args = username_format=%u /etc/postfix/vusers.conf
  driver = passwd-file
}
plugin {
  driver = sqlite
  last_login_dict = sqlite:statsdb
  last_login_key = # hidden, use -P to show it
  last_login_precision = ms
  quota = maildir
  quota_grace = 10%%
  sieve = file:~/sieve;active=~/.dovecot.sieve
}
protocols = " imap lmtp sieve pop3 sieve"
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-userdb {
    group = vmail
    user = vmail
  }
}
service lmtp {
  executable = lmtp -L
  inet_listener lmtp {
    address = 10.1.0.187
    port = 24
  }
  process_min_avail = 5
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
  user = vmail
}
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
}
ssl_cert = </etc/letsencrypt/live/some.host/fullchain.pem
ssl_client_ca_dir = /etc/ssl/certs
ssl_dh = # hidden, use -P to show it
ssl_key = # hidden, use -P to show it
userdb {
  args = username_format=%u /etc/postfix/vusers.conf
  driver = passwd-file
  override_fields = uid=vmail gid=vmail
}
protocol lmtp {
  info_log_path = /var/log/dovecot-lmtp.log
  mail_plugins = quota sieve quota last_login
}
protocol imap {
  mail_plugins = quota imap_quota last_login
}
protocol sieve {
  managesieve_max_line_length = 64 k
}
protocol pop3 {
  mail_plugins = quota last_login
}

-- 
/petol
http://kab.tv/rus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://dovecot.org/pipermail/dovecot/attachments/20221004/a2098001/attachment.htm>


More information about the dovecot mailing list