[Dovecot] Post login script issue with pop3 protocol
Hi, all.
I want to track user last login data (ip address, login date, etc)
with dovecot, followed dovecot tutorial[1], and it now works with
IMAP, but failed with POP3. i don't know why.
My script:
LDAP_URI='ldap://127.0.0.1:389' LDAP_BASEDN='o=domains,dc=iredmail,dc=org' BIND_DN='cn=vmailadmin,dc=iredmail,dc=org' BIND_PW='plain_passwd'
if [ X"${USER}" != X"dump-capability" ]; then
ldapmodify -c -x
-H "${LDAP_URI}"
-D "${BIND_DN}"
-w "${BIND_PW}" <<EOF
dn: mail=${USER},ou=Users,domainName=$(echo ${USER} | awk -F'@'
'{print $2}'),${LDAP_BASEDN}
changetype: modify
replace: lastLoginDate
lastLoginDate: $(date +%Y%m%d%H%M%SZ)
replace: lastLoginIP lastLoginIP: ${IP}
replace: lastLoginProtocol lastLoginProtocol: pop3 EOF
fi
It works with IMAP protocol, but failed with POP3 protocol. Error msg in Thunderbird:
The STAT command did not succeed. Error getting message number and
sizes.
Mail server r6.iredmail.org responsed: ying entry
"mail=www@a.cn,ou=Users,domainName=a.cn,o=domains,dc=iredmail,dc=org"
[1] Post-login scripting: http://wiki.dovecot.org/PostLoginScripting
-- Best Regards.
Zhang Huangbin
- Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/
On Sat, 2009-10-31 at 23:09 +0800, Zhang Huangbin wrote:
Looks like it writes some error message to POP3 session.
Did you look at Dovecot's error log yet to see if this script logged something?
Log in with telnet to see what exactly it's writing. http://wiki.dovecot.org/TestPop3Installation
On Nov 4, 2009, at 2:42 AM, Timo Sirainen wrote:
No error logs in dovecot log file.
All logs during the telnet testing session:
dovecot: Nov 03 20:45:45 Info: pop3-login: Disconnected (no auth
attempts): rip=192.168.187.1, lip=192.168.187.128
dovecot: Nov 03 20:45:51 Info: pop3-login: Login: user=<www@a.cn>,
method=PLAIN, rip=192.168.187.1, lip=192.168.187.128
dovecot: Nov 03 20:46:08 Info: POP3(www@a.cn): Disconnected: Logged
out top=0/0, retr=1/1453, del=0/1, size=1436
It seems works fine:
$ telnet r6 110
Trying 192.168.187.128...
Connected to r6.
Escape character is '^]'.
+OK Dovecot ready.
user www@a.cn
+OK
pass www
+OK Logged in.
modifying entry
"mail=www@a.cn,ou=Users,domainName=a.cn,o=domains,dc=iredmail,dc=org"
stat +OK 1 1436 retr 1 +OK 1436 octets <Mail content here>
After telnet testing, i use Thunderbird to test it again, but it
failed with same error message i posted in previous mail:
The STAT command did not succeed. Error getting message number and
sizes.
Mail server r6.iredmail.org responsed: ying entry
"mail=www@a.cn,ou=Users,domainName=a.cn,o=domains,dc=iredmail,dc=org"
Is it OK?
-- Best Regards.
Zhang Huangbin
- Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/
On 2009-11-04 09:49:23 +0800, Zhang Huangbin wrote: [[[
modifying entry
"mail=www@a.cn,ou=Users,domainName=a.cn,o=domains,dc=iredmail,dc=org"
]]]
that looks like some debug output from your script which shouldnt be sent to the client
it also reappears in the error message from thunderbird.
darix
-- openSUSE - SUSE Linux is my linux openSUSE is good for you www.opensuse.org
On Nov 5, 2009, at 12:34 AM, Marcus Rueckert wrote:
So it's a dovecot 'bug', right? How can i avoid it?
-- Best Regards.
Zhang Huangbin
- Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/
On Nov 5, 2009, at 3:03 PM, Thomas Wolf wrote:
I guess it's the output from the 'ldapmodify' command in your script. Try to redirect stdout/stderr.
I redirect all stderr and stdout to /dev/null, it works now. :)
Thanks :)
-- Best Regards.
Zhang Huangbin
- Open Source Mail Server Solution for Red Hat(R) Enterprise Linux, CentOS, Debian, Ubuntu: http://www.iredmail.org/
participants (4)
-
Marcus Rueckert
-
Thomas Wolf
-
Timo Sirainen
-
Zhang Huangbin