asciinema / asciinema-server

Platform for hosting and sharing terminal session recordings
https://docs.asciinema.org/manual/server/
Apache License 2.0
2.29k stars 263 forks source link

[BUG]: Login emails are badly generated resulting in SPAM mark #445

Closed jiriks74 closed 4 months ago

jiriks74 commented 4 months ago

Describe the bug Emails generated by asciinema have serious content issues resulting in them being marked as spam.

The issues concerning the email generation are:

The mail server for asciinema.org has an additional issue that I will report to the admin directly as per the guidelines.

To Reproduce Steps to reproduce the behavior:

  1. Log into asciinema.org (or your own instance)
  2. See the login email
  3. Open email source
  4. See the X-Spamd-Result header

Expected behavior These spam detection issues not being present

Versions: asciinema-server: 20240515

Additional context These values/problems were detected by rspamd.

[!Note] From talking with docker-mailserver developers I get that those issues are serious and emails like this are intended to be marked as spam by spam filtering services.

https://github.com/docker-mailserver/docker-mailserver/issues/4007#issuecomment-2120441908

ku1ik commented 4 months ago

Hey @jiriks74, thanks for reporting.

I've now (with this commit https://github.com/asciinema/asciinema-server/commit/ac895d266db603cc68fd8f6c9f75708325d76410) switched the email client library (the previous one was rather unmaintained), and I believe this should improve things.

You can check it on asciinema.org already. I've inspected the raw email messages and they now include Message-Id, have no unnecessary Base64 encoding.

If you'd like to test this change against your email setup then, until I release a new version, you can build asciinema server container image from the develop branch.

jiriks74 commented 4 months ago

Some small issues are still present but it's significantly better. The small issues are:

The first one may be cool to solve but the other two are not that big of a deal (it seems). One is that there's only HTML and not text in the email (fine IMHO) and the other is URL only in body which I don't even know what it wants (but it's only 0.4 points so it's fine).

The MID_RHS_NOT_FQDN has Message-ID RHS is not a fully-qualified domain name shouldn't be that hard to fix (from what I can see about this) and then you'd be under 0 with the points.

There's also the issue with your SMTP server that I emailed you about as it's specific to your (if you're admin@asciinema.org) server not this project. If you're able to fix the MID_RHS_NOT_FQDN and the issue I emailed you about you'll be under 0 with spam rating so your emails shouldn't ever get greylisted or even moved to spam!


Great fix! When do you plan the next release?

georglauterbach commented 4 months ago

Chiming in here, your fix @ku1ik looks very good!

I concur with @jiriks74: MID_RHS_NOT_FQDN is not too bad (0.4 is not that much), but fixing it is probably a good idea. The rest is pretty harmless, and I wouldn't bother.

ku1ik commented 4 months ago

Thanks guys. This is super helpful. I'll fix MID_RHS_NOT_FQDN :+1:

ku1ik commented 4 months ago

The Message-ID is now improved in https://github.com/asciinema/asciinema-server/commit/5c84f04145dd2cebfc673b4decf52e4644a0020a . I think I'll stop here now :sweat_smile:

ku1ik commented 4 months ago

Great fix! When do you plan the next release?

I haven't planned a new one yet, but I suppose I could make one in a day or two.

jiriks74 commented 4 months ago

LGTM! Looking forward to updating.

ku1ik commented 4 months ago

New release is out: https://github.com/asciinema/asciinema-server/releases/tag/v20240523