letsencrypt: Add option to let Plinth "manage" certbot's renewal hooks

- add action commands for managing and running hooks

- adding template, view and url for managing and running hooks

- disable Plinth hook management on domain change
This commit is contained in:
Johannes Keyser authored and James Valleroy committed 2017-07-19 21:47:00 -04:00
1 parent 1d4289068a
commit 1069f84154
6 files changed
+334 -6

No files matched your search

+14 -1
View File
@@ -20,12 +20,13 @@ Plinth module for using Let's Encrypt.
"""
from django.utils.translation import ugettext_lazy as _
from plinth import actions
from plinth import action_utils
from plinth import cfg
from plinth.menu import main_menu
from plinth.modules import names
from plinth.utils import format_lazy
from plinth.signals import domainname_change
version = 1
@@ -63,6 +64,7 @@ def init():
menu = main_menu.get('system')
menu.add_urlname(_('Certificates (Let\'s Encrypt)'),
'glyphicon-lock', 'letsencrypt:index')
domainname_change.connect(on_domainname_change)
def setup(helper, old_version=None):
@@ -82,3 +84,14 @@ def diagnose():
results.append(action_utils.diagnose_url('https://' + domain))
return results
def on_domainname_change(sender, old_domainname, new_domainname, **kwargs):
"""Disable renewal hook management after a domain name change."""
del sender # Unused
del new_domainname # Unused
del kwargs # Unused
actions.superuser_run('letsencrypt', ['manage_hooks', 'disable',
'--domain', old_domainname],
async=True)