M/e= dZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd lm Z dd l m Z dd l m Z dd l m Z dd lmZddlmZddlmZej*eZ d,de j0deedej4dedee j6f dZ d-de j0deedej4dedee j:f dZ d.de j0deedej4dedee j>f dZ de j0dej4dee j:fdZ!e de j6Z"de j0deedej4dedeedee"f dZ#deejHdedeejHfdZ%gdZ&de j0dej4d ee j>d!ee j:ddf d"Z'de j0dej4d#edeee j:ee j>ffd$Z(d%eed&eedeefd'Z)de j0deeeeeffd(Z*d)ed*eedej4ddfd+Z+y)/z=Decide which plugins to use for authentication & installationN)cast)Iterable)List)Optional)Tuple)Type)TypeVar) configuration)errors) interfaces)disco)os)utilconfigdefaultpluginsquestionreturnc\t||||tjtjfS)zPick configurator plugin.) pick_pluginr Authenticator Installerrrrrs E/usr/lib/python3/dist-packages/certbot/_internal/plugins/selection.pypick_configuratorrs. (  ! !:#7#78 ::c>t||||tjfS)zPick installer plugin.)rr rrs rpick_installerr s vwJt||||tjfS)zPick authentication plugin.)rr rrs rpick_authenticatorr (s' (Z-E-E,G IIrcvt|\}sy|jfd}|j|t|dkDrt j dz|rCt |jd}tjd||j|St j dz)aB Get an unprepared interfaces.Installer object. :param certbot.configuration.NamespaceConfig config: Configuration :param certbot._internal.plugins.disco.PluginsRegistry plugins: All plugins registered as entry points. :returns: Unprepared installer plugin or None :rtype: Plugin or None Nc&|jSN check_name)p_epreq_insts rz*get_unprepared_installer..BsT__X-FrzfFound 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_requestsfilterinitlenr PluginSelectionErrorlistvaluesloggerdebug)rr_ installersinstr's @rget_unprepared_installerr62s&f-KAx  FGJOOF :)) 46> ?@ @J%%'(+ +T2yy   % %DxO QQrP)boundifacesc|jfd}n1|jrtjd|j }|j |}|j ||j|j}t|dkDrZtjd|tt|j|}|ytt |j St|dk(rOt|jd}tjd||j"ry|j Stjdy) aPick 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 Nc&|jSr#r$)r&rs rr(zpick_plugin..fstw/GraMissing 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+noninteractive_moder MissingCommandlineFlagvisibler9r,prepare availabler-r1r2 choose_pluginr/r0rr7 misconfigured) rrrrr9filteredprepared plugin_ep1 plugin_ep2s ` rrrSs)">>"GH  % %//67 7??$v&H MM& !!#H 8}q 5x@"4(9#:HE  Az()) X! (//+,Q/  2J?  # #   *+rrDcR|Dcgc]}|j|jrdndz!}} tj||d\}}|tjk(rH||}|jr5tj dj |jdn|Syxcc}w) zAllow 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` z [Misconfigured]T)force_interactivezxThe selected plugin encountered an error while parsing your server configuration and cannot be used. The error was: {0}F)pauseN)description_with_namerB display_utilmenuOK notificationformatr?)rDr plugin_epoptscodeindexs rrArAs& '  + +#,#:#:  D 'D ' "''$$O e ?C E9=M04I u}X-)7C Xj&>&>?N *"6"67F &vxBTUI .vxIM%k8WE%oxI  zm7 & = "*T!1!_m6H6HL_6_ $:Xj&:&:;]KI LL=}iX&'=)D m ##r previouslynowc|s|S|r>||k7r9d}tj|jt|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.rPrepr)rrrs rset_configuratorrsH   ]C--cjjj9I4PS9.UV V Jrc<|jx}}t||j}t||j}|jrt|d}t|d}|j rt|d}t|d}|j r t|d}|jr t|d}|jr t|d}|jr t|d}|jr t|d}|jr t|d}|jr t|d }|jr t|d }|jr t|d }|jr t|d }|j r t|d }|j"r t|d}|j$r t|d}|j&r t|d}|j(r t|d}|j*r t|d}t,j/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 rwrxrWrUrVrXrYrZr[r\r]r^r_r`rarbrcrdz+Requested authenticator %s and installer %s)rrrjrgrwrxrWrUrVdns_cloudflaredns_digitalocean dns_dnsimpledns_dnsmadeeasy dns_gehirn dns_google dns_linode dns_luadns dns_nsonedns_ovh dns_rfc2136 dns_route53dns_sakuracloudr1r2)rr'r~s rr*r*$s!---Hx&*:*:;H&*>*>?H ||#Hg6#Hg6 }}#Hh7#Hh7 #Hl; ~~#Hi8 }}#Hh7 #H.>? #H.@A #Hn= #H.?@ #Hl; #Hl; #Hl; #Hl; #Hk: ~~#Hi8 #Hm< #Hm< #H.?@ LL>(S X rcfg_type requestedc|r6||vrdj|}nNdj|||j}n.|dk(rddlm}dj|}ndj|}t j |)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}rjrrszCertbot 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 installed)rPproblemryrtr r.)rrrrrts rr}r}Zs G #LSST]^CHF9gi&8&@&@A  [ 5!&- @FFxP  % %c **r)zrs8C!+0   8 $ '6:m;;:hsm:$44: #:;C:CTCT:U:$QT=88T8C=T!11T T!!5!56T(PI}<<IxPS}I % 5 5I!$I%Z%=%=> IQ]%B%BQ&+&;&;Q@HI]I]@^Q< Cz(()5 555 5..5:=5 5+3A;5pD!7!78$,U-C-C$D>I 8-"?"?8%J_J_8 ()A)A B8 ()=)= >8CG8$O$ (E(EO$).)>)>O$&)O$.3HZ=Q=Q4R4