Merge lp:~valimail/authentication-results-python/gene into lp:authentication-results-python/0.6

Proposed by Scott Kitterman
Status: Merged
Merge reported by: Scott Kitterman
Merged at revision: not available
Proposed branch: lp:~valimail/authentication-results-python/gene
Merge into: lp:authentication-results-python/0.6
Diff against target: 105 lines (+72/-1)
3 files modified
authres/__init__.py (+3/-1)
authres/arc.py (+60/-0)
authres/tests (+9/-0)
To merge this branch: bzr merge lp:~valimail/authentication-results-python/gene
Reviewer Review Type Date Requested Status
Scott Kitterman Approve
Review via email: mp+327350@code.launchpad.net

Commit message

Initial merge of ARC authres capability

To post a comment you must log in.
Revision history for this message
Scott Kitterman (kitterman) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'authres/__init__.py'
2--- authres/__init__.py 2016-12-11 06:08:52 +0000
3+++ authres/__init__.py 2017-07-13 04:56:53 +0000
4@@ -185,13 +185,15 @@
5 import authres.dmarc
6 import authres.smime
7 import authres.rrvs
8+ import authres.arc
9 _all_features = FeatureContext(
10 authres.dkim_b,
11 authres.dkim_adsp,
12 authres.vbr,
13 authres.dmarc,
14 authres.smime,
15- authres.rrvs
16+ authres.rrvs,
17+ authres.arc
18 )
19 return _all_features
20
21
22=== added file 'authres/arc.py'
23--- authres/arc.py 1970-01-01 00:00:00 +0000
24+++ authres/arc.py 2017-07-13 04:56:53 +0000
25@@ -0,0 +1,60 @@
26+# coding: utf-8
27+
28+# Copyright © 2017 Gene Shuman <gene@valimail.com>,
29+# Copyright © 2012-2013 Scott Kitterman <scott@kitterman.com>
30+#
31+# Licensed under the Apache License, Version 2.0 (the "License");
32+# you may not use this file except in compliance with the License.
33+# You may obtain a copy of the License at
34+#
35+# http://www.apache.org/licenses/LICENSE-2.0
36+#
37+# Unless required by applicable law or agreed to in writing, software
38+# distributed under the License is distributed on an "AS IS" BASIS,
39+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40+# See the License for the specific language governing permissions and
41+# limitations under the License.
42+
43+"""
44+authres extension module for the Authenticated Recieved Chain (ARC)
45+authentication method.
46+"""
47+
48+#MODULE = 'authres'
49+
50+__author__ = 'Scott Kitterman, Gene Shuman'
51+__email__ = 'scott@kitterman.com, gene@valimail.com'
52+__version__ = '0.900'
53+
54+import authres.core
55+from authres.core import make_result_class_properties
56+
57+class ARCAuthenticationResult(authres.core.AuthenticationResult):
58+ "ARC result clause of an ``Authentication-Results`` header"
59+
60+ METHOD = 'arc'
61+
62+ def __init__(self, version = None,
63+ result = None, result_comment = None,
64+ reason = None, reason_comment = None,
65+ properties = None,
66+ header_d = None, header_d_comment = None,
67+ ):
68+ authres.core.AuthenticationResult.__init__(self, self.METHOD, version,
69+ result, result_comment, reason, reason_comment, properties)
70+ if header_d: self.header_d = header_d
71+ if header_d_comment: self.header_d_comment = header_d_comment
72+
73+ header_d, header_d_comment = make_result_class_properties('header', 'd')
74+
75+ def match_signature(self, signature_d):
76+ """Match authentication result against a ARC signature by ``header.d``."""
77+
78+ return self.header_d == signature_d
79+
80+RESULT_CLASSES = [
81+ ARCAuthenticationResult
82+]
83+
84+# vim:sw=4 sts=4
85+
86
87=== modified file 'authres/tests'
88--- authres/tests 2016-12-11 05:52:42 +0000
89+++ authres/tests 2017-07-13 04:56:53 +0000
90@@ -525,6 +525,15 @@
91 ... results = [mfrom_pass, helo_none]))
92 'Authentication-Results: example.com; spf=pass smtp.mailfrom=authenticated@example.net; spf=none reason="No SPF record for HELO" smtp.helo=mailserver.example.net'
93
94+# Create header field with ARC results
95+>>> import authres
96+>>> import authres.arc
97+>>> arc_pass = authres.arc.ARCAuthenticationResult(result = 'pass',
98+... header_d = 'example.net')
99+>>> str(authres.AuthenticationResultsHeader(authserv_id = 'example.com',
100+... results = [arc_pass]))
101+'Authentication-Results: example.com; arc=pass header.d=example.net'
102+
103 # Parsing IP6 address.
104 >>> arobj = authres_context.parse('Authentication-Results: mail.bmsi.com; iprev=pass policy.iprev="2001:748:100:40::2:2" (mout0.freenet.de); spf=none smtp.mailfrom=markuslaudi@freenet.de')
105 >>> str(arobj.results[0])

Subscribers

People subscribed via source and target branches