Re: Last_login plugin and mysql

2018-09-24 Thread Thomas Hooge
Hello, last_login plugin uses dict interface, which does not support "update", it only supports get, set, unset and atomic inc. Set is implemented with 'INSERT INTO foo ... ON DUPLICATE UPDATE'. There is no configuration setting to change this, as dict cannot know without performing a SELECT

Re: Last_login plugin and mysql

2018-09-24 Thread Aki Tuomi
On 23.09.2018 19:20, Thomas Hooge wrote: > Hello, > > i have problems configuring the last_login plugin with mysql. > > I have extended the postfixadmin database with a new field, > configured the plugin as described in the wiki. > > Finally i got errors: table is not

Last_login plugin and mysql

2018-09-23 Thread Thomas Hooge
Hello, i have problems configuring the last_login plugin with mysql. I have extended the postfixadmin database with a new field, configured the plugin as described in the wiki. Finally i got errors: table is not writable, INSERT failed. Why is the insert required? The plugin should only UPDATE

Re: Dovecot last_login plugin and Mysql

2017-04-29 Thread Aki Tuomi
I tried with following config, and it seems to work at least for me: map { pattern = shared/last-login/$user table = users value_field = last_login value_type = uint fields { userid = $user } } last_login and userid are SQL table's field name. Aki > On April 29, 2017 at 4:28

Re: Dovecot last_login plugin and Mysql

2017-04-28 Thread David Mehler
Hi, Thanks for the pointing out of the oops! I missed that. Don't worry that has been changed. Any suggestions on my issue? Thanks. Dave. On 4/28/17, David Mehler wrote: > Hi, > > OOPS! I missed that one and it was big. > > Changing now. > > Thanks. > Dave. > > > On

Re: Dovecot last_login plugin and Mysql

2017-04-28 Thread David Mehler
Hello, Here is the requested file: driver = mysql connect = host=/tmp/mysql.sock dbname=mail user=mail_admin password=MainBoard55 # Last Login map { pattern = shared/last-login/$user table = virtual_users username_field = user value_field = lastlogin fields { user = $user } }

Re: Dovecot last_login plugin and Mysql

2017-04-28 Thread Aki Tuomi
> On April 29, 2017 at 12:29 AM David Mehler wrote: > > > Hello, > > Trying to implement lastlogin via mysql. I'm getting an unknown column > username which I don't get. Here's the log: > > Apr 28 17:18:15 ohio dovecot: imap-login: Login: > user=,

Re: Dovecot last_login plugin and Mysql

2017-04-28 Thread David Mehler
e: >> > >> >> On April 28, 2017 at 8:08 PM David Mehler <dave.meh...@gmail.com> >> >> wrote: >> >> >> >> >> >> Hello, >> >> >> >> Is anyone using the last_login plugin with a Mysql database? I'd like >> >> to track when users were last on the system. >> >> >> >> Thanks. >> >> Dave. >> > >> > It's used by our customers. >> > >> > Aki >> > >

Re: Dovecot last_login plugin and Mysql

2017-04-28 Thread Aki Tuomi
tu...@dovecot.fi> wrote: > > > >> On April 28, 2017 at 8:08 PM David Mehler <dave.meh...@gmail.com> wrote: > >> > >> > >> Hello, > >> > >> Is anyone using the last_login plugin with a Mysql database? I'd like > >> to track when users were last on the system. > >> > >> Thanks. > >> Dave. > > > > It's used by our customers. > > > > Aki > >

Re: Dovecot last_login plugin and Mysql

2017-04-28 Thread David Mehler
Hi Aki, Thanks. Can you tell me how you implemented it? Thanks. Dave. On 4/28/17, Aki Tuomi <aki.tu...@dovecot.fi> wrote: > >> On April 28, 2017 at 8:08 PM David Mehler <dave.meh...@gmail.com> wrote: >> >> >> Hello, >> >> Is anyone using th

Re: Dovecot last_login plugin and Mysql

2017-04-28 Thread Aki Tuomi
> On April 28, 2017 at 8:08 PM David Mehler <dave.meh...@gmail.com> wrote: > > > Hello, > > Is anyone using the last_login plugin with a Mysql database? I'd like > to track when users were last on the system. > > Thanks. > Dave. It's used by our customers. Aki

Dovecot last_login plugin and Mysql

2017-04-28 Thread David Mehler
Hello, Is anyone using the last_login plugin with a Mysql database? I'd like to track when users were last on the system. Thanks. Dave.

Re: last_login plugin with MySQL

2014-10-20 Thread Steffen Kaiser
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Sun, 19 Oct 2014, Michael Cramer wrote: Gedalya wrote on 18/10/2014 17:36: The code looks at shared/$last_login_key, so shared/last-login/username, but your map says /shared/last-login/$user, note the leading slash! That's probably all it is.

Re: last_login plugin with MySQL

2014-10-20 Thread Joseph Tam
Michael Cramer mich...@bigmichi1.de writes: anybody knows how this can be achieved with postgresql, because 'ON DUPLICATE KEY UPDATE' syntax is mysql specific A clear, concise explanation of consistency problems with SQL update-or-insert (upsert) operation, including a PostgreSQL

