From 0e2e4c9be7be1c59ec1226ed04e51454db459fe6 Mon Sep 17 00:00:00 2001 From: Michael Porter Date: Mon, 12 Mar 2018 16:22:04 +0000 Subject: [PATCH] Add example plugin from certbot source, and notes for running with certbot docker container --- .gitignore | 6 ++++ .../certbot_example_plugins.py | 31 +++++++++++++++++++ certbot-example-plugins/setup.py | 17 ++++++++++ notes.txt | 3 ++ 4 files changed, 57 insertions(+) create mode 100644 .gitignore create mode 100644 certbot-example-plugins/certbot_example_plugins.py create mode 100644 certbot-example-plugins/setup.py create mode 100644 notes.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f979595 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.pyc +*.pyo +*.swp +*.swo +*.egg-info + diff --git a/certbot-example-plugins/certbot_example_plugins.py b/certbot-example-plugins/certbot_example_plugins.py new file mode 100644 index 0000000..9dec2e1 --- /dev/null +++ b/certbot-example-plugins/certbot_example_plugins.py @@ -0,0 +1,31 @@ +"""Example Certbot plugins. + +For full examples, see `certbot.plugins`. + +""" +import zope.interface + +from certbot import interfaces +from certbot.plugins import common + + +@zope.interface.implementer(interfaces.IAuthenticator) +@zope.interface.provider(interfaces.IPluginFactory) +class Authenticator(common.Plugin): + """Example Authenticator.""" + + description = "Example Authenticator plugin" + + # Implement all methods from IAuthenticator, remembering to add + # "self" as first argument, e.g. def prepare(self)... + + +@zope.interface.implementer(interfaces.IInstaller) +@zope.interface.provider(interfaces.IPluginFactory) +class Installer(common.Plugin): + """Example Installer.""" + + description = "Example Installer plugin" + + # Implement all methods from IInstaller, remembering to add + # "self" as first argument, e.g. def get_all_names(self)... diff --git a/certbot-example-plugins/setup.py b/certbot-example-plugins/setup.py new file mode 100644 index 0000000..4538e83 --- /dev/null +++ b/certbot-example-plugins/setup.py @@ -0,0 +1,17 @@ +from setuptools import setup + + +setup( + name='certbot-example-plugins', + package='certbot_example_plugins.py', + install_requires=[ + 'certbot', + 'zope.interface', + ], + entry_points={ + 'certbot.plugins': [ + 'example_authenticator = certbot_example_plugins:Authenticator', + 'example_installer = certbot_example_plugins:Installer', + ], + }, +) diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..2dc389a --- /dev/null +++ b/notes.txt @@ -0,0 +1,3 @@ +docker run -it --rm --entrypoint /bin/sh -v "$(pwd)/certbot-example-plugins:/tmp/certbot-example-plugins" certbot/certbot:v0.22.0 +certbot plugins +pip install -e /tmp/certbot-example-plugins