Handing of segmented TLS data

Issue #638 resolved
James Macdonell created an issue

For whatever reason, Amazon SES SMTP relays are sending the MAIL FROM: as two SSL /TLS segments within one packet: one segment with M and the other with AIL FROM: ....... Piler doesn't seem to be able to reassemble and only sees the last segment and then throws a invalid command: *AIL FROM:*

Some wireshark dissection attached.

Comments (4)

  1. Janos SUTO repo owner

    That's a nasty one. I can't imagine why an smtp client would send a single byte as the command, then the rest in another packet. Anyway, I've started to refactor session.c to make the fix possible. I'll let you know when you can test it.

  2. Janos SUTO repo owner

    OK, I've refactored heavily the smtp modul. Please download the master branch, recompile, and test it. Let me know how it works.

  3. James Macdonell reporter

    A lot of work on those commits! It did the trick, though. Thank you.

    Dec  3 16:26:37 mailarchiver piler[20612]: connection from 54.240.13.5
    Dec  3 16:26:38 mailarchiver piler[20612]: 40000000...: from=...@amazonses.com, size=3022/1712, attachments=0, reference=, message-id=<...@email.amazonses.com>, retention=180, folder=0, delay=0.06, delays=0.06/0.00/0.00/0.00/0.00/0.00, status=stored
    
    MariaDB [piler]> select metadata.from,FROM_UNIXTIME(arrived) from metadata where piler_id = '40000000...';
    +-------------------------+------------------------+
    | from                    | FROM_UNIXTIME(arrived) |
    +-------------------------+------------------------+
    | no-reply-aws@amazon.com | 2015-12-03 16:26:37    |
    +-------------------------+------------------------+
    
  4. Log in to comment