Did you try
doveadm user account
to see that last_login_key appears in output in correct form?
Aki
On March 2, 2021 2:44:43 PM UTC, Henry <hl1723 at yahoo.com.hk>
wrote:> Dear Aki,
> I try it as your recommend but still no luck, same error
>Error: Failed to expand plugin setting last_login_key
>'last-login/%u/%d/%r/%l/%a': Unknown variable '%a'
>
>If I remark??#last_login_key = last-login/%u/%d/%r/%l/%a at?plugin ,
>error as below
>Error: last_login_dict: Failed to write value: dict-server returned
>failure: sql dict set: Invalid/unmapped key: shared/last-login/
>
>
>There is any error in my configuration? thanks for your help.
>
>
>## dovecot.confuserdb {
>? driver = prefetch}userdb {? args = /etc/dovecot/dovecot-sql.conf.ext?
>driver = sql}plugin {
>? quota = maildir:User quota
>? ? last_login_dict = proxy::lastlogin
>? ? last_login_key = last-login/%u/%d/%r/%l/%a? quota_status_success
>DUNNO
>? quota_status_nouser = DUNNO? quota_status_overquota = "552 5.2.2
>Mailbox is full"}dict {? ? lastlogin
>mysql:/etc/dovecot/dovecot-last-login.conf
>}
>
>##?dovecot-sql.conf.extpassword_query = SELECT CONCAT(pw_name, '@',
>pw_domain) AS user,pw_passwd AS password, concat('*:backend=',
>pw_shell) as \
>userdb_quota_rule, 89 AS userdb_uid, 89 AS userdb_gid, pw_dir AS
>userdb_home ,'last-login/%u/%d/%r/%l/%a' AS last_login_key FROM
>vpopmail LEFT JOIN limits ON vpopmail.pw_domain = \limits.domain WHERE
>pw_name = '%n' AND pw_domain='%d' AND (( '%s' =
'smtp' AND (pw_gid &
>2048)<>2048 AND COALESCE(disable_smtp,0)!=1) OR \('%s' =
'pop3' AND
>(pw_gid & 2)<>2 AND COALESCE(disable_pop,0) != 1 ) OR
('%s' = 'imap'
>AND ('%r'='127.0.0.1') AND \(pw_gid & 4)<>4 AND
>COALESCE(disable_webmail,0)!=1) OR ('%s' = 'imap' AND
>('%r'!='127.0.0.1') AND (pw_gid & 8)<>8 AND
>COALESCE(disable_imap,0)!=1));
>user_query = \
>? SELECT pw_dir AS home, \? 89 AS uid, \? 89 AS gid, \?
>CONCAT('*:bytes=', REPLACE(SUBSTRING_INDEX(pw_shell, 'S',
1),
>'NOQUOTA', '0')) AS quota_rule, \?
'last-login/%u/%d/%r/%l/%a' AS
>last_login_key \? FROM vpopmail \? WHERE pw_name = '%n' AND
pw_domain >'%d' \? AND ('%a'!='995' or !(pw_gid &
2)) \? AND ('%r'!='[WEBMAIL-IP]'
>or !(pw_gid & 4)) \? AND ('%r'='[WEBMAIL-IP]' or
'%a'!='993' or
>!(pw_gid & 8))
>
>#
>
>
>
> Henry (<hl1723 at yahoo.com.hk>) ? 2021?2?28???? ??05:24:45 [GMT+8]
???
>
> Dear Aka
>Still no luck, same errorError: Failed to expand plugin setting
>last_login_key = 'last-login/%u/%d/%r/%l/%a': Unknown variable
'%a'
>
>If I remark??#last_login_key = last-login/%u/%d/%r/%l/%a at?plugin ,
>error as belowError: last_login_dict: Failed to write value:
>dict-server returned failure: sql dict set: Invalid/unmapped key:
>shared/last-login/
>
>
>
>#dovecot.confuserdb {
>? driver = prefetch}userdb {? args = /etc/dovecot/dovecot-sql.conf.ext?
>driver = sql}plugin {
>? quota = maildir:User quota
>? ? last_login_dict = proxy::lastlogin
>? ? last_login_key = last-login/%u/%d/%r/%l/%a? quota_status_success
>DUNNO
>? quota_status_nouser = DUNNO? quota_status_overquota = "552 5.2.2
>Mailbox is full"}dict {? ? lastlogin
>mysql:/etc/dovecot/dovecot-last-login.conf
>}
>
># dovecot-sql.conf.extpassword_query = SELECT CONCAT(pw_name, '@',
>pw_domain) AS user,pw_passwd AS password, concat('*:backend=',
>pw_shell) as \
>userdb_quota_rule, 89 AS userdb_uid, 89 AS userdb_gid, pw_dir AS
>userdb_home ,'last-login/%u/%d/%r/%l/%a' AS last_login_key FROM
>vpopmail LEFT JOIN limits ON vpopmail.pw_domain = \limits.domain WHERE
>pw_name = '%n' AND pw_domain='%d' AND (( '%s' =
'smtp' AND (pw_gid &
>2048)<>2048 AND COALESCE(disable_smtp,0)!=1) OR \('%s' =
'pop3' AND
>(pw_gid & 2)<>2 AND COALESCE(disable_pop,0) != 1 ) OR
('%s' = 'imap'
>AND ('%r'='127.0.0.1') AND \(pw_gid & 4)<>4 AND
>COALESCE(disable_webmail,0)!=1) OR ('%s' = 'imap' AND
>('%r'!='127.0.0.1') AND (pw_gid & 8)<>8 AND
>COALESCE(disable_imap,0)!=1));
>user_query = \
>? SELECT pw_dir AS home, \? 89 AS uid, \? 89 AS gid, \?
>CONCAT('*:bytes=', REPLACE(SUBSTRING_INDEX(pw_shell, 'S',
1),
>'NOQUOTA', '0')) AS quota_rule, \?
'last-login/%u/%d/%r/%l/%a' AS
>last_login_key \? FROM vpopmail \? WHERE pw_name = '%n' AND
pw_domain >'%d' \? AND ('%a'!='995' or !(pw_gid &
2)) \? AND ('%r'!='[WEBMAIL-IP]'
>or !(pw_gid & 4)) \? AND ('%r'='[WEBMAIL-IP]' or
'%a'!='993' or
>!(pw_gid & 8))
>
>
>Aki Tuomi (<aki.tuomi at open-xchange.com>) ? 2021?2?28???? ??04:55:04
>[GMT+8] ???
>
>You need to put it in the sql query. SELECT ...,
>'last-login/%u/%d/%r/%l/%a' AS last_login_key
>
>Aki
>
>On February 28, 2021 8:12:39 AM UTC, Henry <hl1723 at yahoo.com.hk>
wrote:
>> current config as below:
>>userdb {? driver = prefetch}userdb {? args
>>/etc/dovecot/dovecot-sql.conf.ext? driver = sql}plugin {? quota
>>maildir:User quota
>>? ? last_login_dict = proxy::lastlogin
>>? ? last_login_key = last-login/%u/%d/%r/%l/%a? ? quota_status_success
>>= DUNNO
>>? ? quota_status_nouser = DUNNO? ? quota_status_overquota = "552
5.2.2
>>Mailbox is full"}
>>###
>>If I changed as below no help,still no pass the?Variable to
>>last_loginuserdb {? driver = prefetch}userdb {? args
>>/etc/dovecot/dovecot-sql.conf.ext? driver = sql}userdb {? driver
>>static? args = last_login_key=last-login/%u/%d/%r/%l/%a}
>>###If I changed as below will trouble ,cannot restart dovecotuserdb {?
>>driver = prefetch}userdb {? args
>>/etc/dovecot/dovecot-sql.conf.ext?last_login_key=last-login/%u/%d/%r/%l/%a?
>>driver = sql}
>>
>>
>>
>>
>>
>>Aki Tuomi (<aki.tuomi at open-xchange.com>) ? 2021?2?28????
??03:56:09
>>[GMT+8] ????
>>
>> It goes into the arguments section...
>>
>>Not having your config, I have to guess, but e.g.
>>
>>userdb {
>>? driver = static
>>? args = last_login_key=last-login/%u/%d/%r/%l/%a
>>}
>>
>>And similarly with other drivers, depending what you use.
>>
>>Aki
>>
>>> On 28/02/2021 09:53 Henry <hl1723 at yahoo.com.hk> wrote:
>>>
>>>
>>>
>>> Dear Aka,
>>>
>>> If in userdb, set
>>>
>>> last_login_key=last-login/%u/%d/%r/%l/%a
>>>
>>> then cannot restart dovecot the error below :
>>>
>>> master: Error: Error reading configuration: Error in configuration
>>file /etc/dovecot/dovecot.conf line 45: Unknown setting: userdb {
>>last_login_key
>>>
>>> #
>>> If in userdb, set
>>> default_fields = last_login_key = last-login/%u/%d/%r/%l/%a
>>> Error:
>>> auth: Fatal: Invalid userdb template last_login_key
>>last-login/%u/%d/%r/%l/%a - key must not be empty
>>>
>>>
>>> what is my wrongs about? thanks
>>>
>>>
>>> Aki Tuomi (<aki.tuomi at open-xchange.com>) ? 2021?2?28????
??02:56:51
>>[GMT+8] ???
>>>
>>>
>>> In your userdb, set
>>>
>>> last_login_key=last-login/%u/%d/%r/%l/%a
>>>
>>> Then it will expand into what you want, and will be imported into
>>user's environment.
>>>
>>> Aki
>>>
>>>
>>> > On 28/02/2021 05:57 Henry <hl1723 at yahoo.com.hk>
wrote:
>>> >
>>> >
>>> > like capture local_port, I using %a will got below error
>>> >
>>> > Error: Failed to expand plugin setting last_login_key
>>'last-login/%u/%d/%r/%l/%a': Unknown variable '%a'
>>> >
>>> >
>>> > If I using any of $local_port ,'$local_port',
"$local_port",
>>`$local_port`
>>> >
>>> > I got the database update as?$local_port
,'$local_port',
>>"$local_port", `$local_port` at the field column record.
>>> >
>>> >
>>> >
>>> > Henry (<hl1723 at yahoo.com.hk>) ? 2021?2?27????
??10:57:27 [GMT+8]
>>???
>>> >
>>> >
>>> > I already try using other?variables , I found it only support
>"Mail
>>service user variables", no support "Login variables" and
>>"Authentication variables"
>>> >
>>> > below the error when I try to using?"Login
variables" and
>>"Authentication variables"
>>> >
>>> > Error: Failed to expand plugin setting last_login_key
>>'last-login/%u/%d/%r/%l/%k': Unknown variable '%k'
>>> > Error: Failed to expand plugin setting last_login_key
>>'last-login/%u/%d/%r/%l/%b': Unknown variable '%b'
>>> > Error: Failed to expand plugin setting last_login_key
>>'last-login/%u/%d/%r/%l/%m': Unknown variable '%m'
>>> >
>>> > I using centos 8 and dovecot-2.3.13-2.x86_64,
>>> >
>>> >
>>> > thanks
>>> >
>>> > Aki Tuomi (<aki.tuomi at open-xchange.com>) ?
2021?2?27????
>??07:32:38
>>[GMT+8] ???
>>> >
>>> >
>>> > last_login supports some of the variables.
>>> >
>>> >
>>> > Mail service and mail user variables are supported.
>>> >
>>> > You can try export the auth variables as userdb variables and
use
>>$variablename.
>>> >
>>> > Aki
>>> >
>>> >
>>> > On 27 February 2021 7.29.10 EET, Henry <hl1723 at
yahoo.com.hk>
>wrote:
>>> > >
>>> > >Anyone know then last_login plugins do support standard
auth
>>variables
>>> > >in var-expand?like %k %a variables.
>>> > >I need logging other fields such as port 143 or 993, and
tls 1.1
>>or tls
>>> > >1.3, client hostname,
>>> > >any patch for this? thanks
>>> > >
>>> >
>>>https://doc.dovecot.org/configuration_manual/config_file/config_variables/
>>> > > Henry (<hl1723 at yahoo.com.hk>) ? 2021?2?19????
??12:15:10 [GMT+8]
>>???
>>> > >
>>> > >but I need logging other fields such as port 143 or 993,
and tls
>>1.1 or
>>> > >tls 1.3, client hostname,?what should I do it ?
>>> >
>>>https://doc.dovecot.org/configuration_manual/config_file/config_variables/
>>> > >
>>> > >Aki Tuomi (<aki.tuomi at open-xchange.com>) ?
2021?2?18????
>>??03:04:10
>>> > >[GMT+8] ???
>>> > >
>>> > >
>>> > >> On 18/02/2021 08:57 Henry <hl1723 at
yahoo.com.hk> wrote:
>>> > >>
>>> > >>
>>> > >>
>>> > >>
>>> > >> Anyone kwon the last-login plugins can using
Authentication
>>variables
>>> > >such as?%m mechanism, %a local_port .
>>> > >> we want to record this in DB, thanks
>>> > >
>>> > >You can use this syntax to add further fields for
last_login
>>plugin.
>>> > >
>>> > > map {
>>> > > pattern = shared/last-login/$user/$domain
>>> > > table = last_login
>>> > > value_field = last_login
>>> > > value_type = uint
>>> > >
>>> > > fields {
>>> > > username = $user
>>> > > domain = $domain
>>> > > rip = $rip
>>> > > }
>>> > >}
>>> > >
>>> > >Aki
>>> >
>>> > >
>>> >
>>> > --
>>> > Sent from my Android device with K-9 Mail. Please excuse my
>>brevity.
>>> >
>>?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<https://dovecot.org/pipermail/dovecot/attachments/20210302/28dcd082/attachment-0001.html>