KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.41 (Ubuntu)
System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64
User : www-data ( 33)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  /lib/python3/dist-packages/certbot/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python3/dist-packages/certbot/__pycache__/cli.cpython-38.pyc
U

�]M�@s*dZddlmZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddl
Zddl
mZddlmZddlmZmZmZddlZddlmmZddlmmZddlmZddlmZdd	lmZdd
lm Z ddlmZddlm!Z!ddl"m#Z#ddl$m!Z%dd
l&m'Z(e�)e*�Z+da,dZ-de#j.k�rLe#j/�0e#j.d�Z-e#j/�1ddd�Z2e#j/�3e#j/�1e#j4dddd��Z5e2ej6dk�s�ej6d�7e5��r�e-Z8ndZ8d�9e8�Z:dZ;dZ<dZ=e>d�Z?e>d�Z@e>d�e>d�e>d�e>d �d!�ZAd"d#�ZBGd$d%�d%eC�ZDd&d'�ZEdeE_Fd(d)�ZGd*d+�ZHd,d-�ZId�d/d0�ZJd1d2�ZKd�d4d5�ZLGd6d7�d7eC�ZMGd8d9�d9ejN�ZOd:d;d<e:�Pd=d>�d?d@�fdAdBdCdDdE�fdFdGdHdIdE�fdJdKdKdLdE�fdMdNdOdPdE�fdQdRdSdTdE�fdUdVdWdXdE�fdYdZd[d\dE�fd]d^d_d`dE�fdadbdcdddE�fdedfdgdhdE�fdidjdkdldE�fdmdndodpdE�fdqdrds�9e#j/�1eKdt�du��dvdE�fdwdxdydzdE�fgZQeReQ�ZSGd{d|�d|eC�ZTd}d~�ZUd�dd��ZVd�d��ZWGd�d��d�eX�ZYd�d��ZZd�d��Z[Gd�d��d�ej\�Z]Gd�d��d�ej\�Z^d�d��Z_Gd�d��d�ej\�Z`d�d��Zad�d��ZbGd�d��d�ej\�ZcGd�d��d�ej\�Zdd�d��ZedS)�z2Certbot command line argument & config processing.�)�print_functionN)�
interfaces)�
challenges)�Any�Dict�Optional)�	constants)�crypto_util)�errors)�hooks)�util)�os)�discozletsencrypt-autoZCERTBOT_AUTOz.localZshareZletsencryptZoptzeff.org�certbot�venvz�
  {0} [SUBCOMMAND] [options] [-d DOMAIN] [-d DOMAIN] ...

Certbot can obtain and install HTTPS/TLS/SSL certificates.  By default,
it will attempt to use a webserver both for obtaining and installing the
certificate. a�The most common SUBCOMMANDS and flags are:

obtain, install, and renew certificates:
    (default) run   Obtain & install a certificate in your current webserver
    certonly        Obtain or renew a certificate, but do not install it
    renew           Renew all previously obtained certificates that are near expiry
    enhance         Add security enhancements to your existing configuration
   -d DOMAINS       Comma-separated list of domains to obtain a certificate for

  %s
  --standalone      Run a standalone webserver for authentication
  %s
  --webroot         Place files in a server's webroot folder for authentication
  --manual          Obtain certificates interactively, or using shell script hooks

   -n               Run non-interactively
  --test-cert       Obtain a test certificate from a staging server
  --dry-run         Test "renew" or "certonly" without saving any certificates to disk

manage certificates:
    certificates    Display information about certificates you have from Certbot
    revoke          Revoke a certificate (supply --cert-path or --cert-name)
    delete          Delete a certificate

manage your account:
    register        Create an ACME account
    unregister      Deactivate an ACME account
    update_account  Update an ACME account
  --agree-tos       Agree to the ACME server's Subscriber Agreement
   -m EMAIL         Email address for important account notifications
a�
More detailed help:

  -h, --help [TOPIC]    print this message, or detailed help on a topic;
                        the available TOPICS are:

   all, automation, commands, paths, security, testing, or any of the
   subcommands or plugins (certonly, renew, install, register, nginx,
   apache, standalone, webroot, etc.)
  -h all                print a detailed help page including all topics 
  --version             print the version number
)�const�nargs�type)�help�version)Zstore_const�
store_true�store_false�append_const�count)�server)�deploy_hook)�dry_run�staging)Zwebroot_path)�account�
renew_hookrZwebroot_mapcCsFt|tj�r|f}t|tj�r$|f}|D]}t�|t���|�q(dS)a�Registers config option interaction to be checked by set_by_cli.

    This function can be called by during the __init__ or
    add_parser_arguments methods of plugins to register interactions
    between config options.

    :param modified: config options that can be modified by modifiers
    :type modified: iterable or str (string_types)
    :param modifiers: config options that modify modified
    :type modifiers: iterable or str (string_types)

    N)�
isinstance�six�string_types�
VAR_MODIFIERS�
setdefault�set�update)ZmodifiedZ	modifiers�var�r(�-/usr/lib/python3/dist-packages/certbot/cli.py�report_config_interaction�s
r*c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_DefaultzAA class to use as a default to detect if a value is set by a usercCsdS)NFr(��selfr(r(r)�__bool__�sz_Default.__bool__cCs
t|t�S�N)r r+)r-�otherr(r(r)�__eq__�sz_Default.__eq__cCstt�Sr/)�idr+r,r(r(r)�__hash__�sz_Default.__hash__cCs|��Sr/)r.r,r(r(r)�__nonzero__�sz_Default.__nonzero__N)�__name__�
__module__�__qualname__�__doc__r.r1r3r4r(r(r(r)r+�s
r+c	Cs�tj}|dkrTtdk	rTtj��}tjtjg}t||dd�}t_t	�
|�\|_|_t
t||�t�s|t�d|t||��dSt�|g�D](}t|�r�t�d|t�|g��dSq�dS)z�
    Return True if a particular config variable has been set by the user
    (CLI or config file) including if the user explicitly set it to the
    default.  Returns False if the variable was assigned a default value.
    NT)�detect_defaultszVar %s=%s (set by user).F)�
set_by_cli�detector�helpful_parser�
plugins_discoZPluginsRegistryZfind_all�args�verb�prepare_and_parse_args�plugin_selectionZcli_plugin_requests�
authenticator�	installerr �getattrr+�logger�debugr#�get)r'r;�pluginsZreconstructed_argsZmodifierr(r(r)r:�s,
��

