Spade
Mini Shell
| Directory:~$ /proc/self/root/lib/python2.7/site-packages/certbot/plugins/ |
| [Home] [System Details] [Kill Me] |
�
���_c@sMdZddlZddlZddlmZddlZddlZddlm Z ddl
mZddl
mZddl
mZddl
mZdd lmZdd
lmZddlmZeje�Zejjej�ejjej�dejfd
��Y��Zde
fd��YZ!d�Z"d�Z#d�Z$dS(s*Common code for DNS
Authenticator Plugins.i����N(tsleep(t
challenges(terrors(t
interfaces(t
filesystem(tos(tops(tutil(tcommontDNSAuthenticatorcBs�eZdZd�Zedd��Zd�Zd�Zd�Zd�Z e
jd��Ze
jd ��Z
e
jd
��Zd�Zdd�Zddd
�Zed��Zedd��ZRS(s"Base
class for DNS
AuthenticatorscCs&tt|�j||�t|_dS(N(tsuperR t__init__tFalset_attempt_cleanup(tselftconfigtname((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyRsi
cCs
|dd|dtdd�dS(Nspropagation-secondstdefaultttypethelpsjThe
number of seconds to wait for DNS to propagate before asking the ACME
server to verify the DNS
record.(tint(tclstaddtdefault_propagation_seconds((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pytadd_parser_arguments
s cCs
tjgS(N(RtDNS01(Rt
unused_domain((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pytget_chall_pref(scCsdS(N((R((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pytprepare+scCs�|j�t|_g}xd|D]\}|j}|j|�}|j|j�}|j|||�|j|j |j��q
Wt
jd|jd��t
|jd��|S(Ns/Waiting %d seconds for DNS
changes to
propagatespropagation-seconds(t_setup_credentialstTrueR
tdomaintvalidation_domain_namet
validationtaccount_keyt_performtappendtresponsetloggertinfotconfR(Rtachallst responsestachallRR
R!((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pytperform.s
cCs^|jrZxN|D]C}|j}|j|�}|j|j�}|j|||�qWndS(N(R
RR
R!R"t_cleanup(RR)R+RR
R!((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pytcleanupEs
cCs
t��dS(s@
Establish credentials, prompting if necessary.
N(tNotImplementedError(R((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyRNscCs
t��dS(sX
Performs a dns-01 challenge by creating a DNS TXT record.
:param str domain: The domain being validated.
:param str validation_domain_name: The validation record domain
name.
:param str validation: The validation record content.
:raises errors.PluginError: If the challenge cannot be performed
N(R/(RRtvalidation_nameR!((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR#Us
cCs
t��dS(sX
Deletes the DNS TXT record which would have been created by
`_perform_achall`.
Fails gracefully if no such record exists.
:param str domain: The domain being validated.
:param str validation_domain_name: The validation record domain
name.
:param str validation: The validation record content.
N(R/(RRR0R!((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR-ascCsG|j|�}|sC|j|�}t|j|j|�|�ndS(s
Ensure that a configuration value is available.
If necessary, prompts the user and stores the result.
:param str key: The configuration key.
:param str label: The user-friendly label for this piece of
information.
N(R(t_prompt_for_datatsetattrRtdest(Rtkeytlabeltconfigured_valuet new_value((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyt
_configurens
cCsb|j|�}|s^|j||�}t|j|j|�tjjtjj|���ndS(s
Ensure that a configuration value is available for a path.
If necessary, prompts the user and stores the result.
:param str key: The configuration key.
:param str label: The user-friendly label for this piece of
information.
N( R(t_prompt_for_fileR2RR3Rtpathtabspatht
expanduser(RR4R5t validatorR6R7((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyt_configure_file~s
csp���fd�}�j|||�t�j|��j�}�rY|j��n�rl�|�n|S(s�
As `_configure_file`, but for a credential configuration file.
If necessary, prompts the user and stores the result.
Always stores absolute paths to avoid issues during renewal.
:param str key: The configuration key.
:param str label: The user-friendly label for this piece of
information.
:param dict required_variables: Map of variable which must be
present to error to display.
:param callable validator: A method which will be called to
validate the
`CredentialsConfiguration` resulting from the supplied input
after it has been validated
to contain the `required_variables`. Should throw a
`~certbot.errors.PluginError` to
indicate any issue.
cs?t|�j�}�r(|j��n�r;�|�ndS(N(tCredentialsConfigurationR3trequire(tfilenamet
configuration(trequired_variablesRR=(s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyt__validator�s
(R>R?R(R3R@(RR4R5RCR=t_DNSAuthenticator__validatortcredentials_configuration((RCRR=s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyt_configure_credentials�s
cse�fd�}tj|dj��dt�\}}|tjkrI|Stjdj����dS(s�
Prompt the user for a piece of information.
:param str label: The user-friendly label for this piece of
information.
:returns: The user's response (guaranteed non-empty).
:rtype: str
cs%|s!tjdj����ndS(NsPlease enter your
{0}.(RtPluginErrortformat(ti(R5(s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyRD�ssInput
your {0}tforce_interactives{0} required to
proceed.N(Rtvalidated_inputRIRtdisplay_utiltOKRRH(R5REtcodeR%((R5s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR1�s
csh��fd�}tj|dj��dt�\}}|tjkrL|Stjdj����dS(s�
Prompt the user for a path.
:param str label: The user-friendly label for the file.
:param callable validator: A method which will be called to
validate the supplied input
after it has been validated to be a non-empty path to an
existing file. Should throw a
`~certbot.errors.PluginError` to indicate any issue.
:returns: The user's response (guaranteed to exist).
:rtype: str
csT|s!tjdj����ntjj|�}t|��rP�|�ndS(Ns&Please
enter a valid path to your
{0}.(RRHRIRR:R<t
validate_file(RA(R5R=(s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyRD�s
sInput the path to your {0}RKs{0} required to
proceed.N(Rtvalidated_directoryRIRRMRNRRH(R5R=REROR%((R5R=s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR9�s
N(t__name__t
__module__t__doc__RtclassmethodRRRR,R.tabctabstractmethodRR#R-R8tNoneR>RGtstaticmethodR1R9(((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR s"
%R?cBsAeZdZd�d�Zd�Zd�Zd�Zd�ZRS(s>Represents
a user-supplied filed which stores API
credentials.cCs|S(N((tx((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyt<lambda>�scCstt|�ytj|�|_WnDtjk
rf}tjd|dt�tj dj
|���nX||_dS(s�
:param str filename: A path to the configuration file.
:param callable mapper: A transformation to apply to configuration
key names
:raises errors.PluginError: If the file does not exist or is not a
valid format.
s+Error parsing credentials configuration: %stexc_infos,Error
parsing credentials configuration:
{0}N(tvalidate_file_permissionst configobjt ConfigObjtconfobjtConfigObjErrorR&tdebugRRRHRItmapper(RRARcte((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR�s
cCs�g}x~|D]v}|j|�sK|jdj|j|�||��q
|j|�s
|jdj|j|�||��q
q
W|r�tjdjt|�dkr�dnd|jj dj
|����ndS( s�Ensures that the supplied set of variables are
all present in the file.
:param dict required_variables: Map of variable which must be
present to error to display.
:raises errors.PluginError: If one or more are missing.
s)Property "{0}" not found (should be
{1}).s'Property "{0}" not set (should be {1}).s9Missing {0}
in credentials configuration file {1}:
* {2}itpropertyt
propertiess
*
N(t_hasR$RIRct_getRRHtlenR`RAtjoin(RRCtmessagestvar((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR@�s
! cCs
|j|�S(s�Find
a configuration value for variable `var`, as transformed by `mapper`.
:param str var: The variable to get.
:returns: The value of the variable.
:rtype: str
(Rh(RRl((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR(scCs|j|�|jkS(N(RcR`(RRl((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyRg"scCs|jj|j|��S(N(R`tgetRc(RRl((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyRh%s(RRRSRTRR@R(RgRh(((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR?�s
cCs^tjj|�s-tjdj|���ntjj|�rZtjdj|���ndS(s&Ensure
that the specified file exists.sFile not found: {0}sPath is a directory:
{0}N(RR:texistsRRHRItisdir(RA((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyRP)scCs0t|�tj|�r,tjd|�ndS(sHEnsure
that the specified file exists and warn about unsafe permissions.s8Unsafe
permissions on credentials configuration file:
%sN(RPRthas_world_permissionsR&twarning(RA((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyR]3s
cCsB|jd�}gtdt|��D]}dj||�^q%S(s�Return a
list of progressively less-specific domain names.
One of these will probably be the domain name known to the DNS
provider.
:Example:
>>>
base_domain_name_guesses('foo.bar.baz.example.com')
['foo.bar.baz.example.com', 'bar.baz.example.com',
'baz.example.com', 'example.com', 'com']
:param str domain: The domain for which to return guesses.
:returns: The a list of less specific domain names.
:rtype: list
t.i(tsplittrangeRiRj(Rt fragmentsRJ((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pytbase_domain_name_guesses<s(%RTRVtloggingttimeRR^tzope.interfacetzopetacmeRtcertbotRRtcertbot.compatRRtcertbot.displayRRRMtcertbot.pluginsRt getLoggerRRR&t interfacetimplementertIAuthenticatortprovidertIPluginFactorytPluginR tobjectR?RPR]Rv(((s>/usr/lib/python2.7/site-packages/certbot/plugins/dns_common.pyt<module>s*�=