M/e4>dZddlZddlmZddlmZddlmZddlmZddlmZddlm Z dd lm Z dd l m Z dd l m Z dd l mZdd lmZdd lmZddlmZdd lmZej.eZd8dededefdZdeej:de ej:fdZd9deede edeefdZ d9de e j@de edeefdZ!deedeefdZ"deedeefdZ# d9deede ede eeeffd Z$d:d!edeefd"Z%deeddfd#Z&d$eeddfd%Z'd&eddfd'Z(d(ed)e)d*ed+eddf d,Z*deedefd-Z+ d9d.ed/e eeffd0eegefd1ed2e ed3ede eeff d4Z,d0eegefd5ed3ede eeffd6Z-d0eegefd5ed3ede eeffd7Z.y);z+Contains UI methods for LE user operations.N)indent)Any)Callable)Iterable)List)Optional)Tuple)errors) interfaces)util)account)osinvalidoptionalreturncd}d}d}|r |r||z }d}nd}nd} tj|r||zn|d\}}|tjk7r,|rtj dtj d t j|r|S|r||z}d}t|}#tj$rd}tj|wxYw) aJPrompt for valid email address. :param bool invalid: True if an invalid address was provided by the user :param bool optional: True if the user can use --register-unsafely-without-email to avoid providing an e-mail :returns: e-mail address :rtype: str :raises errors.Error: if the user cancels z-There seem to be problems with that address. zCEnter email address (used for urgent renewal and security notices) a If you really want to skip this, you can run the client with --register-unsafely-without-email but you will then be unable to receive notice about impending expiration or revocation of your certificates or problems with your Certbot installation that will lead to failure to renew. FTforce_interactivezoYou should register before running non-interactively, or provide --agree-tos and --email flags.zHAn e-mail address or --register-unsafely-without-email must be provided.z#An e-mail address must be provided.) display_util input_textr MissingCommandlineFlagOKErrorr safe_emailbool)rrinvalid_prefixmsgunsafe_suggestionsuggest_unsafecodeemails 5/usr/lib/python3/dist-packages/certbot/display/ops.py get_emailr#sEN PCP   $ $C"N!N  5&11'.32FWZDHJKD% Z^_KD% |  ,sAvaluesquestioncrtj|r|nd|d\}}|tjk(r|r|SgS)aDisplay screen to let user pick one or multiple values from the provided list. :param list values: Values to select from :param str question: Question to ask to user while choosing values :returns: List of selected values :rtype: list T)tagsr)r checklistr)r,r-r itemss r" choose_valuesr3\s<((X2F;?AKD% |5 I installerc|tjdtSt|j }t |}|s tSt ||\}}|tjk(r|r|SgS)aQDisplay screen to select domains to validate. :param installer: An installer object :type installer: :class:`certbot.interfaces.Installer` :param `str` question: Overriding default question to ask the user if asked to choose from domain names. :returns: List of selected names :rtype: `list` of `str` z$No installer, picking names manually) loggerdebug_choose_names_manuallylist get_all_namesget_valid_domains _filter_namesrr)r5r-domainsnamesr s r" choose_namesr@msq ;<%''9**,-G g &E %''x0KD% |5 Ir4r>cg}|D]'} |jtj|)|S#tj$rYAwxYw)zHelper method for choose_names that implements basic checks on domain names :param list domains: Domain names to validate :return: List of valid domains :rtype: list )appendr enforce_domain_sanityr ConfigurationError)r> valid_domainsdomains r"r<r<sX "M   !;!;F!C D ((   s$1AAFQDNsct|dS)zSort FQDNs by SLD (and if many, by their subdomains) :param list FQDNs: list of domain names :returns: Sorted list of domain names :rtype: list c6|jddddddS)N.)split)fqdns r"z_sort_names..s$**S/$B$*?*Cr4)key)sorted)rGs r" _sort_namesrRs %C DDr4r?override_questionct|}|r|}nd}tj||dd\}}||Dcgc] }t|c}fScc}w)aDetermine which names the user would like to select from a list. :param list names: domain names :returns: tuple of the form (`code`, `names`) where `code` - str display exit code `names` - list of names selected :rtype: tuple zWhich names would you like to activate HTTPS for? We recommend selecting either all domains, or all domains in a VirtualHost/server block. --domainsT)r0cli_flagr)rRrr1str)r?rS sorted_namesr-r ss r"r=r=s]u%L$  ((|kTSKD% %(Q#a&( (((sA  prompt_prefixctj|dzdd\}}|tjk(ri}d} tj|}t|D]\}} tj|||< |r}dj tj}|jD])\} } |d j tj| | z}+|d j tjz}|r%tj |d } | r t#SgS|SgS#t $r%g}dj tj}YwxYw#tj$r}t|||<Yd}~#d}~wwxYw) zManually input names for those without an installer. :param str prompt_prefix: string to prepend to prompt for domains :returns: list of provided names :rtype: `list` of `str` zaPlease enter the domain name(s) you would like on your certificate (comma and/or space separated)rUT)rVrr/ziInternationalized domain names are not presently supported.{0}{0}Would you like to re-enter the names?{0}Nz 5# - 0D0DJJ15!5  5*=vvJJ@  M  &&}ME-// I  I?" 0K#VBJJ/  0,, 1*-a&' 1s)D"E"*EEE?&E::E?c^tjdjt|y)zsDisplay a box confirming the installation of HTTPS. :param list domains: domain names which were enabled z;Congratulations! You have successfully enabled HTTPS on {0}N)rnotifyr__gen_https_namesr>s r"success_installationrps% E  ) *r4unused_domainsc.tjdy)zDisplay a box confirming the renewal of an existing certificate. :param list domains: domain names which were renewed zdYour existing certificate has been successfully renewed, and the new certificate has been installed.N)rrm)rqs r"success_renewalrss  .r4 cert_pathcLtjdj|y)zDisplay a message confirming a certificate has been revoked. :param list cert_path: path to certificate which was revoked. zWCongratulations! You have successfully revoked the certificate that was located at {0}.N)rrmr_)rts r"success_revocationrvs!  ##)6)#4r4 command_name returncodestdoutstderrc|j|j}}|dk7rtjd|||r$tj|dt |d|r"tjd|t |dyy)aqDisplay a message describing the success or failure of an executed process (e.g. hook). :param str command_name: Human-readable description of the executed command :param int returncode: The exit code of the executed command :param str stdout: The stdout output of the executed command :param str stderr: The stderr output of the executed command rz%s reported error code %dz ran with output:  z%s ran with error output: %sN)stripr7warningrrmr)rwrxryrzout_serr_ss r"report_executed_commandrsw<<>6<<>5EQ2L*M |n,?uc@R?STU 6 fUTWFXY r4ct|dk(rdj|dSt|dk(rdj|St|dkDr/djdjd |d d Dd |d Sy )zReturns a string of the https domains. Domains are formatted nicely with ``https://`` prepended to each. :param list domains: Each domain is a 'str' rLz https://{0}rz%https://{dom[0]} and https://{dom[1]})domz {0}{1}{2}z, c3&K|] }d|z yw)z https://%sN).0rs r" z#_gen_https_names..;sASlS(AsNrKz, and https://r/)lenr_joinros r"rnrn-s 7|q##GAJ// W 6=='=JJ W !! IIAGCRLA A  BK  r4method. validatormessagedefaultkwargsc | || ||fd|i|\}}|t jk(r ||||fS||fS#tj$r4tjd||dt dj |wxYw#tj$rC}tjd||dt jt|dYd}~nd}~wwxYw) Nz>Encountered invalid default value "%s" when prompting for "%s"T)exc_infozInvalid default "{0}"rz/Validator rejected "%s" when prompting for "%s"F)pause) r rr7r8AssertionErrorr_rr notificationrW)rrrrrr rawerrors r"_get_validatedrBs J g  7>G>v> c ttj|g|i|S)aLike `~certbot.display.util.input_text`, but with validation. :param callable validator: A method which will be called on the supplied input. If the method raises an `errors.Error`, its text will be displayed and the user will be re-prompted. :param list `*args`: Arguments to be passed to `~certbot.display.util.input_text`. :param dict `**kwargs`: Arguments to be passed to `~certbot.display.util.input_text`. :return: as `~certbot.display.util.input_text` :rtype: tuple )rrrrrrs r"validated_inputr_s! ,119 Nt Nv NNr4c>ttj|g|i|S)a"Like `~certbot.display.util.directory_select`, but with validation. :param callable validator: A method which will be called on the supplied input. If the method raises an `errors.Error`, its text will be displayed and the user will be re-prompted. :param list `*args`: Arguments to be passed to `~certbot.display.util.directory_select`. :param dict `**kwargs`: Arguments to be passed to `~certbot.display.util.directory_select`. :return: as `~certbot.display.util.directory_select` :rtype: tuple )rrdirectory_selectrs r"validated_directoryrns! ,77 TT TV TTr4)FT)N)r/)/__doc__loggingtextwraprtypingrrrrrr certbotr r r certbot._internalr certbot._internal.displayr\certbot.compatrcertbot.displayr getLogger__name__r7rrWr#Accountr+r3 Installerr@r<rRr=r9rprsrvintrrnrrrrr4r"rs1%C0   8 $3t3t3s3l T'//2 x7P  $s)x}S $,0HZ%9%9:#C=48I<x}c"Ex}EcE6:)#)%-c])>CCcN>S)43#3tCy3l $s)   DI $  # $ Z#Z3ZZUXZ]aZ$d3iC.-18CsCx$89&ucz2=@$SM