[Rspamd-Users] How to use lua_mime.add_text_footer
Alexander Meinhardt
alexander.meinhardt at gmail.com
Tue Apr 20 15:44:59 UTC 2021
Hello,
combined your snippet with my extra checkups about authuser and used
to load the footers from files, but whatever i try i got two problems:
1. The prefilter group and/or priority seems to be managed after the
dkim_signing is done, because e.g. Google reports, that the body
doesn't match verify?
> Authentication-Results: mx.google.com;
> dkim=neutral (body hash did not verify)
I tried with priority 10, group prefilter/mime, but it doesn't seems
to be considered.
When the rspamd.local.lua is commented, all seems fine, so it seems to
be related to the prefilter or better said point of manipulation.
2. There might be an bug in the snippet you provided, because sending
a a message from Thunderbird-17.10.0 comes as:
>MIME-Version: 1.0
>Content-Type: multipart/alternative; boundary="------------3C188886DB3F85BE7A7F7388"
>Content-Language: en-US
>
>--------------3C188886DB3F85BE7A7F7388
>
>this is a test email.
>
> #footer from file
>-- #footer from file
>Plaintext Signature #footer from file
>Sign Name #footer from file
>
>--------------3C188886DB3F85BE7A7F7388Content-Type: text/html; charset=utf-8
>Content-Transfer-Encoding: 7bit<html>
> <head>
>
> <meta http-equiv="content-type" content="text/html; charset=UTF-8">
> </head>
> <body>
> <p>this is a testmail.<br>
> </p>
> </body>
></html>
>
><p><hr />HTML Signature<br />Sign Name</p> #footer from file
>
>--------------3C188886DB3F85BE7A7F7388--
Looks like a line break doesn't seems to be correct aligned, because
Content-Type is added to the boundary.
As well as the html part is added to the encoding.
This results in various SYMBOLS on rspamd which failed, like
BROKEN_HEADERS (10).
Do i miss a bugfix-release here, because i'm using Rspamd-2.7-r100
which seems to be the officel 2.7 release, just marked as stable for
amd64 on Gentoo at 2021-02-25T11:33:31+00:00.
Thanks for your time.
On Thu, Apr 15, 2021 at 6:58 PM Vsevolod Stakhov <vsevolod at rspamd.com> wrote:
>
> Hello,
>
> On 15/04/2021 17:49, Alexander Meinhardt wrote:
> > Hello,
> >
> > i'm trying to implement the function lua_mime.add_text_footer to my
> > setup, but i didn't get the things working.
> >
> > rspamd.local.lua in /etc/rspamd:
> >
> >> local lua_mime = require "lua_mime"
> >> rspamd_config.FOOTER_SIGNATURE = {
> >> callback = function(task)
> >> local authuser = task:get_user()
> >> if authuser then
> >> local at_symbol = authuser:find("[^%@]+$")
> >> local username = authuser:sub(1, (at_symbol - 2))
> >> local domain = authuser:sub(at_symbol, #authuser)
> >> local signature_path = "/var/lib/rspamd/signature/"
> >> local signature_plain = signature_path .. domain .. "/" .. username .. "/signature.txt"
> >> local signature_html = signature_path .. domain .. "/" .. username .. "/signature.html"
> >> local file_plain = io.open(signature_plain, "r")
> >> local file_html = io.open(signature_html, "r")
> >> if file_plain~=nil and file_html~=nil then
> >> io.close(file_plain)
> >> io.close(file_html)
> >> lua_mime.add_text_footer(task, signature_plain, signature_html)
> >> return true
> >> end
> >> end
> >> return false
> >> end,
> >> score = 0.0,
> >> group = 'mime',
> >> description = 'Adds a footer signature to the message'
> >> }
> >
> > The authenticated user gets the symbol FOOTER_SIGNATURE added, when
> > the files signature.txt/html exists, but the mime part of the message
> > isn't altered.
> > There are no errors.
> >
> > How do i need to use this? Am I missing a required module or so?
> >
> > Kind regards from Germany
> > Alex
> >
>
> Please check this snippet for the reference:
> https://gist.github.com/vstakhov/3dda60a5638a6aefd454973bd687fc21
> --
> Users mailing list
> Users at lists.rspamd.com
> https://lists.rspamd.com/mailman/listinfo/users
More information about the Users
mailing list