�r:cCs$tdk	r |tjkotj||kSdS)aHDoes option have the default value?

    If the default value of option is not known, False is returned.

    :param str option: configuration variable being considered
    :param value: value of the configuration variable named option

    :returns: True if option has the default value, otherwise, False
    :rtype: bool

    NF)r<�defaults�Zoption�valuer(r(r)�has_default_value�s

�rLcCst|�pt||�S)aWas option set by the user or does it differ from the default?

    :param str option: configuration variable being considered
    :param value: value of the configuration variable named option

    :returns: True if the option was set, otherwise, False
    :rtype: bool

    )r:rLrJr(r(r)�option_was_set�s
rMcCs8tdk	r4tjjD]"}|jdk	r|j|kr|jSqtS)zFReturn our argparse type function for a config variable (default: str)N)r<�parserZ_actionsr�dest�str)Zvariable�actionr(r(r)�
argparse_type�s
rR�rbc
Cshz4tj�|�}t||��}|��}W5QRX||fWStk
rb}zt�|j��W5d}~XYnXdS)aReturns the given file's contents.

    :param str filename: path to file
    :param str mode: open mode (see `open`)

    :returns: absolute path of filename and its contents
    :rtype: tuple

    :raises argparse.ArgumentTypeError: File does not exist or is not readable.

    N)	r
�path�abspath�open�read�IOError�argparse�ArgumentTypeError�strerror)�filename�modeZthe_file�contents�excr(r(r)�	read_files
r`cCst�tj|�S)zDefault value for CLI flag.)�copy�deepcopyrZCLI_DEFAULTS)�namer(r(r)�flag_defaultsrdFcCs|r
tjStj�|�}|jS)z5Extract the help message for an `.IConfig` attribute.)rY�SUPPRESSrZIConfig�__getitem__r8)rcZhiddenZfieldr(r(r)�config_help!srgc@s eZdZdZdd�Zdd�ZdS)�HelpfulArgumentGroupa+Emulates an argparse group for use with HelpfulArgumentParser.

    This class is used in the add_group method of HelpfulArgumentParser.
    Command line arguments can be added to the group, but help
    suppression and default detection is applied by
    HelpfulArgumentParser when necessary.

    cCs||_||_dSr/)�_parser�_topic)r-Zhelpful_arg_parser�topicr(r(r)�__init__3szHelpfulArgumentGroup.__init__cOs|jj|jf|�|�dS)z6Add a new command line argument to the argument group.N)ri�addrj)r-r>�kwargsr(r(r)�add_argument7sz!HelpfulArgumentGroup.add_argumentN)r5r6r7r8rlror(r(r(r)rh*srhc@seZdZdZdd�ZdS)�CustomHelpFormatterz�This is a clone of ArgumentDefaultsHelpFormatter, with bugfixes.

    In particular we fix https://bugs.python.org/issue28742
    cCsN|j}d|jkrJd|jkrJ|jtjkrJtjtjg}|jsB|j|krJ|d7}|S)Nz
%(default)z	(default:z (default: %(default)s))r�defaultrYreZOPTIONALZZERO_OR_MOREZoption_stringsr)r-rQZhelpstrZdefaulting_nargsr(r(r)�_get_help_stringAsz$CustomHelpFormatter._get_help_stringN)r5r6r7r8rrr(r(r(r)rp;srpz
run (default)z*Obtain/renew a certificate, and install itz/Options for obtaining & installing certificatesz[SUBCOMMAND]��run)�short�opts�usage�realname�certonlyz4Obtain or renew a certificate, but do not install itz3Options for modifying how a certificate is obtainedz�

  certbot certonly [options] [-d DOMAIN] [-d DOMAIN] ...

This command obtains a TLS/SSL certificate without installing it anywhere.)rurvrw�renewz:Renew all certificates (or one specified with --cert-name)a]The 'renew' subcommand will attempt to renew all certificates (or more precisely, certificate lineages) you have previously obtained if they are close to expiry, and print a summary of the results. By default, 'renew' will reuse the options used to create obtain or most recently successfully renew each certificate lineage. You can try it with `--dry-run` first. For more fine-grained control, you can renew individual lineages with the `certonly` subcommand. Hooks are available to run commands before and after renewal; see https://certbot.eff.org/docs/using.html#renewal for more information on these.z4

  certbot renew [--cert-name CERTNAME] [options]

�certificatesz$List certificates managed by Certbotzn

  certbot certificates [options] ...

Print information about the status of certificates managed by Certbot.�deletez+Clean up all files related to a certificatez"Options for deleting a certificatez)

  certbot delete --cert-name CERTNAME

�revokez>Revoke a certificate specified with --cert-path or --cert-namez&Options for revocation of certificatesz]

  certbot revoke [--cert-path /path/to/fullchain.pem | --cert-name example.com] [options]

�registerz;Register for account with Let's Encrypt / other ACME serverz Options for account registrationz9

  certbot register --email user@example.com [options]

�update_accountz>Update existing account with Let's Encrypt / other ACME serverz Options for account modificationzH

  certbot update_account --email updated_email@example.com [options]

�
unregisterz#Irrevocably deactivate your accountz!Options for account deactivation.z"

  certbot unregister [options]

�installz,Install an arbitrary certificate in a serverz3Options for modifying how a certificate is deployedzc

  certbot install --cert-path /path/to/fullchain.pem  --key-path /path/to/private-key [options]

�config_changesz;Show changes that Certbot has made to server configurationsz)Options for viewing configuration changesz&

  certbot config_changes [options]

�rollbackzBRoll back server conf changes made during certificate installationz5Options for rolling back server configuration changesz0

  certbot rollback --checkpoints 3 [options]

rHz<List plugins that are installed and available on your systemz$Options for the "plugins" subcommandz

  certbot plugins [options]

�update_symlinksz:Recreate symlinks in your /etc/letsencrypt/live/ directoryzqRecreates certificate and key symlinks in {0}, if you changed them by hand or edited a renewal configuration file�
config_dirZlivez'

  certbot update_symlinks [options]

�enhancez8Add security enhancements to your existing configurationzhHelps to harden the TLS configuration by adding security enhancements to already existing configuration.z

  certbot enhance [options]

c@s�eZdZdZd(dd�Zddddd	gZd
d�Zdd
�Zdd�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zd)d!d"�Zd#d$�Zd%d&�Zd'S)*�HelpfulArgumentParserz�Argparse Wrapper.

    This class wraps argparse, adding the ability to make --help less
    verbose, and request help on specific subcategories at a time, eg
    'certbot --help security' for security options.

    Fc
Cs�ddlm}|j|j|j|j|j|j|j|j|j	|j
|j|j|j|j
|j|j|jd�|_ztj�tj�j|_Wn&tjk
r�t�tj�j|_YnXdddddg}|t|j�|j d	g7}t|�}||dg|_!||_"||_#|j#�r|j#dd
k�rd|j#d<|�$�|�%d|j!�}|�%d|j!�}t&|t'��rNt&|t'��rN|�pH||_(nt&|t)j*��r`|n||_(|�+||j(�}	|�,|j(�|_-i|_.i|_/t0j1d
|	t2ddgt3d�d�4d�5t3d���d�|_6d|j6_7dS)Nr)�main)�authryr�rtr�rHr~rr�rzr}r��
everythingr�r{r|r��all�security�paths�
automation�testing�manager�--help�-hrz-cz--configZconfig_filesz"path to config file (default: {0})z and )�progrwZformatter_classZargs_for_setting_config_pathZdefault_config_filesZconfig_arg_help_messageF)8rr�ryr�rtr�Zplugins_cmdr~rr�rzr}r�r�r{r|r��VERBS�zopeZ	componentZ
getUtilityrZIDisplayZnotification�notify�zope_interfacesZComponentLookupError�display_utilZNoninteractiveDisplay�sys�stdout�list�COMMANDS_TOPICS�help_topicsr9r>�determine_verb�prescan_for_flagr �bool�help_argr!r"�
_usage_string�determine_help_topics�visible_topics�groupsrI�configargparseZ	ArgParserrprd�format�joinrNZ_add_config_file_help)
r-r>rHr9r�ZHELP_TOPICSZplugin_namesZhelp1Zhelp2Zshort_usager(r(r)rl�sp���
��
zHelpfulArgumentParser.__init__ZcommandZcommandsZ
subcommandZsubcommands�verbscCsTtdd�tD��}d}tt�D](\}}|�dd�}|dj|||d�7}q|d7}|S)	Ncss|]}t|�VqdSr/)�len)�.0�vr(r(r)�	<genexpr>	sz:HelpfulArgumentParser._list_subcommands.<locals>.<genexpr>z,The full list of available SUBCOMMANDS is:

rursz{0:<{length}}     {1}
)ZlengthzG
You can get more help on a specific subcommand with --help SUBCOMMAND
)�max�
VERB_HELP_MAP�sorted�	VERB_HELPrGr�)r-Zlongest�textr?Zprops�docr(r(r)�_list_subcommandssz'HelpfulArgumentParser._list_subcommandscCs�d|krd}nd}d|kr d}nd}t}|dkrV|�|t||ft�t�d�nb||jkr~|�||���t�d�n:|d	kr�|t||f7}n t�	|i��	d
d�}|r�|n|}|S)a#Make usage strings late so that plugins can be initialised late

        :param plugins: all discovered plugins
        :param help_arg: False for none; True for --help; "TOPIC" for --help TOPIC
        :rtype: str
        :returns: a short usage string for the top of --help TOPIC)
        �nginxzH--nginx           Use the Nginx plugin for authentication & installationz+(the certbot nginx plugin is not installed)�apachezI--apache          Use the Apache plugin for authentication & installationz,(the certbot apache plugin is not installed)Trr�rwN)
