> Am 27.01.2025 um 21:22 schrieb Timo Sirainen via dovecot 
> <dovecot@dovecot.org>:
> 
> On 27. Jan 2025, at 15.50, Christian Rößner via dovecot <dovecot@dovecot.org> 
> wrote:
>> 
>> event_exporter conn_state {
>> driver = http-post
>> format = json
>> http_post_url = http://nauthilus:8080/api/v1/custom/dovecot-session-cleaner
>> time_format = rfc3339
>> http_client_request_absolute_timeout = 5sec
>> }
>> metric client_disconnect_http {
>> exporter = conn_state
>> exporter_include =
>> exporter_include {
>>   name = yes
>>   hostname = yes
>>   timestamps = yes
>>   categories = yes
>>   fields = yes
>> }
>> filter = event=mail_user_session_finished AND (category=imap OR 
>> category=pop3 OR category=lmtp OR category=sieve)
>> }
>> metric imap_noop {
>> exporter = conn_state
>> exporter_include =
>> exporter_include {
>>   name = yes
>>   hostname = yes
>>   timestamps = yes
>>   categories = yes
>>   fields = yes
>> }
>> filter = event=imap_command_finished AND cmd_name=NOOP
>> }
> 
> These seem to work fine with me. I copy&pasted them to my config except 
> changed it to connect to localhost. Then did a test session:
> 
> % nc localhost 143
> * OK [CAPABILITY IMAP4rev1 LOGIN-REFERRALS ID ENABLE IDLE SASL-IR LITERAL+ 
> STARTTLS AUTH=PLAIN] Dovecot ready.
> x login tss pass
> x OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT 
> SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND 
> URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED 
> I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH 
> LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY PREVIEW STATUS=SIZE 
> SAVEDATE COMPRESS=DEFLATE INPROGRESS NOTIFY SPECIAL-USE LITERAL+] Logged in
> x select inbox
> * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
> * OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags 
> permitted.
> * 0 EXISTS
> * 0 RECENT
> * OK [UIDVALIDITY 1738009228] UIDs valid
> * OK [UIDNEXT 1] Predicted next UID
> x OK [READ-WRITE] Select completed (0.008 + 0.000 + 0.008 secs).
> x noop
> x OK NOOP completed (0.001 + 0.000 secs).
> x logout
> * BYE Logging out
> x OK Logout completed (0.001 + 0.000 secs).
> 
> It tried to connect on NOOP and LOGOUT commands as expected:
> 
> 2025-01-27T22:20:25.683680+02:00 ubuntu dovecot: imap-login: Logged in: 
> user=<tss>, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, mpid=1297445, 
> secured, session=<Z3VrzrUszs5/AAAB>
> 2025-01-27T22:20:29.252767+02:00 ubuntu dovecot: stats: Error: Failed to 
> export event via HTTP POST: 9003 connect(127.0.0.1:8080) failed: Connection 
> refused
> 2025-01-27T22:20:48.469938+02:00 ubuntu dovecot: 
> imap(tss)<1297445><Z3VrzrUszs5/AAAB>: Disconnected: Logged out in=30 out=858 
> deleted=0 expunged=0 trashed=0 hdr_count=0 hdr_bytes=0 body_count=0 
> body_bytes=0
> 2025-01-27T22:20:48.470406+02:00 ubuntu dovecot: stats: Error: Failed to 
> export event via HTTP POST: 9003 connect(127.0.0.1:8080) failed: Connection 
> refused
> _______________________________________________
> dovecot mailing list -- dovecot@dovecot.org
> To unsubscribe send an email to dovecot-le...@dovecot.org

And here is the same from my system:

The "director"-part (I know there does not exist a director anymore. Nauthilus 
replaces it in some way concerning the server-part of Dovecot):

director  | Jan 28 09:23:48 auth-worker(94): Info: request=passdb protocol=imap 
proxy_host=backend-1 auth_status_code=200 auth_status_message=<OK> 
nauthilus_session=2sFfQiOh7OJYFYbFu11OnEVrCAx
director  | Jan 28 09:23:48 imap-login: Info: 
proxy(testaccount,backend-1[172.22.0.5]:143): Started proxying to remote host 
(0.015 secs): user=<testaccount>, method=PLAIN, rip=172.22.0.1, lip=172.22.0.3, 
session=<JYRzv8As/PasFgAB>
director  | Jan 28 09:24:02 imap-login: Info: 
proxy(testaccount,backend-1[172.22.0.5]:143): Disconnected by server (0s idle, 
in=298, out=1019): user=<testaccount>, method=PLAIN, rip=172.22.0.1, 
lip=172.22.0.3, session=<JYRzv8As/PasFgAB>

The tshark-Output from the same container:

   69 405.512799379   172.22.0.3 → 172.22.0.4   HTTP 525 POST 
/api/v1/auth/header HTTP/1.1
   71 405.517035967   172.22.0.4 → 172.22.0.3   HTTP 335 HTTP/1.1 200 OK

Do connection to /api/v1/custom/dovecot-session-cleaner
As configured in the event exporter.

From my computer testing it:

telnet localhost 1430
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LOGIN-REFERRALS ID ENABLE IDLE SASL-IR LITERAL+ 
AUTH=PLAIN AUTH=LOGIN] Dovecot ready.
. login testuser testpassword
. OK [CAPABILITY IMAP4rev1 SASL-IR LOGIN-REFERRALS ID ENABLE IDLE SORT 
SORT=DISPLAY THREAD=REFERENCES THREAD=REFS THREAD=ORDEREDSUBJECT MULTIAPPEND 
URL-PARTIAL CATENATE UNSELECT CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED 
I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH 
LIST-STATUS BINARY MOVE SNIPPET=FUZZY PREVIEW=FUZZY PREVIEW STATUS=SIZE 
SAVEDATE COMPRESS=DEFLATE INPROGRESS NOTIFY LITERAL+ UTF8=ACCEPT FILTER=SIEVE] 
Logged in
. select inbox
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags 
permitted.
* 39 EXISTS
* 0 RECENT
* OK [UNSEEN 13] First unseen.
* OK [UIDVALIDITY 1737973265] UIDs valid
* OK [UIDNEXT 40] Predicted next UID
. OK [READ-WRITE] Select completed (0.001 + 0.000 + 0.001 secs).
. noop
. OK NOOP completed (0.001 + 0.000 secs).
. logout
* BYE Logging out
. OK Logout completed (0.001 + 0.000 secs).
Connection closed by foreign host.

For testing the connection with tshark, I copied your Dockerfile from Github 
and added tshark.

Could it be something with the official docker image?

Christian Rößner
-- 
Rößner-Network-Solutions
Zertifizierter ITSiBe / CISO
Marburger Str. 70a, 36304 Alsfeld
Fax: +49 6631 78823409, Mobil: +49 171 9905345
USt-IdNr.: DE225643613, https://roessner.website
PGP fingerprint: 658D 1342 B762 F484 2DDF 1E88 38A5 4346 D727 94E5 

_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to