Re: LastLogin update

2019-08-12 Thread Reio Remma via dovecot

Hello!

Does it update the remote ip for you if you already have a row for a 
user? I'm experimenting with a similar feature and it seems to be 
updating only the login time. I think it figures the other fields are 
all part of the primary key and therefore not supplied to ON DUPLICATE 
KEY UPDATE ...


Thanks,
Reio


On 24.06.2019 17:25, Júlio Covolato via dovecot wrote:


Em 22/06/2019 22:41, Zhang Huangbin via dovecot escreveu:


On Jun 23, 2019, at 4:43 AM, @lbutlr via dovecot 
 wrote:



https://docs.iredmail.org/track.user.last.login.html

This is cool, but I have a question:


For MySQL/MariaDB backends, we create the sql table in database vmail.
Would this interfere with or confuse postfixadmin? I use that so 
that users can update their own passwords and domain admins can add 
users and aliases.
The document is for iRedMail, it supports storing mail accounts in 
SQL or OpenLDAP, that's why the document mentions the difference.

You're free to use any database on your own mail server.


Zhang Huangbin, founder of iRedMail project: https://www.iredmail.org/


What I did:

#$ cat dovecot-last-login.conf

connect = host=127.0.0.1 port=3306 dbname=vmail user=vmailadmin 
password=xxx


map {
    pattern = shared/last-login/$user/$domain/$rip/$service
    table = last_login
    value_field = last_login
    value_type = uint

    fields {
    username = $user
    domain = $domain
    rip = $rip
    proto = $service
    }
}

--

dovecot.conf:

plugin {

...

...

    # Track last login time on imap and pop3
    last_login_dict = proxy::lastlogin
    last_login_key = last-login/%u/%d/%r/%s
}

Result on mysql:

mysql> select * from last_login where username = 'ju...@xxx.com.br';
+--+++---+---+
| username | domain | last_login | rip   | proto |
+--+++---+---+
| ju...@xxx.com.br | xxx.com.br | 1559921589 | 177.xxx.xxx.230 | imap  |
+--+++---+---+
1 row in set (0.00 sec)


--
    _    Engº Julio Cesar Covolato
   0v0   
  /(_)\  F: +55 11 99175-9260
   ^ ^   PSI INTERNET
--


---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus





RE: LastLogin update

2019-06-26 Thread Jorge Bastos via dovecot
Cool thanks,

 

From: dovecot  On Behalf Of Júlio Covolato via 
dovecot
Sent: 25 de junho de 2019 17:06
To: dovecot@dovecot.org
Subject: Re: LastLogin update

 

 

Em 24/06/2019 18:39, Jorge Bastos via dovecot escreveu:

Hi Julio,
 
Could you share with us your "acl" config for shared folder?
May be interesting for me,
 
Jorge,

 

Hi Jorge.

Currently I'm not using the shared folder.
Maybe you could be interested in this tutorial from iRedmail:

https://docs.iredmail.org/public.folder.html

--
_Engº Julio Cesar Covolato
   0v0<mailto:ju...@psi.com.br> 
  /(_)\  F: +55 11 99175-9260
   ^ ^   PSI INTERNET
--

 


 
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=emailclient>
 

Livre de vírus.  
<https://www.avast.com/sig-email?utm_medium=email_source=link_campaign=sig-email_content=emailclient>
 www.avast.com. 

 



Re: LastLogin update

2019-06-25 Thread Júlio Covolato via dovecot


Em 24/06/2019 18:39, Jorge Bastos via dovecot escreveu:

Hi Julio,

Could you share with us your "acl" config for shared folder?
May be interesting for me,

Jorge,



Hi Jorge.

Currently I'm not using the shared folder.
Maybe you could be interested in this tutorial from iRedmail:

https://docs.iredmail.org/public.folder.html

--
_Engº Julio Cesar Covolato
   0v0   
  /(_)\  F: +55 11 99175-9260
   ^ ^   PSI INTERNET
--



---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus


RE: LastLogin update

2019-06-24 Thread Jorge Bastos via dovecot
Hi Julio,

Could you share with us your "acl" config for shared folder?
May be interesting for me,

Jorge,

-Original Message-
From: dovecot  On Behalf Of Júlio Covolato via
dovecot
Sent: Monday, June 24, 2019 16:15
To: dovecot@dovecot.org
Subject: Re: LastLogin update


Em 24/06/2019 11:48, @lbutlr via dovecot escreveu:
> On 24 Jun 2019, at 08:25, Júlio Covolato via dovecot 
wrote:
>> #$ cat dovecot-last-login.conf
> [ … ]
>
>> dovecot.conf:
>>
>> plugin {
>>  # Track last login time on imap and pop3
>>  last_login_dict = proxy::lastlogin
>>  last_login_key = last-login/%u/%d/%r/%s }
> Thank you, that is very clear.
>
> Where is the file dovecot-last-login.conf referenced in the dovecot.conf?
Or it is enabled by virtue of being in conf.d/?