�SHORT_USAGEr��COMMAND_OVERVIEW�HELP_AND_VERSION_USAGEr��exitr�r�r�rG)r-rHr�Z	nginx_docZ
apache_docrwZcustomr(r(r)r�s$
z#HelpfulArgumentParser._usage_stringcCsH|jdkrD|jj��D],\}}|�d�rd|kr|jr<t�ng|_qdS)z8Make "certbot renew" safe if domains are set in cli.ini.rzZconfig_file�domainsN)r?rNZ_source_to_settings�items�
startswithr9r+r�)r-�parsed_args�source�flagsr(r(r)�&remove_config_file_domains_for_renewal5s
z<HelpfulArgumentParser.remove_config_file_domains_for_renewalcs"�j��j�}�j�j|_�j|_��|��jr8|St�fdd�t	|�D���_
�jdkr||jrvt�
d�tj���d|_|jr�|jr�t�
d�tj���|js�|jr���|�|jr���|�|jr�d|_|jr�t�|�|j�rtdd�|jD���rt�
d��|j�r|j�rt�
d	��|S)
z�Parses command line arguments and returns the result.

        :returns: parsed command line arguments
        :rtype: argparse.Namespace

        c3s$|]}|t��j�|��fVqdSr/)rarbrNZget_default)r��keyr,r(r)r�Ms�z3HelpfulArgumentParser.parse_args.<locals>.<genexpr>rzz{0} cannot be used with renewTz.Flag for non-interactive mode and {0} conflictcss|]}t�|�VqdSr/)rZis_wildcard_domain�r��dr(r(r)r�kszFUsing --allow-subset-of-names with a wildcard domain is not supported.z@Parameters --hsts and --auto-hsts cannot be used simultaneously.) rN�
parse_argsr>r�r?�funcr�r9�dict�varsrI�force_interactiver
�Errorr�r�FORCE_INTERACTIVE_FLAG�noninteractive_moderr�set_test_server�csr�
handle_csr�must_staple�staple�validate_hooksr�allow_subset_of_names�anyr��hstsZ	auto_hsts)r-r�r(r,r)r�=sN
�

����



