3 گaD@s"dZddlmZddlmZddlmZddlZddlmZddl m Z ddl m Z dd l m Z dd l m Z dd l mZdd l mZdd l mZddl mZddlZddlZddlmZddlmZddlmZddlmZddlmZerddlmZGdddedZ Gdddej!j"Z#Gdddej!j"Z$Gdddej!j"Z%GdddedZ&Gd d!d!e%Z'Gd"d#d#e&Z(Gd$d%d%e%Z)Gd&d'd'e&Z*Gd(d)d)ej!j"Z+Gd*d+d+ej!j"Z,Gd,d-d-edZ-Gd.d/d/edZ.Gd0d1d1edZ/Gd2d3d3Z0e ee0ej1e2ej1e2<dS)4zCertbot client interfaces.)ABCMeta)abstractmethod)ArgumentParserN) ModuleType)Any)cast)Iterable)List)Optional)Type) TYPE_CHECKING)Union) Challenge)ChallengeResponse) ClientBase) configuration)AnnotatedChallenge)Accountc@sPeZdZdZeeddddZeeddddZede d d d d Z d S) AccountStoragezAccounts storage interface.r)returncCs tdS)zXFind all accounts. :returns: All found accounts. :rtype: list N)NotImplementedError)selfr /usr/lib/python3.6/interfaces.pyfind_all szAccountStorage.find_all) account_idrcCs tdS)zLoad an account by its id. :raises .AccountNotFound: if account could not be found :raises .AccountStorageError: if account could not be loaded :returns: The account loaded :rtype: .Account N)r)rrrrrload*s zAccountStorage.loadN)accountclientrcCs tdS)z\Save account. :raises .AccountStorageError: if account could not be saved N)r)rrrrrrsave7szAccountStorage.save) __name__ __module__ __qualname____doc__rr rstrrrrrrrrrs  r) metaclassc@seZdZdZdS)IConfigz>Deprecated, use certbot.configuration.NamespaceConfig instead.N)r r!r"r#rrrrr&Asr&c@seZdZdZdS)IPluginFactoryz9Deprecated, use certbot.interfaces.Plugin as ABC instead.N)r r!r"r#rrrrr'Esr'c@seZdZdZdS)IPluginz9Deprecated, use certbot.interfaces.Plugin as ABC instead.N)r r!r"r#rrrrr(Isr(cseZdZUdZeZeeZeee e j eddfdd Z eddddZ eedd d Zeeeedd d d ZZS)Plugina-Certbot plugin. Objects providing this interface will be called without satisfying any entry point "extras" (extra dependencies) you might have defined for your plugin, e.g (excerpt from ``setup.py`` script):: setup( ... entry_points={ 'certbot.plugins': [ 'name=example_project.plugin[plugin_deps]', ], }, extras_require={ 'plugin_deps': ['dep1', 'dep2'], } ) Therefore, make sure such objects are importable and usable without extras. This is necessary, because CLI does the following operations (in order): - loads an entry point, - calls `inject_parser_options`, - requires an entry point, - creates plugin instance (`__call__`). N)confignamercstjdS)zCreate a new `Plugin`. :param configuration.NamespaceConfig config: Configuration. :param str name: Unique plugin name. N)super__init__)rr*r+) __class__rrr-qszPlugin.__init__)rcCsdS)aPrepare the plugin. Finish up any additional initialization. :raises .PluginError: when full initialization cannot be completed. :raises .MisconfigurationError: when full initialization cannot be completed. Plugin will be displayed on a list of available plugins. :raises .NoInstallationError: when the necessary programs/files cannot be located. Plugin will NOT be displayed on a list of available plugins. :raises .NotSupportedError: when the installation is recognized, but the version is not currently supported. Nr)rrrrprepare{szPlugin.preparecCsdS)zHuman-readable string to help the user. Should describe the steps taken and any relevant info to help the user decide which plugin to use. :rtype str: Nr)rrrr more_infoszPlugin.more_info)parserr+rcCsdS)aInject argument parser options (flags). 1. Be nice and prepend all options and destinations with `~.common.option_namespace` and `~common.dest_namespace`. 2. Inject options (flags) only. Positional arguments are not allowed, as this would break the CLI. :param ArgumentParser parser: (Almost) top-level CLI parser. :param str name: Unique plugin name. Nr)clsr1r+rrrinject_parser_optionsszPlugin.inject_parser_options)r r!r"r#NotImplemented descriptionr$r+rr rZNamespaceConfigr-r/r0 classmethodrr3 __classcell__rr)r.rr)Ms   r)c@seZdZdZdS)IAuthenticatorz@Deprecated, use certbot.interfaces.Authenticator as ABC instead.N)r r!r"r#rrrrr8sr8c@s`eZdZdZeeeeedddZ ee e e e dddZ ee e ddd d ZdS) AuthenticatorzGeneric Certbot Authenticator. Class represents all possible tools processes that have the ability to perform challenges and attain a certificate. )domainrcCsdS)aReturn `collections.Iterable` of challenge preferences. :param str domain: Domain for which challenge preferences are sought. :returns: `collections.Iterable` of challenge types (subclasses of :class:`acme.challenges.Challenge`) with the most preferred challenges first. If a type is not specified, it means the Authenticator cannot perform the challenge. :rtype: `collections.Iterable` Nr)rr:rrrget_chall_prefszAuthenticator.get_chall_pref)achallsrcCsdS)aPerform the given challenge. :param list achalls: Non-empty (guaranteed) list of :class:`~certbot.achallenges.AnnotatedChallenge` instances, such that it contains types found within :func:`get_chall_pref` only. :returns: list of ACME :class:`~acme.challenges.ChallengeResponse` instances corresponding to each provided :class:`~acme.challenges.Challenge`. :rtype: :class:`collections.List` of :class:`acme.challenges.ChallengeResponse`, where responses are required to be returned in the same order as corresponding input challenges :raises .PluginError: If some or all challenges cannot be performed Nr)rr<rrrperformszAuthenticator.performNcCsdS)aRevert changes and shutdown after challenges complete. This method should be able to revert all changes made by perform, even if perform exited abnormally. :param list achalls: Non-empty (guaranteed) list of :class:`~certbot.achallenges.AnnotatedChallenge` instances, a subset of those previously passed to :func:`perform`. :raises PluginError: if original configuration cannot be restored Nr)rr<rrrcleanupszAuthenticator.cleanup)r r!r"r#rr$rr rr;r rrr=r>rrrrr9s r9c@seZdZdZdS) IInstallerzsL                  $^;G