Sory, forgot this:

dovecot.conf:

dict {
     #expire = db:/var/lib/dovecot/expire/expire.db
     quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
     lastlogin = mysql:/etc/dovecot/dovecot-last-login.conf
     acl = mysql:/etc/dovecot/dovecot-share-folder.conf
}


--
 _Engº Julio Cesar Covolato
0v0   
   /(_)\  F: +55 11 99175-9260
^ ^   PSI INTERNET
--




---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus




Re: LastLogin update

2019-06-24 Thread Júlio Covolato via dovecot



Em 24/06/2019 11:48, @lbutlr via dovecot escreveu:

On 24 Jun 2019, at 08:25, Júlio Covolato via dovecot  
wrote:

#$ cat dovecot-last-login.conf

[ … ]


dovecot.conf:

plugin {
 # Track last login time on imap and pop3
 last_login_dict = proxy::lastlogin
 last_login_key = last-login/%u/%d/%r/%s
}

Thank you, that is very clear.

Where is the file dovecot-last-login.conf referenced in the dovecot.conf? Or it 
is enabled by virtue of being in conf.d/?


Sory, forgot this:

dovecot.conf:

dict {
    #expire = db:/var/lib/dovecot/expire/expire.db
    quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
    lastlogin = mysql:/etc/dovecot/dovecot-last-login.conf
    acl = mysql:/etc/dovecot/dovecot-share-folder.conf
}


--
_Engº Julio Cesar Covolato
   0v0   
  /(_)\  F: +55 11 99175-9260
   ^ ^   PSI INTERNET
--




---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus



Re: LastLogin update

2019-06-24 Thread @lbutlr via dovecot
On 24 Jun 2019, at 08:25, Júlio Covolato via dovecot  
wrote:
> #$ cat dovecot-last-login.conf

[ … ]

> dovecot.conf:
> 
> plugin {
> # Track last login time on imap and pop3
> last_login_dict = proxy::lastlogin
> last_login_key = last-login/%u/%d/%r/%s
> }

Thank you, that is very clear.

Where is the file dovecot-last-login.conf referenced in the dovecot.conf? Or it 
is enabled by virtue of being in conf.d/?


-- 
"I hate to advocate drugs, alcohol, violence, or insanity to anyone, but
they've always worked for me." --Hunter Thompson




Re: LastLogin update

2019-06-24 Thread Júlio Covolato via dovecot



Em 22/06/2019 22:41, Zhang Huangbin via dovecot escreveu:



On Jun 23, 2019, at 4:43 AM, @lbutlr via dovecot  wrote:


https://docs.iredmail.org/track.user.last.login.html

This is cool, but I have a question:


For MySQL/MariaDB backends, we create the sql table in database vmail.

Would this interfere with or confuse postfixadmin? I use that so that users can 
update their own passwords and domain admins can add users and aliases.

The document is for iRedMail, it supports storing mail accounts in SQL or 
OpenLDAP, that's why the document mentions the difference.
You're free to use any database on your own mail server.


Zhang Huangbin, founder of iRedMail project: https://www.iredmail.org/


What I did:

#$ cat dovecot-last-login.conf

connect = host=127.0.0.1 port=3306 dbname=vmail user=vmailadmin 
password=xxx


map {
    pattern = shared/last-login/$user/$domain/$rip/$service
    table = last_login
    value_field = last_login
    value_type = uint

    fields {
    username = $user
    domain = $domain
    rip = $rip
    proto = $service
    }
}

--

dovecot.conf:

plugin {

...

...

    # Track last login time on imap and pop3
    last_login_dict = proxy::lastlogin
    last_login_key = last-login/%u/%d/%r/%s
}

Result on mysql:

mysql> select * from last_login where username = 'ju...@xxx.com.br';
+--+++---+---+
| username | domain | last_login | rip   | proto |
+--+++---+---+
| ju...@xxx.com.br | xxx.com.br | 1559921589 | 177.xxx.xxx.230 | imap  |
+--+++---+---+
1 row in set (0.00 sec)


--
_Engº Julio Cesar Covolato
   0v0   
  /(_)\  F: +55 11 99175-9260
   ^ ^   PSI INTERNET
--


---
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus



Re: LastLogin update

2019-06-22 Thread Zhang Huangbin via dovecot



> On Jun 23, 2019, at 4:43 AM, @lbutlr via dovecot  wrote:
> 
>> https://docs.iredmail.org/track.user.last.login.html
> 
> This is cool, but I have a question:
> 
>> For MySQL/MariaDB backends, we create the sql table in database vmail.
> 
> Would this interfere with or confuse postfixadmin? I use that so that users 
> can update their own passwords and domain admins can add users and aliases.

