mirror of
https://github.com/certbot/certbot.git
synced 2026-06-03 22:08:07 -04:00
* Implement certbot services * Various fixes * Local oldest requirements * Clean imports * Add unit tests for certbot.services * Clean code * Protect against nullity of global services * Fix CLI * Fix tests * Consistent test behavior * Define new ABC classes * Reimplement services with new ABC classes * Adapt plugins discovery and selection * Remove zope interfaces from plugins * Re-enable delegation for simplicity * Fix interfaces declaration * Remove interface implementer * Interfaces ordering * Extract zope logic from discovery * Cleanup imports * Fixing tests * Fix main_test * Finish certbot unit tests * Fix lint * Various fixes thanks to mypy * Fix lint * Order imports * Various fixes * Clean code * Remove reporter service, migrate display service in certbot.display.util. * Fix test * Fix apache compatibility test * Fix oldest test * Setup certbot.display.service module * Reintegrate in util * Fix imports * Fix tests and documentation * Refactor * Cleanup * Cleanup * Clean imports * Add unit tests * Borrow sphinx build fix from #8863 * Align zope interfaces on ABC * Various fixes * Fix type * Fix type * Some cleanup * Fix lint * Update certbot/certbot/_internal/configuration.py Co-authored-by: Brad Warren <bmw@users.noreply.github.com> * Update certbot/certbot/_internal/configuration.py Co-authored-by: Brad Warren <bmw@users.noreply.github.com> * Fix imports * Fix Config contract (accounts_dir property) * Remove unnecessary interface * Set NamespaceConfig public, remove Config interface * Remove Display ABC and implementation of IDisplay * Clean lint * Cleanup old decorators * Contract on plugin constructor only * Update certbot/certbot/tests/util.py Co-authored-by: Brad Warren <bmw@users.noreply.github.com> * Update certbot/certbot/configuration.py Co-authored-by: Brad Warren <bmw@users.noreply.github.com> * Update certbot/certbot/interfaces.py Co-authored-by: Brad Warren <bmw@users.noreply.github.com> * Some corrections * Add changelog * Fix --authenticators and --installers flags on plugins subcommand * Fix multiheritance on the interface Plugin * Update certbot/certbot/_internal/plugins/manual.py Co-authored-by: Brad Warren <bmw@users.noreply.github.com> * Update certbot/certbot/_internal/plugins/disco.py Co-authored-by: Brad Warren <bmw@users.noreply.github.com> * Add warnings in logger also * Add deprecation warnings also when plugins are verified. Co-authored-by: Brad Warren <bmw@users.noreply.github.com>
60 lines
2.3 KiB
Python
60 lines
2.3 KiB
Python
""" Distribution specific override class for Gentoo Linux """
|
|
from certbot_apache._internal import apache_util
|
|
from certbot_apache._internal import configurator
|
|
from certbot_apache._internal import parser
|
|
from certbot_apache._internal.configurator import OsOptions
|
|
|
|
|
|
class GentooConfigurator(configurator.ApacheConfigurator):
|
|
"""Gentoo specific ApacheConfigurator override class"""
|
|
|
|
OS_DEFAULTS = OsOptions(
|
|
server_root="/etc/apache2",
|
|
vhost_root="/etc/apache2/vhosts.d",
|
|
vhost_files="*.conf",
|
|
restart_cmd_alt=['apache2ctl', 'restart'],
|
|
challenge_location="/etc/apache2/vhosts.d",
|
|
)
|
|
|
|
def _prepare_options(self):
|
|
"""
|
|
Override the options dictionary initialization in order to support
|
|
alternative restart cmd used in Gentoo.
|
|
"""
|
|
super()._prepare_options()
|
|
if not self.options.restart_cmd_alt: # pragma: no cover
|
|
raise ValueError("OS option restart_cmd_alt must be set for Gentoo.")
|
|
self.options.restart_cmd_alt[0] = self.options.ctl
|
|
|
|
def get_parser(self):
|
|
"""Initializes the ApacheParser"""
|
|
return GentooParser(
|
|
self.options.server_root, self.options.vhost_root,
|
|
self.version, configurator=self)
|
|
|
|
|
|
class GentooParser(parser.ApacheParser):
|
|
"""Gentoo specific ApacheParser override class"""
|
|
def __init__(self, *args, **kwargs):
|
|
# Gentoo specific configuration file for Apache2
|
|
self.apacheconfig_filep = "/etc/conf.d/apache2"
|
|
super().__init__(*args, **kwargs)
|
|
|
|
def update_runtime_variables(self):
|
|
""" Override for update_runtime_variables for custom parsing """
|
|
self.parse_sysconfig_var()
|
|
self.update_modules()
|
|
|
|
def parse_sysconfig_var(self):
|
|
""" Parses Apache CLI options from Gentoo configuration file """
|
|
defines = apache_util.parse_define_file(self.apacheconfig_filep,
|
|
"APACHE2_OPTS")
|
|
for k, v in defines.items():
|
|
self.variables[k] = v
|
|
|
|
def update_modules(self):
|
|
"""Get loaded modules from httpd process, and add them to DOM"""
|
|
mod_cmd = [self.configurator.options.ctl, "modules"]
|
|
matches = apache_util.parse_from_subprocess(mod_cmd, r"(.*)_module")
|
|
for mod in matches:
|
|
self.add_mod(mod.strip())
|