diff options
| author | J08nY | 2017-06-04 03:19:32 +0200 |
|---|---|---|
| committer | J08nY | 2017-06-04 03:19:32 +0200 |
| commit | 2c0adaf6bb8cf5d5e5246ab789d2c0018a1520f5 (patch) | |
| tree | 9f81746170edaf32302f95b565cd355ed5f8b95d | |
| parent | c06af042f8992d8d6abb02a2795b6146c6f32a0e (diff) | |
| download | mailman-pgp-2c0adaf6bb8cf5d5e5246ab789d2c0018a1520f5.tar.gz mailman-pgp-2c0adaf6bb8cf5d5e5246ab789d2c0018a1520f5.tar.zst mailman-pgp-2c0adaf6bb8cf5d5e5246ab789d2c0018a1520f5.zip | |
| -rw-r--r-- | setup.py | 5 | ||||
| -rw-r--r-- | src/pgpmailman/archivers/local.py | 14 | ||||
| -rw-r--r-- | src/pgpmailman/archivers/remote.py | 14 | ||||
| -rw-r--r-- | src/pgpmailman/commands/eml_key.py | 26 | ||||
| -rw-r--r-- | src/pgpmailman/plugin.py | 7 | ||||
| -rw-r--r-- | src/pgpmailman/rest/lists.py | 15 | ||||
| -rw-r--r-- | src/pgpmailman/rest/root.py | 32 | ||||
| -rw-r--r-- | src/pgpmailman/rest/users.py | 14 | ||||
| -rw-r--r-- | src/pgpmailman/runners/incoming.py | 8 | ||||
| -rw-r--r-- | src/pgpmailman/runners/outgoing.py | 4 | ||||
| -rw-r--r-- | src/pgpmailman/styles/announce.py | 10 | ||||
| -rw-r--r-- | src/pgpmailman/styles/discussion.py | 9 |
12 files changed, 137 insertions, 21 deletions
@@ -1,12 +1,11 @@ -from setuptools import setup, find_packages +from setuptools import find_packages, setup setup( name='pgpmailman', version='0.1', description='A PGP plugin for the GNU Mailman mailing list manager', long_description="""\ -A plugin for GNU Mailman that adds encrypted mailing lists via PGP/MIME. - """, +A plugin for GNU Mailman that adds encrypted mailing lists via PGP/MIME.""", author='Jan Jancar', author_email='johny@neuromancer.sk', license='', diff --git a/src/pgpmailman/archivers/local.py b/src/pgpmailman/archivers/local.py new file mode 100644 index 0000000..43e08ee --- /dev/null +++ b/src/pgpmailman/archivers/local.py @@ -0,0 +1,14 @@ +""" +Archives messages locally, encrypted (TBD how), +similar to Mailman's prototype archiver. +""" + +from mailman.interfaces.archiver import IArchiver +from public import public +from zope.interface import implementer + + +@public +@implementer(IArchiver) +class LocalArchiver: + pass diff --git a/src/pgpmailman/archivers/remote.py b/src/pgpmailman/archivers/remote.py new file mode 100644 index 0000000..388de3a --- /dev/null +++ b/src/pgpmailman/archivers/remote.py @@ -0,0 +1,14 @@ +""" +Archives messages by sending to django-pgpmailman, +an extension on top of Postorius and HyperKitty. +""" + +from mailman.interfaces.archiver import IArchiver +from public import public +from zope.interface import implementer + + +@public +@implementer(IArchiver) +class RemoteArchiver: + pass diff --git a/src/pgpmailman/commands/eml_key.py b/src/pgpmailman/commands/eml_key.py index 6cb8469..ba538fa 100644 --- a/src/pgpmailman/commands/eml_key.py +++ b/src/pgpmailman/commands/eml_key.py @@ -1,11 +1,13 @@ -from mailman.interfaces.command import IEmailCommand +"""The key email command.""" + +from mailman.interfaces.command import ContinueProcessing, IEmailCommand from public import public from zope.interface import implementer @public @implementer(IEmailCommand) -class Key: +class KeyCommand: name = 'key' argument_description = '<change|revoke|sign>' short_description = '' @@ -13,4 +15,22 @@ class Key: def process(mlist, msg, msgdata, arguments, results): """See `IEmailCommand`.""" - pass + if len(arguments) == 0: + print('No sub-command specified,' + ' must be one of <change|revoke|sign>.', file=results) + return ContinueProcessing.no + if arguments[0] == 'change': + # New public key in attachment, requires to be signed with current + # key + pass + elif arguments[0] == 'revoke': + # Current key revocation certificate in attachment, restarts the + # subscription process, or rather only it's key setup part. + pass + elif arguments[0] == 'sign': + # List public key attached, signed by the users current key. + pass + else: + print('Wrong sub-command specified,' + ' must be one of <change|revoke|sign>.', file=results) + return ContinueProcessing.no diff --git a/src/pgpmailman/plugin.py b/src/pgpmailman/plugin.py index a9b8dd4..5ae51a0 100644 --- a/src/pgpmailman/plugin.py +++ b/src/pgpmailman/plugin.py @@ -1,3 +1,5 @@ +""" A PGP plugin for GNU Mailman.""" + from mailman.interfaces.plugin import IPlugin from pgpmailman.rest.root import RESTRoot from public import public @@ -8,16 +10,17 @@ from zope.interface import implementer @implementer(IPlugin) class PGPMailman: - name = 'pgpmailman' - def __init__(self): self._rest = RESTRoot() def pre_hook(self): + """See `IPlugin`.""" pass def post_hook(self): + """See `IPlugin`.""" pass def rest_object(self): + """See `IPlugin`.""" return self._rest diff --git a/src/pgpmailman/rest/lists.py b/src/pgpmailman/rest/lists.py index e69de29..2c4a58a 100644 --- a/src/pgpmailman/rest/lists.py +++ b/src/pgpmailman/rest/lists.py @@ -0,0 +1,15 @@ +"""""" + +from public import public + + +@public +class AllEncryptedLists: + pass + + +@public +class AnEncryptedList: + + def __init__(self, list_name): + pass diff --git a/src/pgpmailman/rest/root.py b/src/pgpmailman/rest/root.py index a0dd3fa..b937fd3 100644 --- a/src/pgpmailman/rest/root.py +++ b/src/pgpmailman/rest/root.py @@ -1,14 +1,40 @@ +""" +REST root. + + +/lists/ -> List all known encrypted lists. +/lists/<list_id>/ -> +/lists/<list_id>/key -> GET list_public_key +/lists/<list_id>/archive/key -> GET/POST list_archive_public_key + +/users/ -> List all known users of encrypted lists. +/users/<uid>/ -> +/users/<uid>/key -> GET/POST user_public_key + +""" + from mailman.rest.helpers import child +from pgpmailman.rest.lists import AllEncryptedLists, AnEncryptedList +from pgpmailman.rest.users import AUser, AllUsers from public import public @public class RESTRoot: - @child() def lists(self, context, segments): - pass + if len(segments) == 0: + return AllEncryptedLists(), [] + else: + list_name = segments.pop(0) + # WIP Check whether it's an encrypted list we know of here. + return AnEncryptedList(list_name), segments @child() def users(self, context, segments): - pass + if len(segments) == 0: + return AllUsers(), [] + else: + uid = segments.pop(0) + # WIP Check whether it's an encrypted user we know of here. + return AUser(uid), segments diff --git a/src/pgpmailman/rest/users.py b/src/pgpmailman/rest/users.py index e69de29..bc6798d 100644 --- a/src/pgpmailman/rest/users.py +++ b/src/pgpmailman/rest/users.py @@ -0,0 +1,14 @@ +"""""" + +from public import public + + +@public +class AllUsers: + pass + + +@public +class AUser: + + pass diff --git a/src/pgpmailman/runners/incoming.py b/src/pgpmailman/runners/incoming.py index 6d1aae5..ccf90f4 100644 --- a/src/pgpmailman/runners/incoming.py +++ b/src/pgpmailman/runners/incoming.py @@ -1,9 +1,15 @@ +"""The encryption-aware incoming runner.""" + from mailman.core.runner import Runner from public import public @public -class Incoming(Runner): +class IncomingRunner(Runner): def _dispose(self, mlist, msg, msgdata): """See `IRunner`.""" pass + # Is the message for an encrypted mailing list? If not, pass to default + # incoming runner. If yes, go on. + + # Is the message encrypted? diff --git a/src/pgpmailman/runners/outgoing.py b/src/pgpmailman/runners/outgoing.py index 6b23fe2..d7d74bc 100644 --- a/src/pgpmailman/runners/outgoing.py +++ b/src/pgpmailman/runners/outgoing.py @@ -1,9 +1,11 @@ +"""The encryption-aware outgoing runner""" + from mailman.core.runner import Runner from public import public @public -class Outgoing(Runner): +class OutgoingRunner(Runner): def _dispose(self, mlist, msg, msgdata): """See `IRunner`.""" pass diff --git a/src/pgpmailman/styles/announce.py b/src/pgpmailman/styles/announce.py index dc07c57..f83c2ea 100644 --- a/src/pgpmailman/styles/announce.py +++ b/src/pgpmailman/styles/announce.py @@ -1,10 +1,12 @@ -from mailman.interfaces.styles import IStyle +"""""" + +from mailman.styles.default import LegacyAnnounceOnly from public import public -from zope.interface import implementer @public -@implementer(IStyle) -class Announce: +class Announce(LegacyAnnounceOnly): def apply(self, mailing_list): """See `IStyle`.""" + super().apply(mailing_list) + # diff --git a/src/pgpmailman/styles/discussion.py b/src/pgpmailman/styles/discussion.py index 310b7a1..55304cd 100644 --- a/src/pgpmailman/styles/discussion.py +++ b/src/pgpmailman/styles/discussion.py @@ -1,10 +1,11 @@ -from mailman.interfaces.styles import IStyle +"""""" + +from mailman.styles.default import LegacyDefaultStyle from public import public -from zope.interface import implementer @public -@implementer(IStyle) -class Discussion: +class Discussion(LegacyDefaultStyle): def apply(self, mailing_list): """See `IStyle`.""" + super().apply(mailing_list) |
