Post-login scripting

Egbert egbert at vandenbussche.nl
Fri Oct 20 17:36:32 EEST 2017


Op 20-10-2017 om 15:46 schreef j.emerlik:
> Hi ,
> I would like to save every authentication IP addresses to database, for
> IMAP and POP3 everything working correct but I don't know how to configure
> Post-login script for SMTP AUTH.
> 
> Can you help me ?
> 
> Regards,
> Jack
> 
This is how I log te last time someone logged in:

service imap {
.
.
.
  executable = imap imap-postlogin
}

service imap-postlogin {
  executable = script-login /usr/local/bin/imap-wrapper.sh
  user = vmail
  unix_listener imap-postlogin {
  }
}

And for pop3 users:

service pop3 {
.
.
.
  executable = pop3 pop3-postlogin
}

service pop3-postlogin {
  executable = script-login /usr/local/bin/pop3-wrapper.sh
  user = vmail
  unix_listener pop3-postlogin {
  }
}

Where imap_wrapper.sh is:
#! /bin/sh
touch /disk/mail/login/imap/$USER
touch /disk/mail/login/$USER
exec "$@"

And for pop3_wrapper.sh:
#! /bin/sh
touch /disk/mail/login/pop3/$USER
touch /disk/mail/login/$USER
exec "$@"

This gives me empty files in <path>/login, /login/imap and /login/pop3
with the username as filename. The timestamp of the filwe is the lat
login time.

HTH
Egbert Jan, NL



More information about the dovecot mailing list