a }|ägFeã@slUdZddlZddlZddlZddlZddlmZddlmZddlmZddlm Z ddl Z ddl m Z ddl mZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddlm&Z&ddlm'Z'dd lm(Z(dd!lm)Z)dd"l*m+Z+dd#l,m-Z-dd$l.m/Z/dd%l0m1Z1dd&l2m3Z3dd'l4m5Z5dd(l4m6Z6dd)l7m8Z9ddl:m;m<m=Z>dd*l?m@Z@e AeB¡ZCdaDee-eEd+<e9jFeeGe d,œd-d.„ZHee d/œd0d1„ZIdS)2z2Certbot command line argument & config processing.éN)ÚAny)ÚList)ÚOptional)ÚType)ÚNamespaceConfig)Ú constants)ÚARGPARSE_PARAMS_TO_REMOVE)Ú cli_command)ÚCOMMAND_OVERVIEW)ÚDEPRECATED_OPTIONS)Ú EXIT_ACTIONS)ÚHELP_AND_VERSION_USAGE)Ú SHORT_USAGE)Ú VAR_MODIFIERS)ÚZERO_ARG_ACTIONS)Ú_DeployHookAction)Ú_DomainsAction)Ú_EncodeReasonAction)Ú_PrefChallAction)Ú_RenewHookAction)Ú_user_agent_comment_type)Ú add_domains)ÚCaseInsensitiveList)Ú config_help)ÚCustomHelpFormatter)Ú flag_default)ÚHelpfulArgumentGroup)Únonnegative_int)Úparse_preferred_challenges)Ú read_file)Úset_test_server_options)Ú_add_all_groups)ÚHelpfulArgumentParser)Ú _paths_parser)Ú_plugins_parsing)Ú_create_subparsers)Ú VERB_HELP)Ú VERB_HELP_MAP)Údisco)Ú enhancementsÚhelpful_parser)ÚpluginsÚargsÚreturnc Csrt||ƒ}t|ƒ|jdddddtdƒdd|jddd td ƒtjd |jdd d d dtd ƒtjd|jddttdƒdd|jddddtdƒtjd|jgd¢dddddtdƒdd|jgd¢tjdtdƒdd|jgd¢d d!d"d#d$t td#ƒd%d& |jgd'¢d(d)d*d+d,|jgd'¢d-d.d/d0d,|jgd1¢d2d3d4td3ƒd5d6|jgd7¢d8dd9td9ƒd:d;|jgd<¢d=dd>td>ƒd?d;|jd@dAgdBdtdCƒdDd|jgdE¢dFdGtdHƒt dHƒdI|jgdJ¢dKdtdLƒdLdMdN|jgdJ¢dOdPtdLƒdLdQdN|jgdR¢dSdTdUdVdtdVƒdWd|jdAdXdtdYƒdZd|jdAd[d\d]  t j ¡d^d_|jdAd`gdadbdcdtdcƒddd|jdAdedfdtdfƒdgd|jdAdhdidtdiƒdjd|jdAdkdidPtdiƒdld|jdAdmdndtdnƒdod|jgdp¢dqdtdrƒdsd|jdAdtdudtduƒdvd|jdwdAgdxdytdzƒd{d||jdAd}d~dtd~ƒdd|jgd€¢dd‚dƒdtdƒƒd„d|jgd…¢d†d‡dˆdtdˆƒd‰tjd|jdŠd‹dtdŒƒdd|jgdŽ¢ddtdƒd‘d|jdŠd’dt d“ƒtd“ƒd”|jgd•¢d–td—td—ƒt d—ƒd˜|jdŠd™gdšd›td›ƒt d›ƒd |jdŠdœgdttdžƒt džƒd|jdŠdŸdtd ƒd¡d|jd¢d£td¤td¥ƒt d¥ƒd¦|jd¢d§d¨d©gttdªƒt dªƒd«|jd¢d¬tgd­¢d¤td®ƒt d®ƒd¯|jd¢d°dd±td±ƒt d±ƒd;|jd¢d²gd³dd´td´ƒdµd;|jd¢d¶dPd´td´ƒd·d;|jd¢d²gd¸dd¹td¹ƒdºd;|jd¢d»dPd¹td¹ƒtjd;|jd¢d²gd¼dd½td½ƒd¾d;|jd¢d¿dPd½td½ƒtjd;|jd¢dÀddÁtdÁƒdÂd;|jd¢dÃdPdÁtdÁƒtjd;|jd¢dÄdtdŃdÆd|jgdÇ¢dÈdÉtdɃt dɃd |jgdÊ¢dËdÌttd̃dÍd|jgdŽ¢dÎtdÏtdσt dσd˜|jd`dÐgdÑdÒdÓ|jd`dÐgdÔdÕdÓ|jd`dÐgdÖttjd×|jd`dØdPtdÙƒdÙtjdN|jd`dÐgdÚtdÛd×|jd`dÜdPdÝtd݃dÞd;|jd`dßdPtdàƒdàdádN|jd`dâdtdãƒdãdädN|jd`dådPtdæƒdædçdN| dèdé¡| dêdé¡| dëdé¡| dìdé¡t |j¡t|ƒt|ƒt||ƒ|a| ¡S)íaReturns 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: configuration.NamespaceConfig Nz-vz --verboseZ verbose_countÚcountzbThis flag can be used multiple times to incrementally increase the verbosity of output, e.g. -vvv.)ÚdestÚactionÚdefaultÚhelpz--verbose-levelZ verbose_level)r/r1r2z-tz--textZ text_modeÚ store_truez--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.)Útyper1r2z--preconfigured-renewalZpreconfigured_renewal)NÚ automationÚrunÚcertonlyÚenhancez-nz--non-interactivez--noninteractiveZnoninteractive_modez¦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 missing)NÚregisterr6r7r8Zforce_interactivezˆ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.)r0r1r2)Nr6r7Ú certificatesr8z-dz --domainsz--domainZdomainsZDOMAINaÌDomain names to include. For multiple domains you can use multiple -d flags or enter a comma separated list of domains as a parameter. All domains will be included as Subject Alternative Names on the certificate. The first domain will be used as the certificate name, unless otherwise specified or if you already have a certificate with the same name. In the case of a name conflict, a number like -0001 will be appended to the certificate name. (default: Ask))r/Úmetavarr0r1r2)Nr6r7r9z --eab-kidZeab_kidZEAB_KIDz+Key Identifier for External Account Binding)r/r;r2z--eab-hmac-keyZ eab_hmac_keyZ EAB_HMAC_KEYz%HMAC key for External Account Binding) Nr6r7ZmanageÚdeleter:Úrenewr8Ú reconfigurez --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. Certificate name cannot contain filepath separators (i.e. '/' or '\', depending on the platform). 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))r/r;r1r2)NÚtestingr=r7z --dry-runÚdry_runaÉPerform a test run against the Let's Encrypt staging server, obtaining test (invalid) certificates but not saving them to disk. This can only be used with the 'certonly' and 'renew' subcommands. It may trigger webserver reloads to temporarily modify & roll back configuration files. --pre-hook and --post-hook commands run by default. --deploy-hook commands do not run, unless enabled by --run-deploy-hooks. The test server may be overridden with --server.)r0r/r1r2)r?r=r7r>z--run-deploy-hooksZrun_deploy_hooksaWhen performing a test run using `--dry-run` or `reconfigure`, run any applicable deploy hooks. This includes hooks set on the command line, saved in the certificate's renewal configuration file, or present in the renewal-hooks directory. To exclude directory hooks, use --no-directory-hooks. The hook(s) will only be run if the dry run succeeds, and will use the current active certificate, not the temporary test certificate acquired during the dry run. This flag is recommended when modifying the deploy hook using `reconfigure`.r9r5z!--register-unsafely-without-emailZregister_unsafely_without_emaila"Specifying this flag enables registering an account with no email address. This is strongly discouraged, because you will 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.)r9Úupdate_accountÚ unregisterr5z-mz--emailZemail)r1r2)r9rAr5z --eff-emailZ eff_emailz"Share your e-mail address with EFF)r0r1r/r2z--no-eff-emailÚ store_falsez(Don't share your e-mail address with EFF)r5r7r6z--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 --versionÚversionz %(prog)s {0}z&show program's version number and exit)r0rEr2r=z--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--no-reuse-keyzÑWhen renewing, do not use the same private key as the existing certificate. Not reusing private keys is the default behavior of Certbot. This option may be used to unset --reuse-key on an existing certificate.z --new-keyZnew_keyzóWhen renewing or replacing a certificate, generate a new private key, even if --reuse-key is set on the existing certificate. Combining --new-key and --reuse-key will result in the private key being replaced and then reused in future renewals.)r5r=r7z--allow-subset-of-namesZallow_subset_of_namesa8When 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-tosZtosz5Agree to the ACME Subscriber Agreement (default: Ask)rBz --accountZ ACCOUNT_IDZaccountzAccount ID to use)r;r1r2z --duplicateZ duplicatezdAllow making a certificate lineage that duplicates an existing one (both can be renewed in parallel))r5r=r7r6z-qz--quietÚquietz\Silence all output except errors. Useful for automation via cron. Implies --non-interactive.)r?Zrevoker6z --test-certz --stagingZstagingzmUse the Let's Encrypt staging server to obtain or revoke test (invalid) certificates; equivalent to --server r?z--debugÚdebugz!Show tracebacks in case of errors)Nr7r6z--debug-challengesZdebug_challengeszÀAfter setting up challenges, wait for user input before submitting to CA. When used in combination with the `-v` option, the challenge URLs or FQDNs and their expected return values are shown.z--no-verify-sslZ no_verify_ssl)r0r2r1)r?Ú standaloneÚmanualz--http-01-portZ http01_port)r4r/r1r2rHz--http-01-addressZhttp01_addressZnginxz --https-portZ https_portz--break-my-certsZbreak_my_certsz]Be willing to replace or renew valid certificates with invalid (testing/staging) certificatesZsecurityz--rsa-key-sizeÚNZ rsa_key_size)r4r;r1r2z --key-typeZrsaZecdsaZkey_type)Úchoicesr4r1r2z--elliptic-curve)Z secp256r1Z secp384r1Z secp521r1Zelliptic_curve)r4rKr;r1r2z --must-stapleZ must_stapler8z --redirectZredirectz™Automatically redirect all HTTP traffic to HTTPS for the newly authenticated vhost. (default: redirect enabled for install and run, disabled for enhance)z --no-redirectz Do not automatically redirect all HTTP traffic to HTTPS for the newly authenticated vhost. (default: redirect enabled for install and run, disabled for enhance)z--hstsZhstsz‘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-ocspZstaplezmEnables 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/)Nr7r=r6z--preferred-chainZpreferred_chain)rIrHr7r=z--preferred-challengesZ 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--issuance-timeoutZissuance_timeoutr>z --pre-hookuCommand to be run in a shell before obtaining any certificates. Unless --disable-hook-validation is used, the command’s first word must be the absolute pathname of an executable or one found via the PATH environment variable. 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.)r2z --post-hookuïCommand to be run in a shell after attempting to obtain/renew certificates. Unless --disable-hook-validation is used, the command’s first word must be the absolute pathname of an executable or one found via the PATH environment variable. 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)r0r2z--no-random-sleep-on-renewZrandom_sleep_on_renewz --deploy-hookuACommand to be run in a shell once for each successfully issued certificate. Unless --disable-hook-validation is used, the command’s first word must be the absolute pathname of an executable or one found via the PATH environment variable. 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-validationZvalidate_hooksa„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 autorenewz6Disable auto renewal of certificates. (default: False)z--os-packages-onlyrz--no-self-upgradez--no-bootstrapz--no-permissions-check)r"r!ÚaddrÚargparseÚSUPPRESSrrZFORCE_INTERACTIVE_FLAGrrÚformatÚcertbotÚ __version__Z STAGING_URIÚintÚstrrrrZadd_deprecated_argumentr)Z populate_clir%r#r$r*Ú parse_args)r+r,Zhelpful©rUúB/usr/lib/python3.9/site-packages/certbot/_internal/cli/__init__.pyÚprepare_and_parse_args:s’  þ þ  þýýûüû üüü ü ü  ý ýþ  þ ü þ ýü ýýý ýü ý ýýü ÿþ þ ýý  ý ý ýý þ  þ  úýüý ý þ ýþý þý ýü  üþ þ ÿý þü ýýý      rW)Úvariabler-cCs6tdur2tjD]"}|jdur|j|kr|jSqtS)zFReturn our argparse type function for a config variable (default: str)N)r*Úactionsr4r/rS)rXr0rUrUrVÚ argparse_typeàs   rZ)JÚ__doc__rMZloggingZlogging.handlersÚsysÚtypingrrrrrPZcertbot.configurationrZcertbot._internalrZ#certbot._internal.cli.cli_constantsrr r r r r rrrZcertbot._internal.cli.cli_utilsrrrrrrrrrrrrrrrr Z!certbot._internal.cli.group_adderr!Zcertbot._internal.cli.helpfulr"Z"certbot._internal.cli.paths_parserr#Z%certbot._internal.cli.plugins_parsingr$Z certbot._internal.cli.subparsersr%Zcertbot._internal.cli.verb_helpr&r'Zcertbot._internal.pluginsr(Z plugins_discoZ#certbot._internal.plugins.selectionZ _internalr+Z selectionZplugin_selectionZcertbot.pluginsr)Z getLoggerÚ__name__Úloggerr*Ú__annotations__ZPluginsRegistryrSrWrZrUrUrUrVÚsn                                          ÿ )