Get a list of currently active IMAP connections?

Jaroslaw Rafa raj at
Tue Aug 16 21:54:00 UTC 2022

Dnia 16.08.2022 o godz. 23:37:05 Aki Tuomi pisze:
> doveadm_password = secret
> service doveadm {
>   inet_listener http {
>      port = 8080
>   }
> }
> should allow you to use `who` command over HTTP API. 

It's an interesting option, but after looking into "doveadm" source code I
was able to reimplement the query that "doveadm who" does with a few lines
of simple Perl code. It's exactly what I want, as it can be easily
integrated into a policy service written in Perl.

Thanks again for pointing me in the right direction.

If anybody is interested, here's the code:


use IO::Socket::UNIX qw( SOCK_STREAM );


my $socket = IO::Socket::UNIX->new(
   Type => SOCK_STREAM,
   Peer => $sockpath,
   or die("Can't connect to $sockpath");


$socket->send($ANVIL_CMD) or die "Socket write error";
$socket->recv($buffer, 65536, 0) or die "Socket read error";

@lines=split(/\n/, $buffer);
foreach $line (@lines) {
  #print "$line\n";
  if ($line =~ m#^imap/([0-9A-Fa-f.:]+)/([^\t]+)\t#) {
    print "IP=$1 user=$2\n";

   Jaroslaw Rafa
   raj at
"In a million years, when kids go to school, they're gonna know: once there
was a Hushpuppy, and she lived with her daddy in the Bathtub."

More information about the dovecot mailing list