post-login scripting
Hi, I'm trying to determine the last login time for my IMAP users. Some systems use mbox while others are Maildir, but not sure that matters.
I'd just like to touch a file similar to how it's done in this article, but it doesn't work for me.
https://doc.dovecot.org/admin_manual/post_login_scripting/
I've followed the instructions explicitly - made the required changes to 10-master.conf and created a shell script in /usr/local/bin that touches a file in the user's home directory. However, the file doesn't get created/touched.
I've enabled debugging and don't see any errors that might lead to what I'm doing wrong. It doesn't say explicitly in the article that the last-login script referenced in the article is actually the contents of the postlogin.sh script, but I'm assuming it is?
When I put the following in my dovecot.conf instead of conf.d/10-auth.conf, it core dumps. I thought local changes should be made in dovecot.conf?
service imap-login { executable = imap imap-postlogin inet_listener imap { port = 0 } inet_listener imaps { port = 993 } process_min_avail = 6 service_count = 0 vsz_limit = 512 M } service imap-postlogin { executable = script-login /usr/local/bin/postlogin.sh user = $default_internal_user } service pop3-login { inet_listener pop3 { port = 0 } inet_listener pop3s { port = 995 } }
Hi, I'm trying to determine the last login time for my IMAP users. Some systems use mbox while others are Maildir, but not sure that matters.
I'd just like to touch a file similar to how it's done in this article, but it doesn't work for me.
https://doc.dovecot.org/admin_manual/post_login_scripting/
I've followed the instructions explicitly - made the required changes to 10- master.conf and created a shell script in /usr/local/bin that touches a file in the user's home directory. However, the file doesn't get created/touched.
I've enabled debugging and don't see any errors that might lead to what I'm doing wrong. It doesn't say explicitly in the article that the last-login script referenced in the article is actually the contents of the postlogin.sh script, but I'm assuming it is?
When I put the following in my dovecot.conf instead of conf.d/10-auth.conf, it core dumps. I thought local changes should be made in dovecot.conf?
service imap-login { executable = imap imap-postlogin inet_listener imap { port = 0 } inet_listener imaps { port = 993 } process_min_avail = 6 service_count = 0 vsz_limit = 512 M } service imap-postlogin { executable = script-login /usr/local/bin/postlogin.sh user = $default_internal_user } service pop3-login { inet_listener pop3 { port = 0 } inet_listener pop3s { port = 995 } }
I'm trying to determine the last login time for my IMAP users.
There is already a built in plugin that does this without needing to use scripting. You can use it to save a timestamp to a database.
https://doc.dovecot.org/settings/plugin/last-login-plugin/
https://doc.dovecot.org/configuration_manual/lastlogin_plugin/
I'm trying to determine the last login time for my IMAP users.
There is already a built in plugin that does this without needing to use scripting. You can use it to save a timestamp to a database.
https://doc.dovecot.org/settings/plugin/last-login-plugin/ https://doc.dovecot.org/configuration_manual/lastlogin_plugin/
That's very helpful, thanks. The only trouble I had was that my password had a pound sign in it and apparently it was parsed as a comment:
Jan 18 18:53:28 xavier dovecot[3549186]: dict(3552926): Warning: Configuration file /etc/dovecot/dovecot-dict-sql.conf.ext line 1: Ambiguous '#' character in line, treating it as comment. Add a space before it to remove this warning.
Thanks so much.
> I'm trying to determine the last login time for my IMAP users.
There is already a built in plugin that does this without needing to
use scripting.
You can use it to save a timestamp to a database.
https://doc.dovecot.org/settings/plugin/last-login-plugin/
https://doc.dovecot.org/configuration_manual/lastlogin_plugin/
That's very helpful, thanks. The only trouble I had was that my password had a pound sign in it and apparently it was parsed as a comment:
Jan 18 18:53:28 xavier dovecot[3549186]: dict(3552926): Warning: Configuration file /etc/dovecot/dovecot-dict-sql.conf.ext line 1: Ambiguous '#' character in line, treating it as comment. Add a space before it to remove this warning.
Thanks so much.
Hi,
I'm trying to determine the last login time for my IMAP users.
There is already a built in plugin that does this without needing to use scripting. You can use it to save a timestamp to a database.
https://doc.dovecot.org/settings/plugin/last-login-plugin/ https://doc.dovecot.org/configuration_manual/lastlogin_plugin/
That's very helpful, thanks. The only trouble I had was that my password had a pound sign in it and apparently it was parsed as a comment:
Jan 18 18:53:28 xavier dovecot[3549186]: dict(3552926): Warning: Configuration file /etc/dovecot/dovecot-dict-sql.conf.ext line 1: Ambiguous '#' character in line, treating it as comment. Add a space before it to remove this warning.
I also wanted to ask if it's possible to add the local server name so I can use one database for all systems?
I suppose there's a chance there could be issues with namespace conflicts, but this would make it much easier for me.
Thanks so much.
Hi,
> I'm trying to determine the last login time for my IMAP
users.
There is already a built in plugin that does this without
needing to use scripting.
You can use it to save a timestamp to a database.
https://doc.dovecot.org/settings/plugin/last-login-
plugin/
https://doc.dovecot.org/configuration_manual/
lastlogin_plugin/
That's very helpful, thanks. The only trouble I had was that my
password had a pound sign in it and apparently it was parsed as a
comment:
Jan 18 18:53:28 xavier dovecot[3549186]: dict(3552926): Warning:
Configuration file /etc/dovecot/dovecot-dict-sql.conf.ext line 1:
Ambiguous '#' character in line, treating it as comment. Add a space
before it to remove this warning.
I also wanted to ask if it's possible to add the local server name so I can use one database for all systems?
I suppose there's a chance there could be issues with namespace conflicts, but this would make it much easier for me.
Thanks so much.
I also wanted to ask if it's possible to add the local server name so I can use one database for all systems?
I suppose there's a chance there could be issues with namespace conflicts, but this would make it much easier for me.
Not sure how you are tracking your users, in my setup each user is the full email address with domain. (user@example.com) This way when it saves the time stamp it's associated with the username/email which is unique. My dictionary looks like this...
connect = host=/var/lib/mysql/mysql.sock dbname=mailservice map { pattern = shared/last-login/$user table = lastEmailCheck value_field = last value_type = uint fields { email = $user } }
I don't know if it's same syntax for 2.x versions of Dovecot (I have some notes about requiring "script" simple word preceding path):
https://doc.dovecot.org/3.0/admin_manual/post_login_scripting/
El 18/1/24 a les 2:31, Alex ha escrit:
Hi, I'm trying to determine the last login time for my IMAP users. Some systems use mbox while others are Maildir, but not sure that matters.
I'd just like to touch a file similar to how it's done in this article, but it doesn't work for me.
https://doc.dovecot.org/admin_manual/post_login_scripting/
I've followed the instructions explicitly - made the required changes to 10- master.conf and created a shell script in /usr/local/bin that touches a file in the user's home directory. However, the file doesn't get created/touched.
I've enabled debugging and don't see any errors that might lead to what I'm doing wrong. It doesn't say explicitly in the article that the last-login script referenced in the article is actually the contents of the postlogin.sh script, but I'm assuming it is?
When I put the following in my dovecot.conf instead of conf.d/10-auth.conf, it core dumps. I thought local changes should be made in dovecot.conf?
service imap-login { executable = imap imap-postlogin inet_listener imap { port = 0 } inet_listener imaps { port = 993 } process_min_avail = 6 service_count = 0 vsz_limit = 512 M } service imap-postlogin { executable = script-login /usr/local/bin/postlogin.sh user = $default_internal_user } service pop3-login { inet_listener pop3 { port = 0 } inet_listener pop3s { port = 995 } }
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
--
Narcis Garcia
I'm using this dedicated address because personal addresses aren't masked enough at this mail public archive. Public archive administrator should remove and omit any @, dot and mailto combinations against automated addresses collectors.
On 18/01/2024 02:31, Alex wrote:
Hi, I'm trying to determine the last login time for my IMAP users. Some systems use mbox while others are Maildir, but not sure that matters.
I'd just like to touch a file similar to how it's done in this article, but it doesn't work for me.
https://doc.dovecot.org/admin_manual/post_login_scripting/
I've followed the instructions explicitly - made the required changes to 10- master.conf and created a shell script in /usr/local/bin that touches a file in the user's home directory. However, the file doesn't get created/touched.
I've enabled debugging and don't see any errors that might lead to what I'm doing wrong. It doesn't say explicitly in the article that the last-login script referenced in the article is actually the contents of the postlogin.sh script, but I'm assuming it is?
When I put the following in my dovecot.conf instead of conf.d/10-auth.conf, it core dumps. I thought local changes should be made in dovecot.conf?
service imap-login { executable = imap imap-postlogin inet_listener imap { port = 0 } inet_listener imaps { port = 993 } process_min_avail = 6 service_count = 0 vsz_limit = 512 M } service imap-postlogin { executable = script-login /usr/local/bin/postlogin.sh user = $default_internal_user } service pop3-login { inet_listener pop3 { port = 0 } inet_listener pop3s { port = 995 } }
Hi Alex
I notice you didn't define the listner socket. You're missing this inside your imap-postlogin service definition:
unix_listener imap-postlogin { }
John
On 18/01/2024 02:31, Alex wrote: Hi, I'm trying to determine the last login time for my IMAP users. Some systems use mbox while others are Maildir, but not sure that matters.
I'd just like to touch a file similar to how it's done in this
article, but it
doesn't work for me.
https://doc.dovecot.org/admin_manual/post_login_scripting/
I've followed the instructions explicitly - made the required changes
to 10-
master.conf and created a shell script in /usr/local/bin that touches
a file in
the user's home directory. However, the file doesn't get created/
touched.
I've enabled debugging and don't see any errors that might lead to
what I'm
doing wrong. It doesn't say explicitly in the article that the last-
login
script referenced in the article is actually the contents of the
postlogin.sh
script, but I'm assuming it is?
When I put the following in my dovecot.conf instead of conf.d/10-
auth.conf, it
core dumps. I thought local changes should be made in dovecot.conf?
service imap-login {
executable = imap imap-postlogin
inet_listener imap {
port = 0
}
inet_listener imaps {
port = 993
}
process_min_avail = 6
service_count = 0
vsz_limit = 512 M
}
service imap-postlogin {
executable = script-login /usr/local/bin/postlogin.sh
user = $default_internal_user
}
service pop3-login {
inet_listener pop3 {
port = 0
}
inet_listener pop3s {
port = 995
}
}
Hi Alex I notice you didn't define the listner socket. You're missing this inside your imap-postlogin service definition: unix_listener imap-postlogin { } John
Hi,
When I put the following in my dovecot.conf instead of conf.d/10-
auth.conf, it core dumps. I thought local changes should be made in dovecot.conf? service imap-login { executable = imap imap-postlogin inet_listener imap { port = 0 } inet_listener imaps { port = 993 } process_min_avail = 6 service_count = 0 vsz_limit = 512 M } service imap-postlogin { executable = script-login /usr/local/bin/postlogin.sh user = $default_internal_user } service pop3-login { inet_listener pop3 { port = 0 } inet_listener pop3s { port = 995 } }
Hi Alex I notice you didn't define the listner socket. You're missing this inside your imap-postlogin service definition: unix_listener imap-postlogin { }
Okay, thanks. Although I have it working with the last_login plugin now, I'm still interested in figuring out what went wrong with postlogin and how I can use it for other things as well.
It no longer core dumps, but it also doesn't touch the ~/.last_login file in the user's home directory either.
How can I troubleshoot this further? I thought I would see a postlogin socket after adding the listener line, but I don't see anything with lsof.
Other ideas greatly appreciated.
Hi,
When I put the following in my dovecot.conf instead of conf.d/
10-
auth.conf, it
core dumps. I thought local changes should be made in
dovecot.conf?
service imap-login {
executable = imap imap-postlogin
inet_listener imap {
port = 0
}
inet_listener imaps {
port = 993
}
process_min_avail = 6
service_count = 0
vsz_limit = 512 M
}
service imap-postlogin {
executable = script-login /usr/local/bin/postlogin.sh
user = $default_internal_user
}
service pop3-login {
inet_listener pop3 {
port = 0
}
inet_listener pop3s {
port = 995
}
}
Hi Alex
I notice you didn't define the listner socket. You're missing this
inside your
imap-postlogin service definition:
unix_listener imap-postlogin {
}
Okay, thanks. Although I have it working with the last_login plugin now, I'm still interested in figuring out what went wrong with postlogin and how I can use it for other things as well.
It no longer core dumps, but it also doesn't touch the ~/.last_login file in the user's home directory either.
How can I troubleshoot this further? I thought I would see a postlogin socket after adding the listener line, but I don't see anything with lsof.
Other ideas greatly appreciated.
participants (4)
-
Alex
-
dovecot@ptld.com
-
John Fawcett
-
Narcis Garcia