<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body><div style="font-family: sans-serif;"><div class="markdown" style="white-space: normal;">
<p dir="auto">At the risk of being pedestrian, I just use something like <code style="margin: 0 0; padding: 0 0.25em; border-radius: 3px; background-color: #F7F7F7;">sudo netstat -an | grep ‘:[ IMAP_PORT ]’</code></p>
<p dir="auto">I’m pretty sure you thought of this but still, thought I would toss it out…</p>
<p dir="auto">Cheers</p>
<hr style="border: 0; height: 1px; background: #333; background-image: linear-gradient(to right, #ccc, #333, #ccc);">
<p dir="auto">On 16 Aug 2022, at 13:15, Jaroslaw Rafa wrote:</p>
</div><div class="plaintext" style="white-space: normal;"><blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;"><p dir="auto">Hello Dovecot community,</p>
<p dir="auto">I have a question: is it possible to programmatically get from Dovecot a
<br>
list of currently active IMAP sessions (with IP addresses)? Via a plugin or
<br>
something?</p>
<p dir="auto">Or just check if there is an IMAP session currently open from a particular IP
<br>
address, with true/false type answer?</p>
<p dir="auto">I'm planning to implement a policy service for *Postfix* that will revive
<br>
the old "POP before SMTP" authorization concept (only it will be "IMAP
<br>
before SMTP" this time). This policy service will reject connections to
<br>
mail submission ports (465, 587) - without even going to SMTP AUTH phase -
<br>
unless the connecting IP address has currently an IMAP session open to
<br>
Dovecot, to mitigate SMTP AUTH attacks.</p>
<p dir="auto">But for this I need some way to check from within this policy service if the
<br>
particular IP address has a connection open or not. It could be of course
<br>
obtained by scanning Dovecot logs, but this involves quite a large overhead.
<br>
Therefore I'm looking for the way to get this information directly from
<br>
Dovecot's current state.</p>
<p dir="auto">Can you advise me of any way to do this?</p>
<p dir="auto">Or maybe someone has already written such a piece of software and it is
<br>
available somewhere on the Net?
<br>
-- 
<br>
Regards,
<br>
   Jaroslaw Rafa
<br>
   raj@rafa.eu.org
<br>
--
<br>
"In a million years, when kids go to school, they're gonna know: once there</p>
</blockquote></div>
<div class="markdown" style="white-space: normal;">
<blockquote style="margin: 0 0 5px; padding-left: 5px; border-left: 2px solid #777777; color: #777777;">
<p dir="auto">was a Hushpuppy, and she lived with her daddy in the Bathtub."</p>
</blockquote>

</div>
</div>
</body>

</html>