mirror of
https://github.com/Mailu/Mailu.git
synced 2025-04-27 12:22:25 +02:00
Merge #3761
3761: added idna function to perform puny encoding on IDN domains (backport #3758) r=mergify[bot] a=mergify[bot] ## What type of PR? bug-fix ## What does this PR do? ### Related issue(s) - fixes issue where DKIM signatures from domains with IDN are not accepted by some mail servers: closes #3743 ## Prerequisites Before we can consider review and merge, please make sure the following list is done and checked. If an entry in not applicable, you can check it or remove it from the list. - [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file. <hr>This is an automatic backport of pull request #3758 done by [Mergify](https://mergify.com). Co-authored-by: Jumper78 <52802286+Jumper78@users.noreply.github.com> Co-authored-by: Florent Daigniere <nextgens@users.noreply.github.com>
This commit is contained in:
commit
d4623e31cf
@ -2,6 +2,7 @@ from mailu import models
|
||||
from mailu.internal import internal
|
||||
|
||||
import flask
|
||||
import idna
|
||||
|
||||
def vault_error(*messages, status=404):
|
||||
return flask.make_response(flask.jsonify({'errors':messages}), status)
|
||||
@ -19,7 +20,16 @@ def rspamd_dkim_key(domain_name):
|
||||
if key := domain.dkim_key:
|
||||
selectors.append(
|
||||
{
|
||||
'domain' : domain.name,
|
||||
'domain' : idna.encode(domain.name.lower()).decode('ascii'),
|
||||
'key' : key.decode('utf8'),
|
||||
'selector': flask.current_app.config.get('DKIM_SELECTOR', 'dkim'),
|
||||
}
|
||||
)
|
||||
elif domain := models.Alternative.query.get(domain_name):
|
||||
if key := domain.domain.dkim_key:
|
||||
selectors.append(
|
||||
{
|
||||
'domain' : idna.encode(domain.name.lower()).decode('ascii'),
|
||||
'key' : key.decode('utf8'),
|
||||
'selector': flask.current_app.config.get('DKIM_SELECTOR', 'dkim'),
|
||||
}
|
||||
|
1
towncrier/newsfragments/3758.bugfix
Normal file
1
towncrier/newsfragments/3758.bugfix
Normal file
@ -0,0 +1 @@
|
||||
domain name of an IDN domain in the DKIM signature needs to follow RFC6376; puny encoding the domain name when rspamd accesses the vault;
|
Loading…
x
Reference in New Issue
Block a user