[Dovecot] Possible to log IMAP connections to MySQL Table?

Corey Shaw cshaw at q90.com
Wed Dec 24 19:47:24 EET 2008


I've started going down the path of the mail_executable script, but I've run into a snag.  I have a script that works fine and inserts rows into the database as wanted, but whenever I restart the Dovecot service it inserts a row into the database with the USER variable set to "dump-capability" using the IMAP mail_executable.  This doesn't happen with the pop3 mail_executable. 


Below is my configuration for Dovecot 1.1.7.  I'm assuming that the mail_executable(default) value is being run whenever Dovecot restarts.  How do I prevent this from happening?  Can I set the default to an empty string? 



# 1.1.7: /etc/dovecot/dovecot.conf 
# OS: Linux 2.6.26-gentoo-r4 i686 Gentoo Base System release 1.12.11.1 reiserfs 
base_dir: /var/run/dovecot/ 
log_path: /var/log/dovecot/dovecot_error.log 
info_log_path: /var/log/dovecot/dovecot_info.log 
protocols: imap imaps pop3 pop3s 
ssl_cert_file: /etc/ssl/dovecot/server.pem 
ssl_key_file: /etc/ssl/dovecot/server.key 
disable_plaintext_auth: no 
verbose_ssl: yes 
login_dir: /var/run/dovecot/login/ 
login_executable(default): /usr/libexec/dovecot/imap-login 
login_executable(imap): /usr/libexec/dovecot/imap-login 
login_executable(pop3): /usr/libexec/dovecot/pop3-login 
login_greeting_capability(default): yes 
login_greeting_capability(imap): yes 
login_greeting_capability(pop3): no 
login_processes_count: 5 
login_max_processes_count: 25 
max_mail_processes: 256 
mail_max_userip_connections: 5 
verbose_proctitle: yes 
first_valid_uid: 8 
first_valid_gid: 12 
mail_privileged_group: mail 
mail_uid: 8 
mail_gid: 12 
mail_location: maildir:/mail/%d/%n/Maildir 
mail_debug: yes 
mail_executable(default): /etc/dovecot/dovecot-imap.sh 
mail_executable(imap): /etc/dovecot/dovecot-imap.sh 
mail_executable(pop3): /etc/dovecot/dovecot-pop3.sh 
mail_plugins(default): quota imap_quota 
mail_plugins(imap): quota imap_quota 
mail_plugins(pop3): quota 
mail_plugin_dir(default): /usr/lib/dovecot/imap 
mail_plugin_dir(imap): /usr/lib/dovecot/imap 
mail_plugin_dir(pop3): /usr/lib/dovecot/pop3 
pop3_client_workarounds(default): 
pop3_client_workarounds(imap): 
pop3_client_workarounds(pop3): outlook-no-nuls oe-ns-eoh 
auth default: 
  mechanisms: plain login 
  verbose: yes 
  debug: yes 
  debug_passwords: yes 
  passdb: 
    driver: sql 
    args: /etc/dovecot/dovecot-sql.conf 
  userdb: 
    driver: sql 
    args: /etc/dovecot/dovecot-sql.conf 
  userdb: 
    driver: static 
    args: uid=8 gid=12 home=/mail/%d/%n/config 
  socket: 
    type: listen 
    client: 
      path: /var/spool/postfix/private/auth 
      mode: 438 
      user: postfix 
      group: postfix 
    master: 
      path: /var/run/dovecot/auth-master 
      mode: 438 
      user: dovecot 
      group: dovecot 
plugin: 
  quota: maildir:User 
  quota_rule: *:storage=20M 
  quota_rule2: Trash:storage=50M 



Corey 

----- Original Message ----- 
From: "Corey Shaw" <cshaw at q90.com> 
To: "Dovecot Mailing List" <dovecot at dovecot.org> 
Sent: Wednesday, December 24, 2008 8:07:17 AM GMT -07:00 US/Canada Mountain 
Subject: Re: [Dovecot] Possible to log IMAP connections to MySQL Table? 

I'll take a look at the post login scripting.  It sounds like it would be much better than a script that simply tails the log file for any IMAP connections.  Thanks for the help! 



Corey 

----- Original Message ----- 
From: "Pascal Volk" <user+dovecot at localhost.localdomain.org> 
To: "Dovecot Mailing List" <dovecot at dovecot.org> 
Sent: Wednesday, December 24, 2008 1:43:51 AM GMT -07:00 US/Canada Mountain 
Subject: Re: [Dovecot] Possible to log IMAP connections to MySQL Table? 

Am 23.12.2008 21:50 schrieb Corey Shaw: 
> Is it currently possible to log all IMAP connection attempts to a MySQL table?  Thanks. 

If you really want to log _all_ IMAP connections you could create a 
MySQL procedure that will log all interesting data you provide and 
finally returns the data for Dovecots password query. 
If you want to log only successful IMAP logins you should have a look at 
http://wiki.dovecot.org/PostLoginScripting 


Regards, 
Pascal 
-- 
Ubuntu is an ancient African word meaning “I can’t install debian.” 
                                                         -- unknown 


More information about the dovecot mailing list