a ‚oeœ=ã@sLdZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd lm Z dd l m Z dd l m Z dd l m Z dd lmZddlmZddlmZe e¡Zd5e jeeejeee jdœdd„Zd6e jeeejeee jdœdd„Zd7e jeeejeee jdœdd„Z e jejee jdœdd„Z!e de jd�Z"e jeeejeeeee"dœd d!„Z#eej$eeej$d"œd#d$„Z%gd%¢Z&e jejee jee jdd&œd'd(„Z'e jejeeee jee jfd)œd*d+„Z(eeeeeed,œd-d.„Z)e jeeeeefd/œd0d1„Z*eeeejdd2œd3d4„Z+dS)8z=Decide which plugins to use for authentication & installationéN)Úcast)ÚIterable)ÚList)ÚOptional)ÚTuple)ÚType)ÚTypeVar)Ú configuration)Úerrors)Ú interfaces)Údisco)Úos)ÚutilúBóz*get_unprepared_installer..ézfFound multiple installers with the name %s, Certbot is unable to determine which one to use. Skipping.rzSelecting plugin: %sz:Could not select or initialize the requested installer %s.) Úcli_plugin_requestsÚfilterÚinitÚlenr ÚPluginSelectionErrorÚlistÚvaluesÚloggerÚdebug)rrÚ_Z installersÚinstrr#rÚget_unprepared_installer2s$   ÿÿ  ÿr3ÚP)Úbound)rrrrÚifacesrc sèˆdur| ‡fdd„¡}n|jr,t d¡‚| ¡}| |¡}| |¡| ¡| ¡}t |ƒdkrœt   d|¡t t | ¡ƒ|ƒ}|durŽdStt| ¡ƒSt |ƒdkrÖt | ¡ƒd}t   d|¡|jrÎdS| ¡St   d ¡dSdS) añPick plugin. :param certbot.configuration.NamespaceConfig config: Configuration :param str default: Plugin name supplied by user or ``None``. :param certbot._internal.plugins.disco.PluginsRegistry plugins: All plugins registered as entry points. :param str question: Question to be presented to the user in case multiple candidates are found. :param list ifaces: Interfaces that plugins must provide. :returns: Initialized plugin. :rtype: Plugin Ncs | ˆ¡Sr r!r"©rrrr%fr&zpick_plugin..aMissing command line flags. For non-interactive execution, you will need to specify a plugin on the command line. Run with '--help plugins' to see a list of options, and see https://eff.org/letsencrypt-plugins for more detail on what the plugins do and how to use them.r'zMultiple candidate plugins: %srzSingle candidate plugin: %szNo candidate plugin)r)Znoninteractive_moder ÚMissingCommandlineFlagZvisibler6r*ÚprepareZ availabler+r/r0Ú choose_pluginr-r.rr4Ú misconfigured) rrrrr6ZfilteredÚpreparedZ plugin_ep1Z plugin_ep2rr7rrSs2ÿ       r)r<rrcCsddd„|Dƒ}tj||dd�\}}|tjkrZ||}|jrTtjd | ¡¡dd�q^|SqdSqdS) zûAllow the user to choose their plugin. :param list prepared: List of `~.PluginEntryPoint`. :param str question: Question to be presented to the user. :returns: Plugin entry point chosen by the user. :rtype: `~.PluginEntryPoint` cSs g|]}|j|jrdnd‘qS)z [Misconfigured]Ú)Zdescription_with_namer;)Ú.0Ú plugin_eprrrÚ –sþ ÿz!choose_plugin..T)Zforce_interactivezxThe selected plugin encountered an error while parsing your server configuration and cannot be used. The error was: {0}F)ZpauseN)Ú display_utilZmenuZOKr;Z notificationÚformatr9)r<rZoptsÚcodeÚindexr?rrrr:‹s þ þýr:)ÚwebrootÚmanualÚ standaloneúdns-cloudflareúdns-digitaloceanú dns-dnsimpleúdns-dnsmadeeasyú dns-gehirnú dns-googleú dns-linodeú dns-luadnsú dns-nsoneúdns-ovhú dns-rfc2136ú dns-route53údns-sakuracloud)rrÚauthr2rcCsVd|_|r | |¡}|r |j|_d|_|r@| |¡}|r@|j|_t d|j|j¡dS)zFUpdate the config entries to reflect the plugins we actually selected.Nz0Plugins selected: Authenticator %s, Installer %s)Ú authenticatorZ find_initÚnameÚ installerr/Úinfo)rrrUr2Zauth_epZinst_eprrrÚrecord_chosen_plugins°s  ÿrZ)rrÚverbrcCs¨t|ƒ\}}d}|dkrd}|dkr`d}}ddlm}|tvrh|shd |tj|¡} t | ¡‚nd }}|d krvd}n|d vr”d}|j r”t   d |¡d } d } |dkrÚ||krÚt |||ƒ} t ttj| ƒ} t ttj| ƒ} n(|sâ|rðt||||ƒ} |�rt|||ƒ} |�r| �std||ƒ|�r2| �s2td||ƒ|d k�r„| d u�r„|j�pR|j} |d u�of| jdv}| �st|�r„t ttj| ƒ} t  d| | ¡t||| | ƒ| | fS)a< Figure out which configurator we're going to use, modifies config.authenticator and config.installer strings to reflect that choice if necessary. :raises errors.PluginSelectionError if there was a problem :returns: tuple of (`Installer` or None, `Authenticator` or None) :rtype: tuple r=ÚenhancezMWhich installer would you like to use to configure the selected enhancements?ÚrunTr©Ú cli_commandzéWith the {0} plugin, you probably want to use the "certonly" command, eg:{1}{1} {2} certonly --{0}{1}{1}(Alternatively, add a --installer flag. See https://eff.org/letsencrypt-plugins{1} and "--help plugins" for more information.)FZcertonly)Úinstallr\zRSpecifying an authenticator doesn't make sense when running Certbot with verb "%s"NrXrV)ÚnginxÚapachez*Selected authenticator %s and installer %s)r(Úcertbot._internal.clir_Únoninstaller_pluginsrBr Úlinesepr r8rVr/Zwarningrrrr rrrrÚdiagnose_configurator_problemrarbrWr0rZ)rrr[Úreq_authr$Zinstaller_questionZ need_instZ need_authr_ÚmsgrVrXÚ configuratorZselected_configuratorZinteractively_selectedrrrÚchoose_configurator_pluginsÂsV   ü ÿ       rj)Ú previouslyÚnowrcCs6|s|S|r2||kr2d}t | t|ƒt|ƒ¡¡‚|S)zã Setting configurators multiple ways is okay, as long as they all agree :param str previously: previously identified request for the installer/authenticator :param str now: the request currently being processed zIToo many flags setting configurators/installers/authenticators {0} -> {1})r r,rBÚrepr)rkrlrhrrrÚset_configuratorsrn)rrcCsx|j}}t||jƒ}t||jƒ}|jrt|dƒ}|j�rPt|dƒ}|j�rbt|dƒ}t d||¡||fS)z¿ Figure out which plugins the user requested with CLI and config options :returns: (requested authenticator string or None, requested installer string or None) :rtype: tuple rarbrGrErFrHrIrJrKrLrMrNrOrPrQrRrSrTz+Requested authenticator %s and installer %s)rirnrXrVrarbrGrErFZdns_cloudflareZdns_digitaloceanZ dns_dnsimpleZdns_dnsmadeeasyZ dns_gehirnZ dns_googleZ dns_linodeZ dns_luadnsZ dns_nsoneZdns_ovhZ dns_rfc2136Z dns_route53Zdns_sakuracloudr/r0)rr$rgrrrr($sV                       r()Úcfg_typeÚ requestedrrcCsd|r,||vrd |¡}qVd |||j¡}n*|dkrLddlm}d |¡}n d |¡}t |¡‚dS) a> Raise the most helpful error message about a plugin being unavailable :param str cfg_type: either "installer" or "authenticator" :param str requested: the plugin that was requested :param .PluginsRegistry plugins: available plugins :raises error.PluginSelectionError: if there was a problem z8The requested {0} plugin does not appear to be installedzkThe {0} plugin is not working; there may be problems with your existing configuration. The error was: {1!r}rXrr^zûCertbot doesn't know how to automatically configure the web server on this system. However, it can still get a certificate for you. Please run "{0} certonly" to do so. You'll need to manually configure your web server to use the resulting certificate.z/{0} could not be determined or is not installedN)rBZproblemrcr_r r,)rorprrhr_rrrrfZs   þ ü rf)r)r)r),Ú__doc__ZloggingÚtypingrrrrrrrZcertbotr r r Zcertbot._internal.pluginsr Zcertbot.compatr Zcertbot.displayrrAZ getLoggerÚ__name__r/ZNamespaceConfigÚstrZPluginsRegistryZPluginrrrrrr3r4rZPluginEntryPointr:rdrZrjrnr(rfrrrrÚs|              þ ý þ ý þ ü  ÿ   þ 8 ÿ  þ  ÿþ Rÿ 6ÿ