Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  2. ZBX-8040

Zabbix should wait for proper response from SMTP server before sending commands


    • Icon: Incident report Incident report
    • Resolution: Fixed
    • Icon: Minor Minor
    • 2.3.2
    • 2.0.11
    • Server (S)

      Summary: zabbix should look for '220<space>' reply code from SMTP server, rather than '220'.

      According to section 4.2.1 of RFC 5321:

      "The format for multiline replies requires that every line, except the last, begin with the reply code, followed immediately by a hyphen, "-" (also known as minus), followed by text. The last line will begin with the reply code, followed immediately by <SP>, optionally some text, and <CRLF>. As noted above, servers SHOULD send the <SP> if subsequent text is not sent, but clients MUST be prepared for it to be omitted."

      Some SMTP servers implement pre-greet delays, to catch misbehaving clients who send commands before receiving correct greeting from server (see http://www.postfix.org/POSTSCREEN_README.html#before_220).

      Session should look like this:

      Client > connects
      Server < 220-mx ESMTP OK

      • several seconds delay -
        Server < 220 mx ESMTP OK
        Client > QUIT
        Server < 221 2.0.0 Bye

      But in simple checks (net.tcp.service[smtp]) zabbix sends QUIT immediately after receiving first line, triggering pre-greet check:

      Apr 4 04:43:10 mx postfix/postscreen[1925]: CONNECT from [2001:470:xxxx]:53315 to [2a00:ab00:xxx]:25
      Apr 4 04:43:10 mx postfix/postscreen[1925]: PREGREET 6 after 0.14 from [2001:470:xxxx]:53315: QUIT\r\n
      Apr 4 04:43:10 mx postfix/postscreen[1925]: DISCONNECT [2001:470:xxxx]:53315

      Instead zabbix should wait for proper '220<space>' reply from server.

      Also applies to send_email function in src/libs/zbxmedia/email.c

            Unassigned Unassigned
            caesar Vasily Ivanov
            0 Vote for this issue
            2 Start watching this issue