Browse code

courier-pythonfilter now in portage

Hanno Böck authored on10/11/2019 14:34:55
Showing7 changed files
1 1
deleted file mode 100644
... ...
@@ -1,9 +0,0 @@
1
-AUX courier-pythonfilter-fix-charset-issue-and-controlfile-issue.diff 2175 BLAKE2B e69f1bd4c4d7567d7ded99685d2b1aa177cbf5a7c5d9aed35dd1ff5c297cbb0c14c7bbbfcf25b0c2a284a0eba48583ee28057948fdec2d830293ed18d73d6494 SHA512 5efaea5188f5e97b3343c1e2b2dc99ef23e61f29aa7ca150144e9aa16e49b2c2790aadff877a46fcd37fcfce68bd26d2c9a38f984f1283b62a3ddb382d816b65
2
-AUX courier-pythonfilter-ipv6-networkblocks.patch 1257 BLAKE2B 4f1a59347a34676d996f8ecc1bbc7c15296d86466dd236cc638ea0ec87fffaa4faef2b57fbd55bc6714d21b81911a3cf62ce2387b719d7bbdf01021ccceff55e SHA512 29c80a3f247259d35076c985a54e9e053b61867da12849fa1bffc98ba45e9d56cd3afda9d61c9b65e2cfc9897e313d2ce40e14b71157aa5df03d58728ce92c37
3
-AUX courier-pythonfilter-whitelist-sender.patch 2205 BLAKE2B f136fb9d5fef6ccf70edea0c36e324060778c5adcd9621b4955dde5563e3d55d7c733743df0ebd59ef700961acdfcbd97f9d3fe2330076406bb07e0a8f0f0055 SHA512 9a25b079ed7b7680ba59809a1cf600c53b0ca688f138e01255e8d47ba34d144996381ac38d5a0ce93986c73e0c59adf59661d8824c190371744c789b4a667d75
4
-DIST courier-pythonfilter-1.11.tar.gz 65193 BLAKE2B 9b14e8caa6f173abb15c74c43854c917c61731e0610a9acd4f4e8300043663dca6f00e99f9c7eed7296bb07a37726457a6aaa182981e522632057ffc70250bbf SHA512 75ffff7d9692861c535ee18d1d25954c79e81275641172ad706caf0c65dc715ffd4a1c021b0e26fc992fffdf6c2842ed8fc688eff82ec42591b35af834c0ace4
5
-DIST courier-pythonfilter-3.0.2.tar.gz 59121 BLAKE2B 6223ddd62c1c1af980720451e3446cd3b2296a243c5c8d3b5e60fd8640e3391ba2e561ea251bbacbb4a1c6cdbe7eccf6f7ff8221d952cf5703d389b0267a1a2f SHA512 62985a3fefc2d324b3ba7035117e88e4e246815e63fe1b681af11a38a20ea55e649a233c1979b918b166f5c2abbcc22037f215b73be298763f777648249cd652
6
-DIST courier-pythonfilter-3.0.tar.gz 59420 BLAKE2B 61ab15a0ee55a0cba5bde632cb28a0f17e4b0285e0a7060e5771b5ea2ecde8bc1306cc2b1c0b3833e521a8ca5a899ae9f56fdb26f89c76d38e0ce25ea75e8f04 SHA512 6c13c65111ac6ab86d93d3ccfa27208c963dbf4fd67b86d3948fa1935c131fd2ca5944cb4163ecf71355760ccb478faf59974ee0573b9e74bc163f633333c5c0
7
-EBUILD courier-pythonfilter-1.11.ebuild 626 BLAKE2B 92901ce0f943e1e9036dd859e8b5a376f625315ac10df504faaf967419e81234e820fa15156f645b2fe01f49affded41af9a48861eb95c18e2db6546c293a815 SHA512 19eb0bd699ebb65a0a2a451742d7ca5331f2c830877dece69314103f7b7636fa1f066860daf596b711377e749a317ad4ceed8496287fac16a4eaade74d6cd831
8
-EBUILD courier-pythonfilter-3.0.2.ebuild 498 BLAKE2B 9585022201b151a162ae3c6e0b70b95c5a949baa6cc670817e0e41fa333cc2f5569ea8cd573dbdd96db69a1c9a30691799a73f97e90ee4baa21fa2875304f20f SHA512 e3d59b8e67f9ea46d4340cdf69f5e478a6d03e6cf17f7801fd81db4302505a6cfd56cc1d81c74c07a29cb6d51f0ff34356df13eeff8929997f03e6d6604e4046
9
-EBUILD courier-pythonfilter-3.0.ebuild 568 BLAKE2B 43d07c8b880429e9f971fbc7727ddc1781b325ba0d58987d6b2a9444a19aa78fe605bb3ca55b076ed65ba6cc8a67725735c6e1b7c03f9397b3ebf41210472fe7 SHA512 3654aea2cad4ec8a97fcae8b7b7a92194da63e1046bc5c3f028f0aea15103a0ef39bdf3674619a8271a2133196a486133b60b9bc125167f6b51e65dd2e7e4a17
10 0
deleted file mode 100644
... ...
@@ -1,27 +0,0 @@
1
-# Copyright 1999-2017 Gentoo Foundation
2
-# Distributed under the terms of the GNU General Public License v2
3
-
4
-EAPI=6
5
-
6
-PYTHON_COMPAT=( python2_7 )
7
-
8
-inherit distutils-r1
9
-
10
-DESCRIPTION="Python filtering architecture for the Courier MTA"
11
-HOMEPAGE="https://pypi.python.org/pypi/courier-pythonfilter/"
12
-SRC_URI="http://phantom.dragonsdawn.net/~gordon/${PN}/${P}.tar.gz"
13
-
14
-LICENSE="GPL-3"
15
-SLOT="0"
16
-KEYWORDS="~amd64"
17
-IUSE=""
18
-
19
-RDEPEND=""
20
-DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
21
-	mail-mta/courier"
22
-
23
-PATCHES=(
24
-	"${FILESDIR}/courier-pythonfilter-ipv6-networkblocks.patch"
25
-	"${FILESDIR}/courier-pythonfilter-whitelist-sender.patch"
26
-	)
27
-
28 0
deleted file mode 100644
... ...
@@ -1,21 +0,0 @@
1
-# Copyright 1999-2019 Gentoo Authors
2
-# Distributed under the terms of the GNU General Public License v2
3
-
4
-EAPI=7
5
-
6
-PYTHON_COMPAT=( python3_{5,6,7} )
7
-
8
-inherit distutils-r1
9
-
10
-DESCRIPTION="Python filtering architecture for the Courier MTA"
11
-HOMEPAGE="https://bitbucket.org/gordonmessmer/courier-pythonfilter/src/default/"
12
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
13
-
14
-LICENSE="GPL-3"
15
-SLOT="0"
16
-KEYWORDS="~amd64"
17
-IUSE=""
18
-
19
-RDEPEND=""
20
-DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
21
-	mail-mta/courier"
22 0
deleted file mode 100644
... ...
@@ -1,23 +0,0 @@
1
-# Copyright 1999-2019 Gentoo Authors
2
-# Distributed under the terms of the GNU General Public License v2
3
-
4
-EAPI=7
5
-
6
-PYTHON_COMPAT=( python3_{5,6,7} )
7
-
8
-inherit distutils-r1
9
-
10
-DESCRIPTION="Python filtering architecture for the Courier MTA"
11
-HOMEPAGE="https://pypi.python.org/pypi/courier-pythonfilter/"
12
-SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
13
-
14
-LICENSE="GPL-3"
15
-SLOT="0"
16
-KEYWORDS="~amd64"
17
-IUSE=""
18
-
19
-RDEPEND=""
20
-DEPEND="dev-python/setuptools[${PYTHON_USEDEP}]
21
-	mail-mta/courier"
22
-
23
-PATCHES="${FILESDIR}/courier-pythonfilter-fix-charset-issue-and-controlfile-issue.diff"
24 0
deleted file mode 100644
... ...
@@ -1,60 +0,0 @@
1
-diff -r e76f1ee05cc8 courier/control.py
2
-+++ b/courier/control.py	Fri Aug 09 12:31:26 2019 +0200
3
-@@ -73,7 +73,7 @@
4
-     sender = get_senders_mta(control_paths)
5
-     if not sender:
6
-         return None
7
--    ipstr = sender.partition('[')[2].partition(']')[0]
8
-+    ipstr = sender.rpartition('[')[2].partition(']')[0]
9
-     if not ipstr:
10
-         return None
11
-     sender_ip = ipaddress.ip_address(ipstr)
12
-diff -r e76f1ee05cc8 courier/xfilter.py
13
-+++ b/courier/xfilter.py	Fri Aug 09 12:31:26 2019 +0200
14
-@@ -26,6 +26,7 @@
15
-     import email.generator
16
- import courier.control
17
- import courier.config
18
-+import tempfile
19
- 
20
- 
21
- class XFilterError(Exception):
22
-@@ -86,18 +87,24 @@
23
-         return self.control_data
24
- 
25
-     def submit(self):
26
--        bfo = open(self.body_path, 'r+')
27
--        bfo.truncate(0)
28
--        g = email.generator.Generator(bfo, mangle_from_=False)
29
--        g.flatten(self.message)
30
--        # Make sure that the file ends with a newline, or courier
31
--        # will choke on the new message file.
32
--        bfo.seek(0, 2)
33
--        bfo.seek(bfo.tell() - 1, 0)
34
--        if bfo.read(1) != '\n':
35
--            bfo.seek(0, 2)
36
--            bfo.write('\n')
37
--        bfo.close()
38
-+        with tempfile.TemporaryFile(mode='w+b', prefix='pythonfilter') as tmp:
39
-+            g = email.generator.BytesGenerator(tmp, mangle_from_=False)
40
-+            g.flatten(self.message)
41
-+            # Make sure that the file ends with a newline, or courier
42
-+            # will choke on the new message file.
43
-+            tmp.seek(0, 2)
44
-+            tmp.seek(tmp.tell() - 1, 0)
45
-+            if tmp.read(1).decode('ascii') != '\n':
46
-+                tmp.seek(0, 2)
47
-+                tmp.write('\n'.encode('ascii'))
48
-+            tmp.seek(0)
49
-+            with open(self.body_path, 'r+b') as bfo:
50
-+                bfo.truncate(0)
51
-+                while True:
52
-+                    data = tmp.read(4096)
53
-+                    if not data:
54
-+                        break
55
-+                    bfo.write(data)
56
-         return ''
57
- 
58
-     # Deprecated names preserved for compatibility with older releases
59 0
deleted file mode 100644
... ...
@@ -1,32 +0,0 @@
1
-From 85c456fce923cb967fb3852d81763eb74093cc26 Mon Sep 17 00:00:00 2001
2
-From: Bernd Wurst <bernd@milch.schokokeks.org>
3
-Date: Tue, 14 Mar 2017 14:44:28 +0100
4
-Subject: [PATCH] Add IPv6 network calculation
5
-
6
- filters/greylist.py | 12 ++++++++++--
7
- 1 file changed, 10 insertions(+), 2 deletions(-)
8
-
9
-diff --git a/filters/greylist.py b/filters/greylist.py
10
-index ad044ea..ffc1eb7 100644
11
-+++ b/filters/greylist.py
12
-@@ -87,8 +87,16 @@ def doFilter(bodyFile, controlFileList):
13
-     # Calculate the /24 network
14
-     IPv4Match = _IPv4Regex.match(sendersIP)
15
-     if(IPv4Match is None):
16
--        # IPv6 network calculation isn't handled yet
17
--        sendersIPNetwork = sendersIP
18
-+        # possibly IPv6
19
-+        try:
20
-+            pos = sendersIP.rindex(':')
21
-+            sendersIPNetwork = sendersIP[:pos+1]
22
-+            # If there are not more than 4 colons left in the address after stripping, something is wrong
23
-+            if sendersIPNetwork.count(':') < 5:
24
-+                raise ValueError('Too generic address or no valid ipv6 address: %s\n' % sendersIPNetwork)
25
-+        except ValueError as e:
26
-+            sendersIPNetwork = sendersIP
27
-+            sys.stderr.write(str(e))
28
-     else:
29
-        sendersIPNetwork = IPv4Match.group(1)
30
- 
31 0
deleted file mode 100644
... ...
@@ -1,59 +0,0 @@
1
-From 61f1ae2cd94ece9e452e8fd02dbdf4d2f91f85e2 Mon Sep 17 00:00:00 2001
2
-From: Bernd Wurst <bernd@milch.schokokeks.org>
3
-Date: Tue, 14 Mar 2017 15:44:40 +0100
4
-Subject: [PATCH] Add configurable mode that whitelists only senders IP
5
- addresses instead of triplets
6
-
7
- filters/greylist.py | 24 +++++++++++++++++++++++-
8
- 1 file changed, 23 insertions(+), 1 deletion(-)
9
-
10
-diff --git a/filters/greylist.py b/filters/greylist.py
11
-index ffc1eb7..614e4c4 100644
12
-+++ b/filters/greylist.py
13
-@@ -42,6 +42,7 @@
14
- sendersPassedTTL = 60 * 60 * 24 * 36
15
- sendersNotPassedTTL = 60 * 60 * 24
16
- greylistTime = 300
17
-+onlySendersIP = False
18
- 
19
- _IPv4Regex = re.compile('^(\d+\.\d+\.\d+)\.\d+$')
20
- 
21
-@@ -113,6 +114,22 @@ def doFilter(bodyFile, controlFileList):
22
-     _sendersPassed.purge()
23
-     _sendersNotPassed.purge()
24
- 
25
-+    if onlySendersIP:
26
-+        found = False
27
-+        addrMd5 = hashlib.md5(sendersIPNetwork)
28
-+        addrdigest = addrMd5.hexdigest()
29
-+        _sendersPassed.lock()
30
-+        try:
31
-+            if _sendersPassed.has_key(addrdigest):
32
-+                _Debug('address found in the Passed db')
33
-+                _sendersPassed[addrdigest] = time.time()
34
-+                found = True
35
-+        finally:
36
-+            _sendersPassed.unlock()
37
-+
38
-+        if found:
39
-+            return ''
40
-+
41
-     # Create a new MD5 object.  The sender/recipient/IP triplets will
42
-     # be stored in the db in the form of an MD5 digest.
43
-     senderMd5 = hashlib.md5(sender)
44
-@@ -152,7 +169,12 @@ def doFilter(bodyFile, controlFileList):
45
-                         biggestTimeToGo = timeToGo
46
-                 else:
47
-                     _Debug('triplet in NotPassed db is now passed')
48
--                    _sendersPassed[cdigest] = time.time()
49
-+                    if onlySendersIP:
50
-+                        addrMd5 = hashlib.md5(sendersIPNetwork)
51
-+                        addrdigest = addrMd5.hexdigest()
52
-+                        _sendersPassed[addrdigest] = time.time()
53
-+                    else:
54
-+                        _sendersPassed[cdigest] = time.time()
55
-                     del(_sendersNotPassed[cdigest])
56
-             elif _sendersPassed.has_key(cdigest):
57
-                 _Debug('triplet found in the Passed db')