Post login scripts environment
Dear Dovecot users,
I am running Dovecot 2.2.27 on Debian Stretch, no issue so far.
I wonder if there is a way to pass the remote IP address, in an environment variable, in the post login script.
My Post login scripts are working well, except that when the server is accessed through a webmail (Roundcube or SOGo), the remote IP address is systematically 127.0.0.1.
The other question I have is, is it possible to pass the user agent of the email client used to access the server? I know this can be easily forged, but I would like to log it.
Thanks for your insight.
-- André Rodier
On Sun, 2019-04-07 at 17:49 +0300, Aki Tuomi via dovecot wrote:
On 7 April 2019 17:26 André Rodier via dovecot < dovecot@dovecot.org> wrote:
Dear Dovecot users,
I am running Dovecot 2.2.27 on Debian Stretch, no issue so far.
I wonder if there is a way to pass the remote IP address, in an environment variable, in the post login script.
My Post login scripts are working well, except that when the server is accessed through a webmail (Roundcube or SOGo), the remote IP address is systematically 127.0.0.1.
The other question I have is, is it possible to pass the user agent of the email client used to access the server? I know this can be easily forged, but I would like to log it.
Thanks for your insight.
-- André Rodier
You can use IMAP ID command to pass e.g. x-originating-ip. See https://github.com/dovecot/core/blob/master/src/imap-login/imap-login-cmd-id...
Aki Tuomi
Thanks, Aki,
I had a look on the version, I don't think this is implemented in 2.2.27, it it seems this file has been added in 2.3.
I may have to use a more recent version of Dovecot, but I think this is exactly what I was looking for, for the IP address.
Regarding the original user agent (e.g. Evolution, Thunderbird, etc.), I suppose I can use the same approach?
Thanks again for your help.
André
-- André Rodier
On 7 April 2019 18:45 André Rodier via dovecot dovecot@dovecot.org wrote:
On Sun, 2019-04-07 at 17:49 +0300, Aki Tuomi via dovecot wrote:
On 7 April 2019 17:26 André Rodier via dovecot < dovecot@dovecot.org> wrote:
Dear Dovecot users,
I am running Dovecot 2.2.27 on Debian Stretch, no issue so far.
I wonder if there is a way to pass the remote IP address, in an environment variable, in the post login script.
My Post login scripts are working well, except that when the server is accessed through a webmail (Roundcube or SOGo), the remote IP address is systematically 127.0.0.1.
The other question I have is, is it possible to pass the user agent of the email client used to access the server? I know this can be easily forged, but I would like to log it.
Thanks for your insight.
-- André Rodier
You can use IMAP ID command to pass e.g. x-originating-ip. See https://github.com/dovecot/core/blob/master/src/imap-login/imap-login-cmd-id...
Aki Tuomi
Thanks, Aki,
I had a look on the version, I don't think this is implemented in 2.2.27, it it seems this file has been added in 2.3.
I may have to use a more recent version of Dovecot, but I think this is exactly what I was looking for, for the IP address.
Regarding the original user agent (e.g. Evolution, Thunderbird, etc.), I suppose I can use the same approach?
Thanks again for your help.
André
This feature is supported since 1.2 alpha.
Aki
On 7 April 2019 18:55 Aki Tuomi via dovecot dovecot@dovecot.org wrote:
On 7 April 2019 18:45 André Rodier via dovecot dovecot@dovecot.org wrote:
On Sun, 2019-04-07 at 17:49 +0300, Aki Tuomi via dovecot wrote:
On 7 April 2019 17:26 André Rodier via dovecot < dovecot@dovecot.org> wrote:
Dear Dovecot users,
I am running Dovecot 2.2.27 on Debian Stretch, no issue so far.
I wonder if there is a way to pass the remote IP address, in an environment variable, in the post login script.
My Post login scripts are working well, except that when the server is accessed through a webmail (Roundcube or SOGo), the remote IP address is systematically 127.0.0.1.
The other question I have is, is it possible to pass the user agent of the email client used to access the server? I know this can be easily forged, but I would like to log it.
Thanks for your insight.
-- André Rodier
You can use IMAP ID command to pass e.g. x-originating-ip. See https://github.com/dovecot/core/blob/master/src/imap-login/imap-login-cmd-id...
Aki Tuomi
Thanks, Aki,
I had a look on the version, I don't think this is implemented in 2.2.27, it it seems this file has been added in 2.3.
I may have to use a more recent version of Dovecot, but I think this is exactly what I was looking for, for the IP address.
Regarding the original user agent (e.g. Evolution, Thunderbird, etc.), I suppose I can use the same approach?
Thanks again for your help.
André
This feature is supported since 1.2 alpha.
Aki
See https://wiki2.dovecot.org/Design/ParameterForwarding for more details on this feature. I forgot to link this in the original reply.
Aki
On Sun, 2019-04-07 at 19:03 +0300, Aki Tuomi wrote:
On 7 April 2019 18:55 Aki Tuomi via dovecot dovecot@dovecot.org wrote:
On 7 April 2019 18:45 André Rodier via dovecot dovecot@dovecot.org wrote:
On Sun, 2019-04-07 at 17:49 +0300, Aki Tuomi via dovecot wrote:
On 7 April 2019 17:26 André Rodier via dovecot < dovecot@dovecot.org> wrote:
Dear Dovecot users,
I am running Dovecot 2.2.27 on Debian Stretch, no issue so far.
I wonder if there is a way to pass the remote IP address, in an environment variable, in the post login script.
My Post login scripts are working well, except that when the server is accessed through a webmail (Roundcube or SOGo), the remote IP address is systematically 127.0.0.1.
The other question I have is, is it possible to pass the user agent of the email client used to access the server? I know this can be easily forged, but I would like to log it.
Thanks for your insight.
-- André Rodier
You can use IMAP ID command to pass e.g. x-originating-ip. See https://github.com/dovecot/core/blob/master/src/imap-login/imap-login-cmd-id...
Aki Tuomi
Thanks, Aki,
I had a look on the version, I don't think this is implemented in 2.2.27, it it seems this file has been added in 2.3.
I may have to use a more recent version of Dovecot, but I think this is exactly what I was looking for, for the IP address.
Regarding the original user agent (e.g. Evolution, Thunderbird, etc.), I suppose I can use the same approach?
Thanks again for your help.
André
This feature is supported since 1.2 alpha.
Aki
See https://wiki2.dovecot.org/Design/ParameterForwarding for more details on this feature. I forgot to link this in the original reply.
Aki
Thanks a lot, this is great, now I can implement it properly.
I may post a link on this list, once implemented.
Kind regards, André
-- André Rodier HomeBox: https://github.com/progmaticltd/homebox
On Sun, 2019-04-07 at 19:03 +0300, Aki Tuomi wrote:
On 7 April 2019 18:55 Aki Tuomi via dovecot dovecot@dovecot.org wrote:
On 7 April 2019 18:45 André Rodier via dovecot dovecot@dovecot.org wrote:
On Sun, 2019-04-07 at 17:49 +0300, Aki Tuomi via dovecot wrote:
On 7 April 2019 17:26 André Rodier via dovecot < dovecot@dovecot.org> wrote:
Dear Dovecot users,
I am running Dovecot 2.2.27 on Debian Stretch, no issue so far.
I wonder if there is a way to pass the remote IP address, in an environment variable, in the post login script.
My Post login scripts are working well, except that when the server is accessed through a webmail (Roundcube or SOGo), the remote IP address is systematically 127.0.0.1.
The other question I have is, is it possible to pass the user agent of the email client used to access the server? I know this can be easily forged, but I would like to log it.
Thanks for your insight.
-- André Rodier
You can use IMAP ID command to pass e.g. x-originating-ip. See https://github.com/dovecot/core/blob/master/src/imap-login/imap-login-cmd-id...
Aki Tuomi
Thanks, Aki,
I had a look on the version, I don't think this is implemented in 2.2.27, it it seems this file has been added in 2.3.
I may have to use a more recent version of Dovecot, but I think this is exactly what I was looking for, for the IP address.
Regarding the original user agent (e.g. Evolution, Thunderbird, etc.), I suppose I can use the same approach?
Thanks again for your help.
André
This feature is supported since 1.2 alpha.
Aki
See https://wiki2.dovecot.org/Design/ParameterForwarding for more details on this feature. I forgot to link this in the original reply.
Aki
Dear Aki et al,
Thank you, this is working perfectly, at least with a simple RoundCube plugin.
For those who need the same as me, here a minimal example plug-in with RoundCube:
======================================================================< ?php class dovecot_ident extends rcube_plugin { function init() { $this->add_hook('storage_connect', [$this, 'add_ident']); }
function add_ident($args) { $remoteIP = $_SERVER['REMOTE_ADDR']; $identInfo = [ 'x-originating-ip' => $remoteIP ];
if ($args['ident']) { $args['ident'] = array_merge($args['ident'], $identInfo); } else { $args['ident'] = $identInfo; } return $args; } } ?>
I am struggling to obtain answers from SOGo, but eventually I will get there.
Maybe there is a way with imapproxy and an nginx setting ?
Kind regards, André
-- André Rodier HomeBox: https://github.com/progmaticltd/homebox
participants (2)
-
Aki Tuomi
-
André Rodier