�z HelpfulArgumentParser.parse_argscCs�td�tjf}|jr(|j|kr(t�d��|j|kr:tj|_|jr�|jdkrZt�d|j��d|_	|_t
�
tj�
|jtjd��r�d|_d|_dS)zGWe have --staging/--dry-run; perform sanity check and set config.serverrz'--server value conflicts with --staging)ryrzzN--dry-run currently only works with the 'certonly' or 'renew' subcommands (%r)T�*N)rdr�STAGING_URIrrr
r�rr?�break_my_certs�globr
rTr�r�ZACCOUNTS_DIR�tos�register_unsafely_without_email)r-r�Zdefault_serversr(r(r)r�us



�z%HelpfulArgumentParser.set_test_serverc
Cs�|jdkrt�d��|jr$t�d��|jdd�\}}t�||�\}}}|D]}t||�qL|stt�d|jd��||f|_t	dd�|D��}t	|j
�}	||	kr�t�d	�d
�
|�d
�
|	����dS)zProcess a --csr flag.ryz�Currently, a CSR file may only be specified when obtaining a new or replacement via the certonly command. Please try the certonly command instead.z1--allow-subset-of-names cannot be used with --csrr�zJUnfortunately, your CSR %s needs to have a SubjectAltName for every domaincSsg|]}|���qSr()�lowerr�r(r(r)�
<listcomp>�sz4HelpfulArgumentParser.handle_csr.<locals>.<listcomp>zMInconsistent domain requests:
From the CSR: {0}
From command line/config: {1}�, N)r?r
r�r�r�r	Zimport_csr_file�add_domainsZ
actual_csrr%r�ZConfigurationErrorr�r�)
r-r�Zcsrfiler^�typr�r��domainZcsr_domainsZconfig_domainsr(r(r)r��s0


��

��z HelpfulArgumentParser.handle_csrcCszd|jksd|jkrd|_dSt|j�D]F\}}||jkr(|}|dkrJd}|dkrVd}||_|j�|�dSq(d|_dS)	z�Determines the verb/subcommand provided by the user.

        This function works around some of the limitations of argparse.

        r�r�rNr�ryr�rt)r>r?�	enumerater��pop)r-�i�tokenr?r(r(r)r��s
z$HelpfulArgumentParser.determine_verbcCsT||jkrdS|j�|�}z |j|d}||kr8|WSWntk
rNYnXdS)asChecks cli input for flags.

        Check for a flag, which accepts a fixed set of possible arguments, in
        the command line; we will use this information to configure argparse's
        help correctly.  Return the flag's argument, if it has one that matches
        the sequence @possible_arguments; otherwise return whether the flag is
        present.

        F�T)r>�index�
IndexError)r-�flagZpossible_arguments�posZnxtr(r(r)r��s


z&HelpfulArgumentParser.prescan_for_flagcOs�t|t�r$|j|kr|jn|d}n|}|jr:|jf|�}|j|rv||jkrf|j|}|j||�q�|jj||�nt	j
|d<|jj||�dS)a1Add a new command line argument.

        :param topics: str or [str] help topic(s) this should be listed under,
                       or None for options that don't fit under a specific
                       topic which will only be shown in "--help all" output.
                       The first entry determines where the flag lives in the
                       "--help all" output (None -> "optional arguments").
        :param list *args: the names of this argument flag
        :param dict **kwargs: various argparse settings for this argument

        rrN)r r�r�r9�#modify_kwargs_for_default_detectionr�r�rorNrYre)r-Ztopicsr>rnrk�groupr(r(r)rm�s




zHelpfulArgumentParser.addcKsL|�dd�}|tkrH|tkr dnd|d<t�|d<tD]}|�|d�q6|S)a_Modify an arg so we can check if it was set by the user.

        Changes the parameters given to argparse when adding an argument
        so we can properly detect if the value was set by the user.

        :param dict kwargs: various argparse settings for this argument

        :returns: a modified versions of kwargs
        :rtype: dict

        rQNrZstorerq)rG�EXIT_ACTIONS�ZERO_ARG_ACTIONSr+�ARGPARSE_PARAMS_TO_REMOVEr�)r-rnrQZparamr(r(r)r�s�
z9HelpfulArgumentParser.modify_kwargs_for_default_detectioncCst�|jj||�dS)a�Adds a deprecated argument with the name argument_name.

        Deprecated arguments are not shown in the help. If they are used
        on the command line, a warning is shown stating that the
        argument is deprecated and no other action is taken.

        :param str argument_name: Name of deprecated argument.
        :param int nargs: Number of arguments the option takes.

        N)r�add_deprecated_argumentrNro)r-Z
argument_nameZnum_argsr(r(r)r�s
�z-HelpfulArgumentParser.add_deprecated_argumentr(cKsV|j|rL|jj|f|�|j|<|jrL|D] }|j|j|t|dd�q*t||�S)a�Create a new argument group.

        This method must be called once for every topic, however, calls
        to this function are left next to the argument definitions for
        clarity.

        :param str topic: Name of the new argument group.
        :param str verbs: List of subcommands that should be documented as part of
                          this help group / topic

        :returns: The new argument group.
        :rtype: `HelpfulArgumentGroup`

        ru�r)r�rNZadd_argument_groupr�r�ror�rh)r-rkr�rnr�r(r(r)�	add_group&s
zHelpfulArgumentParser.add_groupcCs6t�|�D]&\}}|j||jd�}|j�||�q
dS)z�

        Let each of the plugins add its own command line arguments, which
        may or may not be displayed as help topics.

        ��descriptionN)r!Z	iteritemsr�Zlong_descriptionZ