Re: last_login plugin with MySQL

2014-10-19 Thread Michael Cramer
Zitat von Luigi Rosa li...@luigirosa.com: Gedalya wrote on 18/10/2014 17:36: The code looks at shared/$last_login_key, so shared/last-login/username, but your map says /shared/last-login/$user, note the leading slash! That's probably all it is. BINGO! Now that we killed the mosters of

Re: last_login plugin with MySQL

2014-10-19 Thread Gedalya
On 10/19/2014 04:10 AM, Michael Cramer wrote: Zitat von Luigi Rosa li...@luigirosa.com: Gedalya wrote on 18/10/2014 17:36: The code looks at shared/$last_login_key, so shared/last-login/username, but your map says /shared/last-login/$user, note the leading slash! That's probably all it is.

last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
Hi, I have a Dovecot test installation with MySQL userbase and authentication where I am trying to setup last_login plugin with SQL dictionary I read http://wiki2.dovecot.org/Plugins/LastLogin and I addes this to my configuration plugin { last_login_dict =

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luigi Rosa wrote on 18/10/2014 11:29: Hi, I have a Dovecot test installation with MySQL userbase and authentication where I am trying to setup last_login plugin with SQL dictionary I figured out I have to use dovecot-dict-sql.conf.ext instead of

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 09:33 AM, Luigi Rosa wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luigi Rosa wrote on 18/10/2014 11:29: Hi, I have a Dovecot test installation with MySQL userbase and authentication where I am trying to setup last_login plugin with SQL dictionary I figured out I have to

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:05 AM, Gedalya wrote: On 10/18/2014 09:33 AM, Luigi Rosa wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Luigi Rosa wrote on 18/10/2014 11:29: Hi, I have a Dovecot test installation with MySQL userbase and authentication where I am trying to setup last_login plugin with

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 16:10: I guess you have to use the proxy. So maybe something like plugin { last_login_dict = proxy::lastlogin } dict { lastlogin = mysql:/etc/dovecot/dovecot-dict-sql.conf.ext } I'll try it later myself,

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:37 AM, Luigi Rosa wrote: But I get two errors. First is the permission of /var/run/dovecot/dict that is 700 root.root and I get a permission error. Nothing changes if I put user = root. I have to manually chmod /var/run/dovecot/dict every time I restart Dovecot otherwise I

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:48 AM, Gedalya wrote: If I chmod 777 /var/run/dovecot/dict the error disappears but I get this: dovecot: imap-login: Login: user=username, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=497913, secured, session=6R0mYbMFFwB/AAAB dovecot: dict: Error: sql dict set:

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 11:02 AM, Gedalya wrote: On 10/18/2014 10:48 AM, Gedalya wrote: If I chmod 777 /var/run/dovecot/dict the error disappears but I get this: dovecot: imap-login: Login: user=username, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=497913, secured, session=6R0mYbMFFwB/AAAB

Re: last_login plugin with MySQL

2014-10-18 Thread Gedalya
On 10/18/2014 10:37 AM, Luigi Rosa wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 16:10: I guess you have to use the proxy. So maybe something like plugin { last_login_dict = proxy::lastlogin } dict { lastlogin =

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 16:48: service dict { unix_listener dict { mode = 0660 user = vmail #group = } } That solved the permission issue, thanks! Ciao, luigi - -- / +--[Luigi Rosa]-- \ Only one human captain has ever survived battle

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gedalya wrote on 18/10/2014 17:36: The code looks at shared/$last_login_key, so shared/last-login/username, but your map says /shared/last-login/$user, note the leading slash! That's probably all it is. BINGO! Now that we killed the mosters of

Re: last_login plugin with MySQL

2014-10-18 Thread Sven Hartge
Luigi Rosa li...@luigirosa.com wrote: I was expecting an UPDATE...WHERE but I got this: INSERT INTO mailbox (lastlogin,username) VALUES ('1413647370','username') ON DUPLICATE KEY UPDATE lastlogin='1413647370' This is not very useful if I want a `lastlogin` field of the `mailbox` table

Re: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Sven Hartge wrote on 18/10/2014 18:07: This SQL query looks correct to me. It INSERTs a new row for a username if one does not already exist but UPDATEs it if there is already such a row. My fault: I didn't know this SQL syntax. In fact the field

Re: last_login plugin with MySQL

2014-10-18 Thread Sven Hartge
Luigi Rosa li...@luigirosa.com wrote: Sven Hartge wrote on 18/10/2014 18:07: This SQL query looks correct to me. It INSERTs a new row for a username if one does not already exist but UPDATEs it if there is already such a row. My fault: I didn't know this SQL syntax. It is incredibly

Recap: last_login plugin with MySQL

2014-10-18 Thread Luigi Rosa
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 With many thanks to Gedalya and Sven Hartge Situation: Dovecot installation with userbase in a MySQL table with the same structure described in Postfix.Admin installation; filesystem permission is flat with a single user (vmail) who owns maildir