Spade
Mini Shell
| Directory:~$ /proc/self/root/lib/python2.7/site-packages/certbot/_internal/ |
| [Home] [System Details] [Kill Me] |
�
���_c@s�dZddlmZddlZddlZddlZddlZddlZddl Z
ddlZddl
mZddlmZmZmZmZmZddlZddlmZddlmZddlmZddlmZdd lmZdd
lmZddlmZddlmZdd
lmZddlm Z
ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddlm&Z&ddlm'Z'ddlm(Z(ddl)m*Z+ddl)m,Z-ddl.m/Z/ddl.m0Z0ddl.m1Z1ddl2m3Z4ddl2mZ5ddl6m7Z7dZ8ej9e:�Z;d�Z<d
�Z=dddd!�Z?d"�Z@d#�ZAd$�ZBd%�ZCd&�ZDd'�ZEd(�ZFd)�ZGd*�ZHdd+�ZIdd,�ZJd-�ZKd.�ZLd/�ZMd0�ZNd1�ZOd2�ZPdd3�ZQd4�ZRd5�ZSd6�ZTd7�ZUd8�ZVd9�ZWd:�ZXd;�ZYd<�ZZd=�Z[d>�Z\d?�Z]d@�Z^dA�Z_dB�Z`dC�ZadD�ZbdE�ZcddF�ZddS(GsCertbot
main entry
point.i����(tprint_functionN(terrors(tUniontIterabletOptionaltListtTuple(tcrypto_util(t
interfaces(tutil(taccount(tcert_manager(tcli(tclient(t
configuration(t constants(teff(thooks(tlog(trenewal(treporter(tsnap_config(tstorage(tupdater(tdisco(t selection(t
filesystem(tmisc(tos(tops(tenhancementss?User chose to cancel the
operation and may reinvoke the
client.cCsT|jdkst�|jr"dStjjtj�}d}|j||j �dS(s�Potentially
suggest a donation to support Certbot.
:param config: Configuration object
:type config: interfaces.IConfig
:returns: `None`
:rtype: None
trenewNs�If you like Certbot, please consider supporting our work
by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le
(
tverbtAssertionErrortstagingtzopet componentt
getUtilityRt IReportertadd_messagetLOW_PRIORITY(tconfigt
reporter_utiltmsg((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt
_suggest_donation_if_appropriate3s
cCsGtjjtj�}|jdks*t�|jd|jdt �dS(s�Reports
on successful dry run
:param config: Configuration object
:type config: interfaces.IConfig
:returns: `None`
:rtype: None
RsThe dry run was successful.ton_crashN(
R#R$R%RR&R
R!R't
HIGH_PRIORITYtFalse(R)R*((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_report_successful_dry_runGs
cCs2tj|�z|d k rxtjdjd|jr:dnddtj|pU|j����t j
||||�n�|d k s�t�tjdjd|jr�dnddtj|���|j||�}|t
kr�tjd��n|d k rtj||j�|j�nWd tj|�X|S(
s!Authenticate and enroll certificate.
This method finds the relevant lineage, figures out what to do with it,
then performs that action. Includes calls to hooks, various reports,
checks, and requests for user input.
:param config: Configuration object
:type config: interfaces.IConfig
:param domains: List of domain names to get a certificate. Defaults to
`None`
:type domains: `list` of `str`
:param certname: Name of new certificate. Defaults to `None`
:type certname: str
:param lineage: Certificate lineage object. Defaults to `None`
:type lineage: storage.RenewableCert
:returns: the issued certificate or `None` if doing a dry run
:rtype: storage.RenewableCert or None
:raises errors.Error: if certificate could not be obtained
s{action} for {domains}tactions-Simulating renewal of an existing
certificates Renewing an existing certificatetdomainss Simulating a
certificate requestsRequesting a certificates!Certificate could not be
obtainedN(Rtpre_hooktNonetdisplay_utiltnotifytformattdry_runtsummarize_domain_listtnamesRt
renew_certR!tobtain_and_enroll_certificateR/RtErrortdeploy_hooktlive_dirt post_hook(t le_clientR)R2tcertnametlineage((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_get_and_save_certWs*
#cCs�tjd�s
tjd�r}|jj�}|jj�}||kr}d}|j|j||�}tj|��q}ndS(s|
This function ensures that the user will not implicitly migrate an
existing key
from one type to another in the situation where a certificate for that
lineage
already exist and they have not provided explicitly --key-type and
--cert-name.
:param config: Current configuration provided by the client
:param cert: Matching certificate that could be renewed
tkey_typeRBs�Are you trying to change the key type of the
certificate named {0} from {1} to {2}? Please provide both --cert-name and
--key-type on the command line confirm the change you are trying to
make.N( Rt
set_by_cliREtuppertprivate_key_typeR7tlineagenameRR=(R)tcerttnew_key_typetcur_key_typeR+((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt%_handle_unexpected_key_type_migration�s
c
Cs�t||�dj|j��}dj|jj|dj|�dtj�}|js�|j s�t
jjt
j�j|dddddt�r�d |fStjd
j|tjddjtjd
�dtj��tjt��dS(s�Figure
out what to do if a previous cert had a subset of the names now requested
:param config: Configuration object
:type config: interfaces.IConfig
:param domains: List of domain names
:type domains: `list` of `str`
:param cert: Certificate object
:type cert: storage.RenewableCert
:returns: Tuple of (str action, cert_or_None) as per
_find_lineage_for_domains_and_certname
action can be: "newcert" | "renew" |
"reinstall"
:rtype: `tuple` of `str`
s, s You have an existing certificate that contains a portion of the
domains you requested (ref: {0}){br}{br}It contains these names:
{1}{br}{br}You requested these names for the new certificate:
{2}.{br}{br}Do you want to expand and replace this existing certificate
with the new
certificate?tbrtExpandtCanceltcli_flags--expandtforce_interactiveRs�To
obtain a new certificate that contains these names without replacing your
existing certificate for {0}, you must use the --duplicate
option.{br}{br}For example:{br}{br}{1} --duplicate {2}it
iN(RMtjoinR:R7t
configfiletfilenameRtlineseptexpandtrenew_by_defaultR#R$R%RtIDisplaytyesnotTrueR5R6tsystargvRR=tUSER_CANCELLED(R)R2RJtexistingtquestion((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_handle_subset_cert_request�s$
cCsHt||�|j�s#d|fStj||�r?d|fS|jrRd|fSdj|jjdtj �}|j
dkr�d}n|j
dkr�d}n|d g}tjj
tj�}|j||d
ddt�}|dtjkrtjd
��n|ddkrd|fS|ddkr8d|fStd��dS(s�Figure
out what to do if a lineage has the same names as a previously obtained one
:param config: Configuration object
:type config: interfaces.IConfig
:param lineage: Certificate lineage object
:type lineage: storage.RenewableCert
:returns: Tuple of (str action, cert_or_None) as per
_find_lineage_for_domains_and_certname
action can be: "newcert" | "renew" |
"reinstall"
:rtype: `tuple` of `str`
t reinstallRs�You have an existing certificate that has exactly the
same domains or certificate name you requested and isn't close to
expiry.{br}(ref: {0}){br}{br}What would you like to do?RNtruns.Attempt to
reinstall this existing certificatetcertonlys%Keep the existing
certificate for nowsBRenew & replace the certificate (may be subject to
CA rate limits)tdefaultiRRs.Operation canceled. You may re-run the
client.isThis is
impossibleN(RMtensure_deployedRtshould_renewRcR7RURVRRWR
R#R$R%RRZtmenuR\R5tCANCELRR=R!(R)RCRatkeep_opttchoicestdisplaytresponse((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_handle_identical_cert_request�s4
cCsz|jr
dStj||�\}}|dkrA|dkrAdS|dk rZt||�S|dk rvt|||�SdS(s�Determine
whether there are duplicated names and how to handle
them (renew, reinstall, newcert, or raising an error to stop
the client run if the user chooses to cancel the operation when
prompted).
:param config: Configuration object
:type config: interfaces.IConfig
:param domains: List of domain names
:type domains: `list` of `str`
:returns: Two-element tuple containing desired new-certificate behavior
as
a string token ("reinstall", "renew", or
"newcert"), plus either
a RenewableCert instance or `None` if renewal shouldn't
occur.
:rtype: `tuple` of `str` and :class:`storage.RenewableCert` or `None`
:raises errors.Error: If the user would like to rerun the client again.
tnewcertN(RpN(RpN(NN(t duplicateR4Rtfind_duplicative_certsRoRb(R)R2tident_names_certtsubset_names_cert((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_find_lineage_for_domainss
cCsDt|||�\}}|dkr4tjd�n|dk|fS(sWFinds
an existing certificate object given domains and/or a certificate name.
:param config: Configuration object
:type config: interfaces.IConfig
:param domains: List of domain names
:type domains: `list` of `str`
:param certname: Name of certificate
:type certname: str
:returns: Two-element tuple of a boolean that indicates if this
function should be
followed by a call to fetch a certificate from the server,
and either a
RenewableCert instance or None.
:rtype: `tuple` of `bool` and :class:`storage.RenewableCert` or `None`
Rcs Keeping the existing
certificate(t&_find_lineage_for_domains_and_certnametloggertinfo(R)R2RBR1RC((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt
_find_cert:scCs�|st||�Stj||�}|r�|r�ttj||��t|�kr�t||�t||||j��d|fSnt||�S|r�dSt
jdj|���dS(s�Find appropriate lineage based on given
domains and/or certname.
:param config: Configuration object
:type config: interfaces.IConfig
:param domains: List of domain names
:type domains: `list` of `str`
:param certname: Name of certificate
:type certname: str
:returns: Two-element tuple containing desired new-certificate behavior
as
a string token ("reinstall", "renew", or
"newcert"), plus either
a RenewableCert instance or None if renewal should not occur.
:rtype: `tuple` of `str` and :class:`storage.RenewableCert` or `None`
:raises errors.Error: If the user would like to rerun the client again.
RRps}No certificate with name {0} found. Use -d to specify domains, or
run certbot certificates to see possible certificate
names.N(snewcertN(
RuRtlineage_for_certnametsettdomains_for_certnameRMt_ask_user_to_confirm_new_namesR:RoR4RtConfigurationErrorR7(R)R2RBRC((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyRvRs
$
cCsVtt|�t|��}tt|�t|��}|j�|j�||fS(sWGet
lists of items removed from `before`
and a lists of items added to `after`
(tlistR{tsort(taftertbeforetaddedtremoved((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_get_added_removed}s
cCs;|sd}nddj|�}|jd|dtj�S(s%Format list with
given character
s
{br}(None)s {br}{ch}
tchRN(RTR7RRW(t charactertstringst formatted((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_format_list�s cCs�|jr
dSt||�\}}dj|td|�td|�dtj�}tjjt j
�}|j|dddt�s�t
jd ��ndS(
s�Ask user to confirm update cert certname to contain new_domains.
:param config: Configuration object
:type config: interfaces.IConfig
:param new_domains: List of new domain names
:type new_domains: `list` of `str`
:param certname: Name of certificate
:type certname: str
:param old_domains: List of old domain names
:type old_domains: `list` of `str`
:returns: None
:rtype: None
:raises errors.ConfigurationError: if cert name and domains mismatch
Ns�You are updating certificate {0} to include new domain(s):
{1}{br}{br}You are also removing previously included domain(s):
{2}{br}{br}Did you intend to make this change?t+t-RNsUpdate
certificateRPRfs2Specified mismatched certificate name and
domains.(trenew_with_new_domainsR�R7R�RRWR#R$R%RRZR[R\RR~(R)tnew_domainsRBtold_domainsR�R�R+tobj((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR}�s cCs�d}|j}|jr$|j}n|r?tj||�}n|sZtj||�}n|rz|rztjd��n||fS(s Retrieve
domains and certname from config or user input.
:param config: Configuration object
:type config: interfaces.IConfig
:param installer: Installer object
:type installer: interfaces.IInstaller
:param `str` question: Overriding default question to ask the user if
asked
to choose from domain names.
:returns: Two-part tuple of domains and certname
:rtype: `tuple` of list of `str` and `str`
:raises errors.Error: Usage message, if parameters are not used
correctly
s�Please specify --domains, or --installer that will help in domain
names autodiscovery, or --cert-name for an existing certificate
name.N( R4RBR2RR|tdisplay_opstchoose_namesRR=(R)t installerRaR2RB((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_find_domains_or_certname�s c Cs�|jrt|�dS|r#|s/td��tj|�j�}tjjt j
�}|jdkrndnd}|r�dj|dt
j�nd}dj|||tj|dt
j�}|j||j�dS( sDReports
the creation of a new certificate to the user.
:param cert_path: path to certificate
:type cert_path: str
:param fullchain_path: path to full chain
:type fullchain_path: str
:param key_path: path to private key, if available
:type key_path: str
:returns: `None`
:rtype: None
Ns No certificates saved to report.Rds with the "certonly"
optionts+Your key file has been saved at:{br}{0}{br}RNsCongratulations!
Your certificate and chain have been saved at:{br}{0}{br}{1}Your
certificate will expire on {2}. To obtain a new or tweaked version of this
certificate in the future, simply run {3} again{4}. To non-interactively
renew *all* of your certificates, run "{3}
renew"(R8R0R!RtnotAftertdateR#R$R%RR&R
R7RRWRtcli_commandR'tMEDIUM_PRIORITY( R)t cert_pathtfullchain_pathtkey_pathtexpiryR*t
verbswitchtprivkey_statementR+((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_report_new_cert�s
$csV�fd�}tj��}d }�jd k rH|j�j�}n�|j�}t|�dkrxtj|�}n�t|�dkr�|d}n��jd kr��j r�tj
��_ny/tj�|d|�\}}t
jd�WnLtjk
r
�n6tjk
r?tjddt�tjd��nX|j�_||fS(
s�Determine which account to use.
If ``config.account`` is ``None``, it will be updated based on the
user input. Same for ``config.email``.
:param config: Configuration object
:type config: interfaces.IConfig
:returns: Account and optionally ACME client API (biproduct of new
registration).
:rtype: tuple of :class:`certbot._internal.account.Account` and
:class:`acme.client.Client`
:raises errors.Error: If unable to register an account with ACME server
csh�jr
tSdj|�}tjjtj�}|j|dddt�}|sdt j
d��ndS(NspPlease read the Terms of Service at {0}. You must agree
in order to register with the ACME server. Do you
agree?RQs--agree-tosRRs?Registration cannot proceed without accepting
Terms of
Service.(ttosR\R7R#R$R%RRZR[RR=R4(tterms_of_serviceR+R�tresult(R)(s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_tos_cbs iittos_cbsAccount
registered.R�texc_infos.Unable to register an account with ACME
serverN(R
tAccountFileStorageR4tloadtfind_alltlenR�tchoose_accounttemailtregister_unsafely_without_emailt get_emailR
tregisterR5R6RtMissingCommandlineFlagR=RwtdebugR\tid(R)R�taccount_storagetacmetacctaccounts((R)s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_determine_accounts0
c
sktjjtj�}|j}|dkrZd}|j|dddddtdt�}n|sddS|j sst
�|js�tj
|�|_ntjtjtj||j��||j��y,tj|�fd �gd
�d��Wnjtjk
rtjd��dStk
rY}d
}|j|j|j�|�}tj|��nXtj|�dS(s�Does
the user want to delete their now-revoked certs? If run in non-interactive
mode,
deleting happens automatically.
:param config: parsed command line arguments
:type config: interfaces.IConfig
:returns: `None`
:rtype: None
:raises errors.Error: If anything goes wrong, including bad user input,
if an overlapping
archive dir is found for the specified lineage, etc ...
s{Would you like to delete the certificate(s) you just revoked, along
with all earlier and later versions of the certificate?t yes_labelsYes
(recommended)tno_labeltNoRRRfNcs�S(N((tx(tarchive_dir(s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt<lambda>lscSs|jS(N(R�(R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR�mscSs|S(N((R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR�msshNot
deleting revoked certificates due to overlapping archive dirs. More than
one certificate is using %ss_config.default_archive_dir: {0},
config.live_dir: {1}, archive_dir: {2},original exception:
{3}(R#R$R%RRZtdelete_after_revokeR4R[R\R�R!RBRtcert_path_to_lineageRtfull_archive_patht configobjt ConfigObjtrenewal_file_for_certnametmatch_and_check_overlapsRtOverlappingMatchFoundRwtwarningt ExceptionR7tdefault_archive_dirR?R=tdelete(R)Rmtattempt_deletionR+te((R�s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_delete_if_appropriateGs4
cCsY|dk r1t|�\}}tjd|�nd\}}tj||||d|�S(sxInitialize
Let's Encrypt Client
:param config: Configuration object
:type config: interfaces.IConfig
:param authenticator: Acme authentication handler
:type authenticator: Optional[interfaces.IAuthenticator]
:param installer: Installer object
:type installer: interfaces.IInstaller
:returns: client: Client object
:rtype: client.Client
sPicked account:
%rR�N(NN(R4R�RwR�R
tClient(R)t
authenticatorR�R�R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_init_le_client{s
cCs�tj|�}|j�}|s%dStjjtj�j}d}||dddddt �}|skdSt
|�\}}tj||ddd |�} | jj|j�tj|�}
|
j|j�tjd
�dS(s�Deactivate account on server
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None`
:rtype: None
s.Could not find existing account to deactivate.sCAre you sure you
would like to irrevocably deactivate your account?R�t
DeactivateR�tAbortRfsDeactivation aborted.R�sAccount
deactivated.N(R
R�R�R#R$R%RRZR[R\R�R
R�R4R�tdeactivate_registrationtregrR�R5R6(R)tunused_pluginsR�R�R[tprompttwants_deactivateR�R�t cb_clientt
account_files((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt
unregister�s"
cCs3tj|�}|j�}|r%dSt|�dS(s$Create
accounts on the server.
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None` or a string indicating and error
:rtype: None or str
smThere is an existing account; registration of a duplicate account
with this command is currently unsupported.N(R
R�R�R�R4(R)R�R�R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR��s
c
Csttj|�}|j�}|s%dS|jdkrV|jrVtjdt�|_nt |�\}}t
j||ddd|�}d}|jr�g|jjd�D]}d|^q�}n|j
j} |jj|j
jd|j
jjd|���|_
|j
jd| �|_
|j||j�|jsGtjd �n)tj||�tjd
j|j��dS(
s$Modify accounts on the server.
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None` or a string indicating and error
:rtype: None or str
s-Could not find an existing account to
update.toptionalR�t,smailto:tbodytcontactturisFAny contact
information associated with this account has been removed.s'Your
e-mail address was updated to {0}.N((R
R�R�R�R4R�R�R�R/R�R
R�tsplitR�R�R�tupdate_registrationtupdateR�tupdate_regrR5R6Rtprepare_subscriptionR7(
R)R�R�R�R�R�R�tacc_contactsR�t
prev_regr_uri((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pytupdate_account�s* ,! cCsc|r|n|}|jdk s't�|j||j|j|j|j�|j||j�dS(s�Install
a cert
:param config: Configuration object
:type config: interfaces.IConfig
:param le_client: Client object
:type le_client: client.Client
:param domains: List of domains
:type domains: `list` of `str`
:param lineage: Certificate lineage object. Defaults to `None`
:type lineage: storage.RenewableCert
:returns: `None`
:rtype: None
N(R�R4R!tdeploy_certificateR�t
chain_pathR�tenhance_config(R)RAR2RCt
path_provider((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt
_install_certs
c
Cs�ytj||d�\}}Wntjk
r>}t|�SX|joN|j}|jr�|r�d}tj |ddt
d|�d|_ntj||�s�tj
d��n|jr�t|�}n!tj|�r�tjd��n|jrI|jrIt|�t||�\}}t|ddd |�}t|||�ntjd
��tj|�r�tj||j�} tj| |||�ndS(s�Install a
previously obtained cert in a server.
:param config: Configuration object
:type config: interfaces.IConfig
:param plugins: List of plugins
:type plugins: `list` of `str`
:returns: `None`
:rtype: None
tinstalls,Which certificate would you like to
install?tallow_multiplet
custom_promptisVOne ore more of the requested
enhancements are not supported by the selected installersLOne or more of
the requested enhancements require --cert-name to be
providedR�R�s�Path to certificate or key was not defined. If your
certificate is managed by Certbot, please use --cert-name to define which
certificate you would like to
install.N(tplug_seltchoose_configurator_pluginsRtPluginSelectionErrortstrR�R�RBRt
get_certnamesR/Rt
are_supportedtNotSupportedErrort_populate_from_certnamet
are_requestedR~t_check_certificate_and_keyR�R�R4R�Rztenable(
R)tpluginsR�t_R�tcustom_certtcertname_questionR2RARC((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR�)s4
cCs�tj||j�}|s|S|js:|j|j_n|jsU|j|j_n|jsp|j|j_n|js�|j|j_n|S(sfHelper
function for install to populate missing config values from lineage
defined by
--cert-name.(RRzRBR�t namespaceR�R�R�(R)RC((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR�ds cCs|tjjtj|j��s<tjdj|j���ntjjtj|j ��sxtjdj|j ���ndS(Ns-Error
while reading certificate from path {0}s-Error while reading private key
from path {0}(
RtpathtisfileRtrealpathR�RR~R7R�(R)((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR�uscCs(tjd|j�|jdkr(gn|j}|j�j|�}tjd|�tjtjj t
j�jdt
�}|jr�|jr�|t|��dS|j|�|j|�}tjd|�|js�|t|��dS|j�|j�}tjd|�|t|��dS(s�List
server software plugins.
:param config: Configuration object
:type config: interfaces.IConfig
:param plugins: List of plugins
:type plugins: `list` of `str`
:returns: `None`
:rtype: None
sExpected interfaces: %ssFiltered plugins: %rtpauseNsVerified
plugins: %rsPrepared plugins:
%s(RwR�tifacesR4tvisiblet functoolstpartialR#R$R%RRZtnotificationR/tinittprepareR�tverifyt available(R)R�RtfilteredR6tverifiedR((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pytplugins_cmd|s&
cs�ddddg}t�fd�|D��}tj��rt|rtd}tj|tjd�tjd��nyt j
�|d �\}}Wntjk
r�}t|�SXtj
�|�s�tjd
��nd}tj�d dtd
|�d�_tj��j�} �jr)| }
n0d}tj| |�}
|
sYtjd��ntj��j�}�js�|j�_n|r�t�ddd|�}
|
j|
�jdt�ntj��r�tj||
|��ndS(s�Add security enhancements to existing configuration
:param config: Configuration object
:type config: interfaces.IConfig
:param plugins: List of plugins
:type plugins: `list` of `str`
:returns: `None`
:rtype: None
thststredirecttuirtstaplec3s|]}t�|�VqdS(N(tgetattr(t.0tenh(R)(s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pys <genexpr>�ss|Please
specify one or more enhancement types to configure. To list the available
enhancement types, run:
%s --help enhance
is#No enhancements requested, exiting.tenhancesVOne ore more of the
requested enhancements are not supported by the selected installersFWhich
certificate would you like to use to enhance your
configuration?R�R�sJWhich domain names would you like to enable the
selected enhancements for?sAUser cancelled the domain selection. No domains
defined,
exiting.R�R�tredirect_defaultN(tanyRR�RwR�R]R^RtMisconfigurationErrorR�R�R�R�R�R�RR�R/RBR|tnoninteractive_modeR�t
choose_valuesR=RzR�R�R4R�R�(R)R�tsupported_enhancementstoldstyle_enhR+R�R�R�R�tcert_domainsR2tdomain_questionRCRA((R)s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR�s@
cCs
tj|j|j||�dS(s�Rollback server configuration changes made during
install.
:param config: Configuration object
:type config: interfaces.IConfig
:param plugins: List of plugins
:type plugins: `list` of `str`
:returns: `None`
:rtype: None
N(R
trollbackR�tcheckpoints(R)R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR
�s
cCstj|�dS(srUpdate the certificate file family
symlinks
Use the information in the config file to make symlinks point to
the correct archive directory.
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None`
:rtype: None
N(Rtupdate_live_symlinks(R)R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pytupdate_symlinks�scCstj|�dS(sARename
a certificate
Use the information in the config file to rename an existing
lineage.
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None`
:rtype: None
N(Rtrename_lineage(R)R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pytrename�scCstj|�dS(sADelete
a certificate
Use the information in the config file to delete an existing
lineage.
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None`
:rtype: None
N(RR�(R)R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR�scCstj|�dS(sDisplay
information about certs configured with Certbot
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None`
:rtype: None
N(Rtcertificates(R)R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR&$s
cCs�d|_|_|jdkrC|jrCtj||j�|_n.|js_|jrq|jrqtjd��n|j dk r�t
jd|jd|j d�tj
|jd|j d�tjj|j d�}tj||�}nDt
jd|jd�t|�\}}tj||j|j�}tj|jd�d}t
jd|j�y*|jtj|�|j�t|�Wntjk
r�}t|�SXtj|jd�dS(s:Revoke a previously obtained
certificate.
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None` or string indicating error in case of error
:rtype: None or str
sCError! Exactly one of --cert-path or --cert-name must be
specified!s$Revoking %s using certificate key %siisRevoking %s using
Account KeysReason code for revocation: %sN(
R4R�R�R�RBRtcert_path_for_cert_nameRR=R�RwR�Rtverify_cert_matches_priv_keytjosetJWKR�R
tacme_from_config_keyR�tkeyR�tpyopenssl_load_certificatetreasontrevoketComparableX509R�tacme_errorstClientErrorR�R�tsuccess_revocation(R)R�R,R�R�R�RJR�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR/5s. cCs�ytj||d�\}}Wntjk
r>}t|�SXtj||�sctjd��nt|||�}t ||�\}}t
|||�\}} | }
|r�t||||| �}
n|
r�|
jnd}|
r�|
jnd}|
r|
jnd}
|r$t||||
�nt||||
�tj|�re|
retj|
|||�n| dksx|r�tj|�n
tj|�t|�tj||j�dS(s�Obtain
a certificate and install.
:param config: Configuration object
:type config: interfaces.IConfig
:param plugins: List of plugins
:type plugins: `list` of `str`
:returns: `None`
:rtype: None
RdsVOne ore more of the requested enhancements are not supported by the
selected
installerN(R�R�RR�R�RR�R�R�R�RyRDR�R4R�R�R�R�R�R�R�tsuccess_installationtsuccess_renewalR,Rthandle_subscriptionR
(R)R�R�R�R�RAR2RBtshould_get_certRCtnew_lineageR�R�R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyRdbs6
cCs�|j\}}|j|�\}}|jrDtjd|j�dS|j||tj j
|j�tj j
|j�tj j
|j��\}}}||fS(s�Obtain a cert using a user-supplied CSR
This works differently in the CSR case (for now) because we don't
have the privkey, and therefore can't construct the files for a
lineage.
So we just save the cert & chain to disk :/
:param config: Configuration object
:type config: interfaces.IConfig
:param client: Client object
:type client: client.Client
:returns: `cert_path` and `fullchain_path` as absolute paths to the
actual files
:rtype: `tuple` of `str`
s*Dry run: skipping saving certificate to %sN(NN(
t
actual_csrtobtain_certificate_from_csrR8RwR�R�R4tsave_certificateRR�tnormpathR�R�(R)RAtcsrR�RJtchainR�R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt_csr_get_and_save_cert�s
3c Cs�ytj||d�\}}Wn)tjk
rJ}tjd|��nXt|||�}t||d|�}tj j
tj�j
}|dkr�|dj|j�dt�n?tj|||�|j�|dj|j|j�dt�dS(s�Renew
& save an existing cert. Do not install it.
:param config: Configuration object
:type config: interfaces.IConfig
:param plugins: List of plugins
:type plugins: `list` of `str`
:param lineage: Certificate lineage object
:type lineage: storage.RenewableCert
:returns: `None`
:rtype: None
:raises errors.PluginSelectionError: MissingCommandlineFlag if supplied
parameters do not pass
Res'Could not choose appropriate plugin: %sRCs9new certificate
deployed without reload, fullchain is {0}RsDnew certificate deployed with
reload of {0} server; fullchain is
{1}N(R�R�RR�RwRxR�RDR#R$R%RRZRR4R7t fullchainR/Rtrun_renewal_deployertrestartR�( R)R�RCR�tauthR�RAtrenewed_lineageR6((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyR;�s
cCs�ytj||d�\}}Wn)tjk
rJ}tjd|��nXt|||�}|jr�t||�\}}t |||�t
|�tj||j
�dSt||�\}} t||| �\}
}|
stjjtj�j}|ddt�dSt|||| |�}|r2|jnd}|rG|jnd}|r\|jnd}
t ||||
�t
|�tj||j
�dS(sfAuthenticate & obtain cert, but do not
install it.
This implements the 'certonly' subcommand.
:param config: Configuration object
:type config: interfaces.IConfig
:param plugins: List of plugins
:type plugins: `list` of `str`
:returns: `None`
:rtype: None
:raises errors.Error: If specified plugin could not be used
Res'Could not choose appropriate plugin: %sNs5Certificate not yet
due for renewal; no action
taken.R(R�R�RR�RwRxR�R=R?R�R,RR6R
R�RyR#R$R%RRZRR/RDR�R4R�R�(R)R�R�RCR�RAR�R�R2RBR7RCR6R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyRe�s2
cCs#ztj|�Wdtj�XdS(sRenew previously-obtained
certificates.
:param config: Configuration object
:type config: interfaces.IConfig
:param unused_plugins: List of plugins (deprecated)
:type unused_plugins: `list` of `str`
:returns: `None`
:rtype: None
N(Rthandle_renewal_requestRtrun_saved_post_hooks(R)R�((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyRs
cCs{tj|jtj|j�tj|jtj|j�|j|j|j f}x$|D]}tj
|d|j�qWWdS(s�Create or verify existence of config, work, and
hook directories.
:param config: Configuration object
:type config: interfaces.IConfig
:returns: `None`
:rtype: None
tstrictN(R tset_up_core_dirt
config_dirRtCONFIG_DIRS_MODEtstrict_permissionstwork_dirtrenewal_pre_hooks_dirtrenewal_deploy_hooks_dirtrenewal_post_hooks_dirtmake_or_verify_dir(R)t hook_dirsthook_dir((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pytmake_or_verify_needed_dirs+s
cCsz|jr0t|_tjttjd��}n6|jrNtjtj �}ntj
tj |j�}tj
j|�dS(s�Set the displayer
:param config: Configuration object
:type config: interfaces.IConfig
:returns: `None`
:rtype: None
twN(tquietR\RR5tNoninteractiveDisplaytopenRtdevnullR]tstdouttFileDisplayRRR#R$tprovideUtility(R)t displayer((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt
set_displayer?s
cCs�|stjd}ntj�tjjd�dkrJtj|�}nt j
j�}tj
dtj�tj
dtjd�tj
d|�tj
d|�tj||�}tj|�}tjj|�tj�ytj|�t|�Wn)tjk
r$|jtkr%�q%nXtjdd krKt j!d
t"�nt#|�t$j%|�}tjj|�t&j'|j(�|j||�S(s�Run
Certbot.
:param cli_args: command line to Certbot, defaults to ``sys.argv[1:]``
:type cli_args: `list` of `str`
:returns: value for `sys.exit` about the exit status of Certbot
:rtype: `str` or `int` or `None`
itCERTBOT_SNAPPEDR\scertbot version: %ss#Location of certbot entry
point: %sis
Arguments: %rsDiscovered plugins: %risdPython 2 support will
be dropped in the next release of Certbot. Please upgrade your Python
version.()R]R^Rtpre_arg_parse_setupRtenvirontgetRtprepare_envt
plugins_discotPluginsRegistryR�RwR�tcertbott__version__Rtprepare_and_parse_argsRtNamespaceConfigR#R$R[Rt+raise_for_non_administrative_windows_rightstpost_arg_parse_setupRSRR=tfuncRtversion_infotwarningstwarntPendingDeprecationWarningR]RtReporterR tatexit_registertprint_messages(tcli_argsR�targsR)treport((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pytmainUs:
(et__doc__t
__future__RRtlogging.handlerstloggingR]RmR�tjosepyR)tzope.componentR#R�RR1tacme.magic_typingRRRRRReRRR tcertbot._internalR
RRR
RRRRRRRRRRtcertbot._internal.pluginsRRcRR�tcertbot.compatRRRtcertbot.displayRR�R5tcertbot.pluginsRR_t getLoggert__name__RwR,R0R4RDRMRbRoRuRyRvR�R�R}R�R�R�R�R�R�R�R�R�R�R�R�RRR
R#R%R�R&R/RdR?R;ReRRSR]Rv(((s:/usr/lib/python2.7/site-packages/certbot/_internal/main.pyt<module>s�( ; 3 7 ( +
&)* ; 4 ( 2 ; ' ; - : + 4