plugin_clsZinject_parser_options)r-rHrcZ	plugin_epZparser_or_groupr(r(r)�add_plugin_args<s
�z%HelpfulArgumentParser.add_plugin_argscsd�dkrd��dkrd��dkr4tdd�|jD��S�sLtdd�|jD��St�fd	d�|jD��S)
z�

        The user may have requested help on a topic, return a dict of which
        topics to display. @chosen_topic has prescan_for_flag's return type

        :returns: dict

        r�ryr�rtr�cSs$g|]}|dkr|dfn|df�qS)zcertbot-route53:authTFr(�r��tr(r(r)r�Ys�z?HelpfulArgumentParser.determine_help_topics.<locals>.<listcomp>cSsg|]}|df�qS)Fr(r�r(r(r)r�\scsg|]}||�kf�qSr(r(r���chosen_topicr(r)r�]s)r�r�)r-r�r(r�r)r�Hs�z+HelpfulArgumentParser.determine_help_topicsN)F)r()r5r6r7r8rlr�r�r�r�r�r�r�r�r�rmr�r�r�r�r�r(r(r(r)r��s"	
J"8"!
r�cCs�|jddd�|jddd�|jddd�|jdd	d�|jd
ddd
dddgd�tD]&\}}|�d|�}|j||dd�qVdS)Nr�z-Flags for automating execution & other tweaksr�r�z%Security parameters & server settingsr�zHThe following flags are meant for testing and integration purposes only.r�z,Flags for changing execution paths & serversr�zKVarious subcommands and flags are available for managing your certificates:r{r|rzr}r�)r�r�rxrv)r�r�rG)�helpfulr?Zdocsrcr(r(r)�_add_all_groups_s��r�cCs�t|||�}t|�|jdddddtd�dd�|jddd	d
dtd
�tjd�|jddttd
�dd�|jdddddgdddddtd�dd�|jdddddgtjdtd�dd�|jdddddgddd d!d"t	td!�d#d$�	|jddddgd%d&d'd(d)�|jddddgd*d+d,d-d)�|jdddd.d/dd0dgd1d2d3td2�d4d5�|jdd6d0dgd7dd8td8�d9d:�|jddgd;dtd<�d=d�|jdd>dtd?�d?tjd@�|jddAdBdgdCdDtdE�t
dE�dF�|jddAdgdGdtdH�dHdId@�|jddAdgdJdKtdH�dHdLd@�|jdddgdMdNdOdPdtdP�dQd�|jddRdtdS�dTd�|jddUdVdW�tj
�dXdY�|jdd0gdZd[d\dtd\�d]d�|jdd^d_dtd_�d`d�|jddadbdtdb�dcd�|jdd0dgdddtde�dfd�|jddgdhdtdh�did�|jdBdgdjdktdl�dmdn�|jddodpdtdp�dqd�|jddrdtds�dtd�|jddudtdv�dwd�|jddxdtdy�dzd�|jdd{dtd|�d}d�|jdd0ddgd~dd�dtd��d�d�|jd6d�dgd�d�d�dtd��d�tjd�|jd6d�dtd��d�d�|jdddgd�dtd��d�d�|jd6d�dt
d��td��d��|jd6d�d�gd�td�td��t
d��d��|jd6d�gd�d�td��t
d��d��|jd6d�gd�ttd��t
d��d�|jd6d�dtd��d�d�|jd�d�td�td��t
d��d��|jd�d�dd�td��t
d��d:�|jd�dgd�dd�td��d�d:�|jd�d�dKd�td��d�d:�|jd�dgd�dd�td��d�d:�|jd�d�dKd�td��tjd:�|jd�dgd�dd�td��d�d:�|jd�d�dKd�td��tjd:�|jd�d�dd�td��d�d:�|jd�d�dKd�td��tjd:�|jd�d�dtd��d�d�|jd�d�dd0gd�d�ttd��d�d�|jd0d�d�d��|jd0d�d�d��|jd0d�ttjd|jd0d�dKtdăd�tjd@�|jd0d�td�d|jd0d�dKd�tdȃd�d:�|jd0d�dKtd˃d�d�d@�|jd0d�dtd΃d�d�d@�|jd0d�dKtdуd�d�d@�t�|j�t|�t|�t||�|�s�|a|��S)�z�Returns parsed command line arguments.

    :param .PluginsRegistry plugins: available plugins
    :param list args: command line arguments with the program name removed

    :returns: parsed command line arguments
    :rtype: argparse.Namespace

    Nz-vz	--verboseZ
verbose_countrzbThis flag can be used multiple times to incrementally increase the verbosity of output, e.g. -vvv.)rOrQrqrz-tz--textZ	text_moderz--max-log-backupsZmax_log_backupsz�Specifies the maximum number of backup logs that should be kept by Certbot's built in log rotation. Setting this flag to 0 disables log rotation entirely, causing Certbot to always append to the same log file.�rrqrr�rtryr�z-nz--non-interactivez--noninteractiver�z�Run without ever asking for user input. This may require additional command line flags; the client will try to explain which ones are required if it finds one missingr~r�z�Force Certbot to be interactive even if it detects it's not being run in a terminal. This flag cannot be used with the renew subcommand.�rQrqrr{z-dz	--domainsz--domainr�ZDOMAINaKDomain names to apply. For multiple domains you can use multiple -d flags or enter a comma separated list of domains as a parameter. The first domain provided will be the subject CN of the certificate, and all domains will be Subject Alternative Names on the certificate. The first domain will also be used in some software user interfaces and as the file paths for the certificate and related material unless otherwise specified or you already have a certificate with the same name. In the case of a name collision it will append a number like 0001 to the file path name. (default: Ask))rO�metavarrQrqrz	--eab-kidZeab_kidZEAB_KIDz+Key Identifier for External Account Binding)rOr�rz--eab-hmac-keyZeab_hmac_keyZEAB_HMAC_KEYz%HMAC key for External Account Bindingr�r|rzz--cert-nameZcertnameZCERTNAMEa�Certificate name to apply. This name is used by Certbot for housekeeping and in file paths; it doesn't affect the content of the certificate itself. To see certificate names, run 'certbot certificates'. When creating a new certificate, specifies the new certificate's name. (default: the first provided domain or the name of an existing certificate on your system for the same domains))rOr�rqrr�z	--dry-runra�Perform a test run of the client, obtaining test (invalid) certificates but not saving them to disk. This can currently only be used with the 'certonly' and 'renew' subcommands. 
Note: Although --dry-run tries to avoid making any persistent changes on a system, it  is not completely side-effect free: if used with webserver authenticator plugins like apache and nginx, it makes and then reverts temporary config changes in order to obtain test certificates, and reloads webservers to deploy and then roll back those changes.  It also calls --pre-hook and --post-hook commands if they are defined because they may be necessary to accurately simulate renewal. --deploy-hook commands are not called.�rQrOrqrz!--register-unsafely-without-emailr�a�Specifying this flag enables registering an account with no email address. This is strongly discouraged, because in the event of key loss or account compromise you will irrevocably lose access to your account. You will also be unable to receive notice about impending expiration or revocation of your certificates. Updates to the Subscriber Agreement will still affect you, and will be effective 14 days after posting an update to the web site.z--update-registrationZupdate_registration)rQrqrOrrr�z-mz--emailZemail�rqrz--eff-emailZ	eff_emailz"Share your e-mail address with EFFz--no-eff-emailrz(Don't share your e-mail address with EFFz--keep-until-expiringz--keepz--reinstallZ	reinstallz�If the requested certificate matches an existing certificate, always keep the existing one until it is due for renewal (for the 'run' subcommand this means reinstall the existing certificate). (default: Ask)z--expand�expandz�If an existing certificate is a strict subset of the requested names, always expand and replace it with the additional names. (default: Ask)z	--versionrz%(prog)s {0}z&show program's version number and exit)rQrrz--force-renewalz--renew-by-defaultZrenew_by_defaultz�If a certificate already exists for the requested domains, renew it now, regardless of whether it is near expiry. (Often --keep-until-expiring is more appropriate). Also implies --expand.z--renew-with-new-domainsZrenew_with_new_domainsz�If a certificate already exists for the requested certificate name but does not match the requested domains, renew it now, regardless of whether it is near expiry.z--reuse-keyZ	reuse_keyzDWhen renewing, use the same private key as the existing certificate.z--allow-subset-of-namesr�a8When performing domain validation, do not consider it a failure if authorizations can not be obtained for a strict subset of the requested domains. This may be useful for allowing renewals for multiple domains to succeed even if some domains no longer point at this system. This option cannot be used with --csr.z--agree-tosr�z5Agree to the ACME Subscriber Agreement (default: Ask)z	--accountZ
ACCOUNT_IDrzAccount ID to use)r�rqrz--duplicateZ	duplicatezdAllow making a certificate lineage that duplicates an existing one (both can be renewed in parallel)z--os-packages-onlyZos_packages_onlyzA(certbot-auto only) install OS package dependencies and then stopz--no-self-upgradeZno_self_upgradez�(certbot-auto only) prevent the certbot-auto script from upgrading itself to newer released versions (default: Upgrade automatically)z--no-bootstrapZno_bootstrapz�(certbot-auto only) prevent the certbot-auto script from installing OS-level dependencies (default: Prompt to install  OS-wide dependencies, but exit if the user says 'No')z--no-permissions-checkZno_permissions_checkz\(certbot-auto only) skip the check on the file system permissions of the certbot-auto scriptz-qz--quiet�quietz\Silence all output except errors. Useful for automation via cron. Implies --non-interactive.r}z--test-certz	--stagingrz_Use the staging server to obtain or revoke test (invalid) certificates; equivalent to --server z--debugrFz]Show tracebacks in case of errors, and allow certbot-auto execution on experimental platformsz--debug-challengesZdebug_challengeszHAfter setting up challenges, wait for user input before submitting to CAz--no-verify-sslZ
no_verify_ssl)rQrrq�
standalone�manualz--http-01-portZhttp01_port)rrOrqrz--http-01-addressZhttp01_address)rOrqrr�z--https-portZ
https_portz--break-my-certsr�z]Be willing to replace or renew valid certificates with invalid (testing/staging) certificatesr�z--rsa-key-size�NZrsa_key_size�rr�rqrz
--must-stapler�z
--redirectZredirectzbAutomatically redirect all HTTP traffic to HTTPS for the newly authenticated vhost. (default: Ask)z
--no-redirectziDo not automatically redirect all HTTP traffic to HTTPS for the newly authenticated vhost. (default: Ask)z--hstsr�z�Add the Strict-Transport-Security header to every HTTP response. Forcing browser to always use SSL for the domain. Defends against SSL Stripping.z	--no-hstsz--uirZuirz�Add the "Content-Security-Policy: upgrade-insecure-requests" header to every HTTP response. Forcing the browser to use https:// for every http:// resource.z--no-uirz
--staple-ocspr�zmEnables OCSP Stapling. A valid OCSP response is stapled to the certificate that the server offers during TLS.z--no-staple-ocspz--strict-permissionsZstrict_permissionsz}Require that all configuration files are owned by the current user; only needed if your config is somewhere unsafe like /tmp/z--preferred-challenges�pref_challsa�A sorted, comma delimited list of the preferred challenge to use during authorization with the most preferred challenge listed first (Eg, "dns" or "http,dns"). Not all plugins support all challenges. See https://certbot.eff.org/docs/using.html#plugins for details. ACME Challenges are versioned, but if you pick "http" rather than "http-01", Certbot will select the latest version automatically.z
--pre-hookazCommand to be run in a shell before obtaining any certificates. Intended primarily for renewal, where it can be used to temporarily shut down a webserver that might conflict with the standalone plugin. This will only be called if a certificate is actually to be obtained/renewed. When renewing several certificates that have identical pre-hooks, only the first will be executed.r�z--post-hookaKCommand to be run in a shell after attempting to obtain/renew certificates. Can be used to deploy renewed certificates, or to restart any servers that were stopped by --pre-hook. This is only run if an attempt was made to obtain/renew a certificate. If multiple renewed certificates have identical post-hooks, only one will be run.z--renew-hook)rQrz--no-random-sleep-on-renewZrandom_sleep_on_renewz
--deploy-hooka�Command to be run in a shell once for each successfully issued certificate. For this command, the shell variable $RENEWED_LINEAGE will point to the config live subdirectory (for example, "/etc/letsencrypt/live/example.com") containing the new certificates and keys; the shell variable $RENEWED_DOMAINS will contain a space-delimited list of renewed certificate domains (for example, "example.com www.example.com"z--disable-hook-validationr�a�Ordinarily the commands specified for --pre-hook/--post-hook/--deploy-hook will be checked for validity, to see if the programs being run are in the $PATH, so that mistakes can be caught early, even when the hooks aren't being run just yet. The validation is rather simplistic and fails if you use more advanced shell constructs, so you can use this switch to disable it. (default: False)z--no-directory-hooksZdirectory_hooksz`Disable running executables found in Certbot's hook directories during renewal. (default: False)z--disable-renew-updatesZdisable_renew_updatesaDisable automatic updates to your server configuration that would otherwise be done by the selected installer plugin, and triggered when the user executes "certbot renew", regardless of if the certificate is renewed. This setting does not apply to important TLS configuration updates.z--no-autorenewZ	autorenewz%Disable auto renewal of certificates.)r�r�rmrdrYre�nonnegative_intrr��_DomainsActionrgr�r�__version__r��int�_PrefChallAction�_RenewHookAction�_DeployHookAction�enhancementsZpopulate_cli�_create_subparsers�
_paths_parser�_plugins_parsingr<r�)rHr>r9r�r(r(r)r@os�
������
�
���

��
�
�����
��	���	�������
���������������������
������
����
r@c	CsDddlm}|jddtd�d�|��d�|jddtd�td	d
�|jddtd
�tdd
�|jdddttt	j
t	j
jd��ttd�dd�|jdddtd�dd�|jddddtd�dd�|jddt
d td!�d"d#�|jd$d%dtd&�d'd�|jd$d(dtd)�d*d�|jd$d+d,d-td-�tjd.d/�|jd$d0d,d-td-�tjd1d/�dS)2Nr)�sample_user_agentz--user-agentZ
user_agenta�Set a custom user agent string for the client. User agent strings allow the CA to collect high level statistics about success rates by OS, plugin and use case, and to know when to deprecate support for past Python versions and flags. If you wish to hide this information from the Let's Encrypt server, set this to "". (default: {0}). The flags encoded in the user agent are: --duplicate, --force-renew, --allow-subset-of-names, -n, and whether any hooks are set.rz--user-agent-commentZuser_agent_commentz�Add a comment to the default user agent string. May be used when repackaging Certbot or calling it from another tool to allow additional statistical data to be collected. Ignored if --user-agent is set. (Example: Foo-Wrapper/1.0)�rqrrryz--csrr�z|Path to a Certificate Signing Request (CSR) in DER or PEM format. Currently --csr only works with the 'certonly' subcommand.r}z--reason�reason)r�z?Specify reason for revoking certificate. (default: unspecified))rO�choicesrQrqrz--delete-after-revokerZdelete_after_revokezjDelete certificates after revoking them, along with all previous and later versions of those certificates.r�z--no-delete-after-revokerz�Do not delete certificates after revoking them. This option should be used with caution because the 'renew' subcommand will attempt to renew undeleted revoked certificates.rr�z
--checkpointsrZrollback_checkpointsz-Revert configuration N number of checkpoints.rrHz--initZinitzInitialize plugins.z	--prepareZpreparezInitialize and prepare plugins.z--authenticatorsrZifacesz$Limit to authenticator plugins only.)rQrOrqrrz--installersz Limit to installer plugins only.)Zcertbot.clientrrmrdr��_user_agent_comment_typer`�CaseInsensitiveListr�r�REVOCATION_REASONSrG�_EncodeReasonActionrrZIAuthenticatorZ
IInstaller)r�rr(r(r)r�s���
�����������rcs eZdZdZ�fdd�Z�ZS)raA list that will ignore case when searching.

    This class is passed to the `choices` argument of `argparse.add_arguments`
    through the `helpful` wrapper. It is necessary due to special handling of
    command line arguments by `set_by_cli` in which the `type_func` is not applied.cstt|��|���Sr/)�superr�__contains__r�)r-�element��	__class__r(r)r3sz CaseInsensitiveList.__contains__)r5r6r7r8r�
__classcell__r(r(rr)r-srcCsT|j}|j}|dkr|j}d}dddddg}|dkrP||dtjjtd	�|d
�n0|dkrl||dtd|d�n||dtjj|d
�d}|dkr�|}||d|dkr�tp�tjjdd
�d}|dkr�td�}|ddgd|tjjdd�|dd|tjjdd�|ddtd�td�d�|ddtd�td�d�|ddtd�dd�|ddtd �td �d�dS)!NrzQPath to where certificate is saved (with auth --csr), installed from, or revoked.r�r�r}ryr�z--cert-pathZauth_cert_pathr�F)rZrequiredr)rr)r�r}z
--key-pathzZPath to private key for certificate installation or revocation (if account key is missing)Zauth_chain_pathz--fullchain-pathzGAccompanying path to a full certificate chain (certificate plus chain).rz--chain-pathz)Accompanying path to a certificate chain.z--config-dirr�rz
--work-dirZwork_dirz
--logs-dirZlogs_dirzLogs directory.z--serverr)	rmr?r�r
rTrUrdr`rg)r�rmr?ZcphZsectionsZsectionZ
default_cpr(r(r)r7sT��������rcCs~|jddd�|jddtd�dd�|jddd	td
�dd�|jddd
td�dd�|jddddgddtd�dd�|jddddgddtd�dd�|jddgddtd�dd�|jddgddtd�d d�|jddgd!dtd"�d#d�|jddgd$dtd%�d&d�|jddgd'dtd(�d)d�|jddgd*dtd+�d,d�|jddgd-dtd.�d/d�|jddgd0dtd1�d2d�|jddgd3dtd4�d5d�|jddgd6dtd7�d8d�|jddgd9dtd:�d;d�|jddgd<dtd=�d>d�|jddgd?dtd@�dAd�|jddgdBdtdC�dDd�|jddgdEdtdF�dGd�|jddgdHdtdI�dJd�|jddgdKdtdL�dMd�|�|�dS)NNrHa$Plugin Selection: Certbot client supports an extensible plugins architecture. See '%(prog)s plugins' for a list of all installed plugins and their names. You can force a particular plugin by setting options provided below. Running --help <plugin_name> will list flags specific to that plugin.r�z--configuratorZconfiguratorz�Name of the plugin that is both an authenticator and an installer. Should not be used together with --authenticator or --installer. (default: Ask)rz-az--authenticatorrBzAuthenticator plugin name.z-iz--installerrCz2Installer plugin name (also used to find domains).ryrtr�z--apacherr�z,Obtain and install certificates using Apacher�z--nginxr�z+Obtain and install certificates using Nginxz--standalonerz3Obtain certificates using a "standalone" webserver.z--manualrzAProvide laborious manual instructions for obtaining a certificatez	--webrootZwebrootz<Obtain certificates by placing files in a webroot directory.z--dns-cloudflareZdns_cloudflarezQObtain certificates using a DNS TXT record (if you are using Cloudflare for DNS).z--dns-cloudxnsZdns_cloudxnszOObtain certificates using a DNS TXT record (if you are using CloudXNS for DNS).z--dns-digitaloceanZdns_digitaloceanzSObtain certificates using a DNS TXT record (if you are using DigitalOcean for DNS).z--dns-dnsimpleZdns_dnsimplezOObtain certificates using a DNS TXT record (if you are using DNSimple for DNS).z--dns-dnsmadeeasyZdns_dnsmadeeasyzTObtain certificates using a DNS TXT record (if you are using DNS Made Easy for DNS).z--dns-gehirnZ
dns_gehirnzdObtain certificates using a DNS TXT record (if you are using Gehirn Infrastracture Service for DNS).z--dns-googleZ
dns_googlezOObtain certificates using a DNS TXT record (if you are using Google Cloud DNS).z--dns-linodeZ
dns_linodezMObtain certificates using a DNS TXT record (if you are using Linode for DNS).z--dns-luadnsZ
dns_luadnszMObtain certificates using a DNS TXT record (if you are using LuaDNS for DNS).z--dns-nsoneZ	dns_nsonezJObtain certificates using a DNS TXT record (if you are using NS1 for DNS).z	--dns-ovhZdns_ovhzJObtain certificates using a DNS TXT record (if you are using OVH for DNS).z
--dns-rfc2136Zdns_rfc2136zKObtain certificates using a DNS TXT record (if you are using BIND for DNS).z
--dns-route53Zdns_route53zNObtain certificates using a DNS TXT record (if you are using Route53 for DNS).z--dns-sakuracloudZdns_sakuracloudzSObtain certificates using a DNS TXT record (if you are using Sakura Cloud for DNS).)r�rmrdr�)r�rHr(r(r)ras������������������������	rc@seZdZdZddd�ZdS)rz+Action class for parsing revocation reason.NcCs tj|��}t||j|�dS)z.Encodes the reason for certificate revocation.N)rrr��setattrrO)r-rN�	namespacer�
option_string�coder(r(r)�__call__�sz_EncodeReasonAction.__call__)N�r5r6r7r8r&r(r(r(r)r�src@seZdZdZddd�ZdS)r
z!Action class for parsing domains.NcCst||�dS)z%Just wrap add_domains in argparseese.N)r�)r-rNr#r�r$r(r(r)r&�sz_DomainsAction.__call__)Nr'r(r(r(r)r
�sr
cCsFg}|�d�D]2}t�|���}|�|�||jkr|j�|�q|S)a�Registers new domains to be used during the current client run.

    Domains are not added to the list of requested domains if they have
    already been registered.

    :param args_or_config: parsed command line arguments
    :type args_or_config: argparse.Namespace or
        configuration.NamespaceConfig
    :param str domain: one or more comma separated domains

    :returns: domains after they have been normalized and validated
    :rtype: `list` of `str`

    �,)�splitrZenforce_domain_sanity�strip�appendr�)Zargs_or_configr�Zvalidated_domainsr�r(r(r)r��s

r�c@seZdZdZddd�ZdS)r
z.Action class for parsing preferred challenges.Nc
CsXzt|�d��}Wn4tjk
rF}zt�|t|���W5d}~XYnX|j�|�dS)Nr()	�parse_preferred_challengesr)r
r�rY�
ArgumentErrorrPr�extend)r-rNr#rr$�challs�errorr(r(r)r&�s
"z_PrefChallAction.__call__)Nr'r(r(r(r)r
�sr
csVddd��dd�|D�}�fdd�|D�}d�dd	�|D��}|rRt�d
�|���|S)a Translate and validate preferred challenges.

    :param pref_challs: list of preferred challenge types
    :type pref_challs: `list` of `str`

    :returns: validated list of preferred challenge types
    :rtype: `list` of `str`

    :raises errors.Error: if pref_challs is invalid

    zdns-01zhttp-01)ZdnsZhttpcSsg|]}|���qSr()r*�r��cr(r(r)r�sz.parse_preferred_challenges.<locals>.<listcomp>csg|]}��||��qSr()rGr1��aliasesr(r)r�sr�css|]}|tjjkr|VqdSr/)rZ	ChallengeZTYPES)r�rcr(r(r)r�s�z-parse_preferred_challenges.<locals>.<genexpr>zUnrecognized challenges: {0})r�r
