~barry/mailman/events-and-web

« back to all changes in this revision

Viewing changes to src/mailman/handlers/cleanse_dkim.py

  • Committer: klm
  • Date: 1998-01-07 21:21:35 UTC
  • Revision ID: vcs-imports@canonical.com-19980107212135-sv0y521ps0xye37r
Initial revision

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012 by the Free Software Foundation, Inc.
2
 
#
3
 
# This file is part of GNU Mailman.
4
 
#
5
 
# GNU Mailman is free software: you can redistribute it and/or modify it under
6
 
# the terms of the GNU General Public License as published by the Free
7
 
# Software Foundation, either version 3 of the License, or (at your option)
8
 
# any later version.
9
 
#
10
 
# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT
11
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
 
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13
 
# more details.
14
 
#
15
 
# You should have received a copy of the GNU General Public License along with
16
 
# GNU Mailman.  If not, see <http://www.gnu.org/licenses/>.
17
 
 
18
 
"""Remove any 'DomainKeys' (or similar) headers.
19
 
 
20
 
The values contained in these header lines are intended to be used by the
21
 
recipient to detect forgery or tampering in transit, and the modifications
22
 
made by Mailman to the headers and body of the message will cause these keys
23
 
to appear invalid.  Removing them will at least avoid this misleading result,
24
 
and it will also give the MTA the opportunity to regenerate valid keys
25
 
originating at the Mailman server for the outgoing message.
26
 
"""
27
 
 
28
 
from __future__ import absolute_import, print_function, unicode_literals
29
 
 
30
 
__metaclass__ = type
31
 
__all__ = [
32
 
    'CleanseDKIM',
33
 
    ]
34
 
 
35
 
 
36
 
from lazr.config import as_boolean
37
 
from zope.interface import implementer
38
 
 
39
 
from mailman.config import config
40
 
from mailman.core.i18n import _
41
 
from mailman.interfaces.handler import IHandler
42
 
 
43
 
 
44
 
 
45
 
@implementer(IHandler)
46
 
class CleanseDKIM:
47
 
    """Remove DomainKeys headers."""
48
 
 
49
 
    name = 'cleanse-dkim'
50
 
    description = _('Remove DomainKeys headers.')
51
 
 
52
 
    def process(self, mlist, msg, msgdata):
53
 
        """See `IHandler`."""
54
 
        if as_boolean(config.mta.remove_dkim_headers):
55
 
            del msg['domainkey-signature']
56
 
            del msg['dkim-signature']
57
 
            del msg['authentication-results']