The document is for iRedMail, it supports storing mail accounts in SQL or 
OpenLDAP, that's why the document mentions the difference.
You're free to use any database on your own mail server.


Zhang Huangbin, founder of iRedMail project: https://www.iredmail.org/



Re: LastLogin update

2019-06-22 Thread @lbutlr via dovecot



> On 20 Jun 2019, at 11:36, Adrian Minta via dovecot  
> wrote:
> 
> this seems to work very well: 
> 
> https://docs.iredmail.org/track.user.last.login.html

This is cool, but I have a question:

> For MySQL/MariaDB backends, we create the sql table in database vmail.

Would this interfere with or confuse postfixadmin? I use that so that users can 
update their own passwords and domain admins can add users and aliases.

> You could also add "rip = $rip" in "fields" for the ip address.



-- 
Lead me not into temptation, I can find the way.



RE: LastLogin update

2019-06-20 Thread Jorge Bastos via dovecot
Hum,

 

I can add 

 

Protocol = $protocol ?

 

The variables below are the valid ones right?

https://wiki.dovecot.org/Variables 

 

From: dovecot  On Behalf Of Jorge Bastos via
dovecot
Sent: Thursday, June 20, 2019 21:49
To: dovecot@dovecot.org
Subject: RE: LastLogin update

 

Hi,

 

Cool howto, and for protocol would this have that option also?

 

From: dovecot mailto:dovecot-boun...@dovecot.org> > On Behalf Of Adrian Minta via dovecot
Sent: Thursday, June 20, 2019 18:37
To: dovecot@dovecot.org <mailto:dovecot@dovecot.org> 
Subject: Re: LastLogin update

 

Hi,

this seems to work very well: 

https://docs.iredmail.org/track.user.last.login.html

You could also add "rip = $rip" in "fields" for the ip address.

 

On 6/20/19 3:24 PM, Jorge Bastos via dovecot wrote:

Howdy,

 

I'd like an adive on what to use.

I have sql users, and i want to have the lastlogin of them, what is the
native option for this:

 

*   Using last_login plugin which will give me the last login?
*   Use postlogin for imap and pop3n which will give me besides
lastlogin the IP and protocol?

 

Thanks in advanced,

-- 
Best regards,
Adrian Minta
 
 


RE: LastLogin update

2019-06-20 Thread Jorge Bastos via dovecot
Hi,

 

Cool howto, and for protocol would this have that option also?

 

From: dovecot  On Behalf Of Adrian Minta via
dovecot
Sent: Thursday, June 20, 2019 18:37
To: dovecot@dovecot.org
Subject: Re: LastLogin update

 

Hi,

this seems to work very well: 

https://docs.iredmail.org/track.user.last.login.html

You could also add "rip = $rip" in "fields" for the ip address.

 

On 6/20/19 3:24 PM, Jorge Bastos via dovecot wrote:

Howdy,

 

I'd like an adive on what to use.

I have sql users, and i want to have the lastlogin of them, what is the
native option for this:

 

*   Using last_login plugin which will give me the last login?
*   Use postlogin for imap and pop3n which will give me besides
lastlogin the IP and protocol?

 

Thanks in advanced,

-- 
Best regards,
Adrian Minta
 
 


Re: LastLogin update

2019-06-20 Thread Adrian Minta via dovecot

Hi,

this seems to work very well:

https://docs.iredmail.org/track.user.last.login.html

You could also add "rip = $rip" in "fields" for the ip address.


On 6/20/19 3:24 PM, Jorge Bastos via dovecot wrote:


Howdy,

I’d like an adive on what to use.

I have sql users, and i want to have the lastlogin of them, what is 
the native option for this:


  * Using last_login plugin which will give me the last login?
  * Use postlogin for imap and pop3n which will give me besides
lastlogin the IP and protocol?

Thanks in advanced,


--
Best regards,
Adrian Minta




Re: LastLogin update

2019-06-20 Thread azurit--- via dovecot

Hi,

we were trying both ways but:
 - using last_login plugin is a little complicated
 - postlogin was lowering performance really much

Finnaly, we ended up with a script parsing the mail.log and updating  
values in database (we run it once per day, with log rotation).


azur




Citát Jorge Bastos via dovecot :


Howdy,



I'd like an adive on what to use.

I have sql users, and i want to have the lastlogin of them, what is the
native option for this:



*   Using last_login plugin which will give me the last login?
*   Use postlogin for imap and pop3n which will give me besides
lastlogin the IP and protocol?



Thanks in advanced,






LastLogin update

2019-06-20 Thread Jorge Bastos via dovecot
Howdy,

 

I'd like an adive on what to use.

I have sql users, and i want to have the lastlogin of them, what is the
native option for this:

 

*   Using last_login plugin which will give me the last login?
*   Use postlogin for imap and pop3n which will give me besides
lastlogin the IP and protocol?

 

Thanks in advanced,