| Server IP : 127.0.1.1 / Your IP : 216.73.216.152 Web Server : Apache/2.4.52 (Ubuntu) System : Linux bahcrestlinepropertiesllc 5.15.0-113-generic #123-Ubuntu SMP Mon Jun 10 08:16:17 UTC 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /proc/self/root/lib/python3/dist-packages/certbot/_internal/ |
Upload File : |
"""Updaters run at renewal"""
import logging
from certbot import errors
from certbot import interfaces
from certbot._internal.plugins import selection as plug_sel
from certbot.plugins import enhancements
logger = logging.getLogger(__name__)
def run_generic_updaters(config, lineage, plugins):
"""Run updaters that the plugin supports
:param config: Configuration object
:type config: certbot.configuration.NamespaceConfig
:param lineage: Certificate lineage object
:type lineage: storage.RenewableCert
:param plugins: List of plugins
:type plugins: certbot._internal.plugins.disco.PluginsRegistry
:returns: `None`
:rtype: None
"""
if config.dry_run:
logger.debug("Skipping updaters in dry-run mode.")
return
try:
installer = plug_sel.get_unprepared_installer(config, plugins)
except errors.Error as e:
logger.error("Could not choose appropriate plugin for updaters: %s", e)
return
if installer:
_run_updaters(lineage, installer, config)
_run_enhancement_updaters(lineage, installer, config)
def run_renewal_deployer(config, lineage, installer):
"""Helper function to run deployer interface method if supported by the used
installer plugin.
:param config: Configuration object
:type config: certbot.configuration.NamespaceConfig
:param lineage: Certificate lineage object
:type lineage: storage.RenewableCert
:param installer: Installer object
:type installer: interfaces.Installer
:returns: `None`
:rtype: None
"""
if config.dry_run:
logger.debug("Skipping renewal deployer in dry-run mode.")
return
if not config.disable_renew_updates and isinstance(installer,
interfaces.RenewDeployer):
installer.renew_deploy(lineage)
_run_enhancement_deployers(lineage, installer, config)
def _run_updaters(lineage, installer, config):
"""Helper function to run the updater interface methods if supported by the
used installer plugin.
:param lineage: Certificate lineage object
:type lineage: storage.RenewableCert
:param installer: Installer object
:type installer: interfaces.Installer
:returns: `None`
:rtype: None
"""
if not config.disable_renew_updates:
if isinstance(installer, interfaces.GenericUpdater):
installer.generic_updates(lineage)
def _run_enhancement_updaters(lineage, installer, config):
"""Iterates through known enhancement interfaces. If the installer implements
an enhancement interface and the enhance interface has an updater method, the
updater method gets run.
:param lineage: Certificate lineage object
:type lineage: storage.RenewableCert
:param installer: Installer object
:type installer: interfaces.Installer
:param config: Configuration object
:type config: certbot.configuration.NamespaceConfig
"""
if config.disable_renew_updates:
return
for enh in enhancements._INDEX: # pylint: disable=protected-access
if isinstance(installer, enh["class"]) and enh["updater_function"]:
getattr(installer, enh["updater_function"])(lineage)
def _run_enhancement_deployers(lineage, installer, config):
"""Iterates through known enhancement interfaces. If the installer implements
an enhancement interface and the enhance interface has an deployer method, the
deployer method gets run.
:param lineage: Certificate lineage object
:type lineage: storage.RenewableCert
:param installer: Installer object
:type installer: interfaces.Installer
:param config: Configuration object
:type config: certbot.configuration.NamespaceConfig
"""
if config.disable_renew_updates:
return
for enh in enhancements._INDEX: # pylint: disable=protected-access
if isinstance(installer, enh["class"]) and enh["deployer_function"]:
getattr(installer, enh["deployer_function"])(lineage)