r�r�)rr/Zunrecognizedr(r3r)r,�s
�r,cCsd|ksd|krt�d��|S)N�(�)zmay not contain parentheses)rYrZ)rKr(r(r)rs
rc@seZdZdZddd�ZdS)rz&Action class for parsing deploy hooks.NcCs6|j|jk}|r&|j|kr&t�|d��||_|_dS)Nz!conflicts with --renew-hook value)rrrYr-)r-rNr#�valuesr$Zrenew_hook_setr(r(r)r&s�z_DeployHookAction.__call__)Nr'r(r(r(r)rsrc@seZdZdZddd�ZdS)rz%Action class for parsing renew hooks.NcCs.|jdk	}|r$|j|kr$t�|d��||_dS)Nz"conflicts with --deploy-hook value)rrYr-r)r-rNr#r7r$Zdeploy_hook_setr(r(r)r&s
�z_RenewHookAction.__call__)Nr'r(r(r(r)rsrcCsBzt|�}Wntk
r*t�d��YnX|dkr>t�d��|S)a[Converts value to an int and checks that it is not negative.

    This function should used as the type parameter for argparse
    arguments.

    :param str value: value provided on the command line

    :returns: integer representation of value
    :rtype: int

    :raises argparse.ArgumentTypeError: if value isn't a non-negative integer

    zvalue must be an integerrzvalue must be non-negative)r�
ValueErrorrYrZ)rKZ	int_valuer(r(r)r	's
r	)rS)F)F)fr8Z
__future__rrYrar�Zlogging.handlersZloggingr�r�r!Zzope.componentr�Zzope.interfacerr�ZacmerZacme.magic_typingrrrrZcertbot.plugins.enhancementsrHrZcertbot.plugins.selectionZ	selectionrArr	r
rrZcertbot.compatr
Zcertbot.displayr�Zcertbot.pluginsrr=Z	getLoggerr5rEr<ZLEAUTO�environrT�basenamer�Zold_path_fragmentrU�sepZnew_path_prefix�argvr�Zcli_commandr�r�r�r�r�r%r�r�r#r*�objectr+r:r;rLrMrRr`rdrgrhZ
HelpFormatterrp�replacer�r�r�r�r�r@rr�rrrZActionrr
r�r
r,rrrr	r(r(r(r)�<module>sL

�"�	"�"
	
	
	
�����������������a/
=
*_	

Anon7 - 2021