Commit c0b5fce6 authored by Florian Fuchs's avatar Florian Fuchs

Merge branch 'dmarc' into 'master'

Added DMARC Mitigations to List Settings.

Closes #167

See merge request !194
parents 33e46704 d10284ad
Pipeline #6254803 passed with stage
in 2 minutes and 52 seconds
# -*- coding: utf-8 -*-
# Copyright (C) 2012-2015 by the Free Software Foundation, Inc.
# Copyright (C) 2012-2016 by the Free Software Foundation, Inc.
#
# This file is part of Postorius.
#
......@@ -365,6 +365,54 @@ class DigestSettingsForm(ListSettingsForm):
'it gets sent out?'))
class DMARCMitigationsForm(ListSettingsForm):
"""
DMARC Mitigations list settings.
"""
dmarc_mitigate_action = forms.ChoiceField(
label=_('DMARC mitigation action'),
widget=forms.Select(),
required=False,
error_messages={
'required': _("Please choose a DMARC mitigation action.")},
choices=(
('no_mitigation', _('No DMARC mitigations')),
('munge_from', _('Replace From: with list address')),
('wrap_message',
_('Wrap the message in an outer message From: the list.')),
('reject', _('Reject the message')),
('discard', _('Discard the message'))),
help_text=_(
'The action to apply to messages From: a domain publishing a '
'DMARC policy of reject or quarantine or to all messages if '
'DMARC Mitigate unconditionally is True.'))
dmarc_mitigate_unconditionally = forms.TypedChoiceField(
coerce=lambda x: x == 'True',
choices=((True, _('Yes')), (False, _('No'))),
widget=forms.RadioSelect,
required=False,
label=_('DMARC Mitigate unconditionally'),
help_text=_(
'If DMARC mitigation action is munge_from or wrap_message, '
'should it apply to all messages regardless of the DMARC policy '
'of the From: domain.'))
dmarc_moderation_notice = forms.CharField(
label=_('DMARC rejection notice'),
required=False,
widget=forms.Textarea(),
help_text=_(
'Text to replace the default reason in any rejection notice to '
'be sent when DMARC mitigation action of reject applies.'))
dmarc_wrapped_message_text = forms.CharField(
label=_('DMARC wrapped message text'),
required=False,
widget=forms.Textarea(),
help_text=_(
'Text to be added as a separate text/plain MIME part preceding '
'the original message part in the wrapped message when DMARC '
'mitigation action of wrap message applies.'))
class AlterMessagesForm(ListSettingsForm):
"""
Alter messages list settings.
......
......@@ -44,7 +44,8 @@ from postorius.forms import (
ListSubscriptionPolicyForm, ArchiveSettingsForm, MessageAcceptanceForm,
DigestSettingsForm, AlterMessagesForm, ListAutomaticResponsesForm,
ListIdentityForm, ListMassSubscription, ListMassRemoval, ListAddBanForm,
ListHeaderMatchForm, ListHeaderMatchFormset, MemberModeration)
ListHeaderMatchForm, ListHeaderMatchFormset, MemberModeration,
DMARCMitigationsForm)
from postorius.models import Domain, List, MailmanApiError, Mailman404Error
from postorius.auth.decorators import (
list_owner_required, list_moderator_required, superuser_required)
......@@ -649,6 +650,7 @@ SETTINGS_SECTION_NAMES = (
('list_identity', _('List Identity')),
('automatic_responses', _('Automatic Responses')),
('alter_messages', _('Alter Messages')),
('dmarc_mitigations', _('DMARC Mitigations')),
('digest', _('Digest')),
('message_acceptance', _('Message Acceptance')),
('archiving', _('Archiving')),
......@@ -659,6 +661,7 @@ SETTINGS_FORMS = {
'list_identity': ListIdentityForm,
'automatic_responses': ListAutomaticResponsesForm,
'alter_messages': AlterMessagesForm,
'dmarc_mitigations': DMARCMitigationsForm,
'digest': DigestSettingsForm,
'message_acceptance': MessageAcceptanceForm,
'archiving': ArchiveSettingsForm,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment