ok

Mini Shell

Direktori : /proc/self/root/proc/self/root/proc/thread-self/root/lib/python2.7/site-packages/isc/
Upload File :
Current File : //proc/self/root/proc/self/root/proc/thread-self/root/lib/python2.7/site-packages/isc/dnskey.pyo

�
���cc@sgddlZddlZddlZddlmZmZdefd��YZddd��YZdS(i����N(tPopentPIPEtTimePastcBseZd�ZRS(cCs'tt|�jd|||f�dS(Ns'%s time for key %s (%d) is already past(tsuperRt__init__(tselftkeytproptvalue((s./usr/lib/python2.7/site-packages/isc/dnskey.pyRs(t__name__t
__module__R(((s./usr/lib/python2.7/site-packages/isc/dnskey.pyRstdnskeycBseZdZdGZdIZdJZdHdHd�Zd �Zd!�Z	e
dHdHd"��Zd#�Ze
d$��Ze
d%��ZdHd&�Ze
d'��Ze
d(��Ze
d)��Ze
d*��Zd+�Zd,�Zd-�Zd.�Zd/�Zd0�Zej�d1�Zd2�Zej�d3�Zd4�Zej�d5�Z d6�Z!ej�d7�Z"d8�Z#ej�d9�Z$d:�Z%ej�d;�Z&d<�Z'ej�d=�Z(d>�Z)d?�Z*d@�Z+dA�Z,dB�Z-dC�Z.dHdD�Z/dHdHdE�Z0e
dF��Z1RS(KstAn individual DNSSEC key.  Identified by path, name, algorithm, keyid.
    Contains a dictionary of metadata events.tCreatedtPublishtActivatetInactivetDeletetRevoket	DSPublishtSyncPublisht
SyncDeletes-Ps-As-Is-Ds-Rs-Psyncs-DsynctRSAMD5tDHtDSAtECCtRSASHA1tNSEC3DSAtNSEC3RSASHA1t	RSASHA256t	RSASHA512tECCGOSTtECDSAP256SHA256tECDSAP384SHA384tED25519tED448c	Cs�t|t�rXt|�dkrX|p*d|_|\}}}|j||||�n|pstjj|�psd|_tjj|�}|j	d�\}}}|dd!}t
|�}t
|j	d�d�}|j||||�dS(Nit.t+ii����i(t
isinstancettupletlent_dirt	fromtupletostpathtdirnametbasenametsplittint(RRt	directorytkeyttltnametalgtkeyid((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR&s!!
cCs�|jd�r'|}|jd�}n
|d}d|||f}|j|jr\tjp_d|d}|j|jr�tjp�d|d}||_||_t|�|_t|�|_	||_
t|d�}	x�|	D]�}
|
ddkr�q�n|
j�}|sq�n|d	j
�dkr=d
}||_n%d}|sYt|d	�n||_t||�d	@d	kr�t|_q�t|_q�W|	j�t|d�}
t�|_t�|_t�|_t�|_t�|_t�|_t�|_d|_x�|
D]�}
|
j�}
|
s|
ddkrAqngdD]}|
j|�^qHt|
�g}tg|D]}|dkrz|^qz�}|
| j�}|
|j d�j�}||j|<qWx�t!j"D]�}t|j|<||jkrg|j#|j|�}||j|<|j$|�|j|<|j%|�|j|<|j||j|<q�d|j|<d|j|<d|j|<d|j|<q�W|
j�dS(NR#s
K%s+%03d+%05dts.keys.privatetrit;itintchthsiitrUs!#s:= i����(sinR9R:(&tendswithtrstripR(R*tseptkeystrR2R/R3R4tfullnametopenR.tlowertttltTruetFalsetclosetdicttmetadatat_changedt_deletet_timest_fmttimet_timestampst	_originaltNonet_origttltstriptfindR'tmintlstripRt_PROPSt	parsetimet
formattimet
epochfromtime(RR2R3R4R1R@R?tkey_filetprivate_filetkfptlinettokenstseptokentpfptctpunctuationtpostfoundRRtt((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR)5sv
''			


	
/+




cKs�|jdt�}g}t}|jdk	rI|dt|j�g7}nx�ttj	tj
�D]�\}}|s_|j|r�q_nt}||jkr�|j|r�t}n|r�dn
|j
|}	|||	g7}t}q_W|r�|d|jg||jg}
|s%ddj|
�GHnyIt|
dtdt�}|j�\}}
|
rmtt|
���nWn/tk
r�}td	|t|�f��nXd|_x5tj	D]'}|j||j|<t|j|<q�WndS(
Ntquiets-Ltnones-Ks# t tstdouttstderrsunable to run %s: %s(tgetRERDRPROtstrRCtzipRRUt_OPTSRIRJRLR(R?tjoinRRtcommunicatet	ExceptionRMRN(Rtsettime_bintkwargsRetcmdtfirstRtopttdeletetwhentfullcmdtpRhRite((s./usr/lib/python2.7/site-packages/isc/dnskey.pytcommit�s<"	
 	cKs�|jdt�}|dd|dt|�g}
|rI|
d|g7}
n|r_|
jd�n|rx|
d|g7}
n|r�|
dt|�g7}
n|	r�tj|	�}|
d	tj|�g7}
n|
r�tj|
�}|
d
tj|
�g7}
n|
j|�|s!ddj|
�GHnt|
d
t	dt	�}|j
�\}}|rjtdt|���ny3|j�dj
d�}t|||�}|SWn)tk
r�}tdt|���nXdS(NRes-qs-Ks-Ls-rs-fks-as-bs-Ps-As# RgRhRisunable to generate key: itasciis!unable to parse generated key: %s(RjRERktappendRt
timefromepochRWRnRRRoRpt
splitlinestdecode(tclst
keygen_bint	randomdevtkeys_dirR2R3tkeysizeR>RCtpublishtactivateRrRet
keygen_cmdRdRyRhRiR?tnewkeyRz((s./usr/lib/python2.7/site-packages/isc/dnskey.pytgenerate�s:
cKsa|jdt�}|j�s1td|��n|dd|jd|jg}|jrt|dt|j�g7}n|r�|d|g7}n|r�|dt|�g7}n|s�d	d
j|�GHnt	|dt
dt
�}|j�\}}	|	r
td
|	��ny9|j�dj
d�}
t|
|j|j�}|SWntd|��nXdS(NRes'predecessor key %s has no inactive dates-qs-Ks-Ss-Ls-rs-is# RgRhRisunable to generate key: iR|s'unable to generate successor for key %s(RjREtinactiveRpR(R?RCRkRnRRRoRR�R(RR�R�t
prepublishRrReR�RyRhRiR?R�((s./usr/lib/python2.7/site-packages/isc/dnskey.pytgenerate_successor�s,	cCsCd}|tttj��kr1tj|}n|r;|Sd|S(Ns%03d(ROtrangeR'Rt	_ALGNAMES(R3R2((s./usr/lib/python2.7/site-packages/isc/dnskey.pytalgstr�scCsC|s
dS|j�}ytjj|�SWntk
r>dSXdS(N(ROtupperRR�tindext
ValueError(R3((s./usr/lib/python2.7/site-packages/isc/dnskey.pytalgnum�s
cCs|j|p|j�S(N(R�R3(RR3((s./usr/lib/python2.7/site-packages/isc/dnskey.pytalgnamescCs
tj|�S(N(ttimetgmtime(tsecs((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR~scCstj|d�S(Ns%Y%m%d%H%M%S(R�tstrptime(tstring((s./usr/lib/python2.7/site-packages/isc/dnskey.pyRVscCs
tj|�S(N(tcalendarttimegm(Rd((s./usr/lib/python2.7/site-packages/isc/dnskey.pyRXscCstjd|�S(Ns%Y%m%d%H%M%S(R�tstrftime(Rd((s./usr/lib/python2.7/site-packages/isc/dnskey.pyRWscKsL|jdt�}|j||kr)dS|j|dk	rr|j||krr|rrt|||j|��n|dkr�|j|dkr�tnt|j|<t|j|<d|j|<d|j	|<d|j
|<dS|j|�}||j|<||j	|<|j|�|j
|<|j||j|kr;tnt|j|<dS(Ntforce(
RjRERMRNRORRDRIRJRKRLR~RW(RRR�tnowRrR�Rd((s./usr/lib/python2.7/site-packages/isc/dnskey.pytsetmetas$&





cCs|j|S(N(RK(RR((s./usr/lib/python2.7/site-packages/isc/dnskey.pytgettime2scCs|j|S(N(RL(RR((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt
getfmttime5scCs|j|S(N(RM(RR((s./usr/lib/python2.7/site-packages/isc/dnskey.pytgettimestamp8scCs|jdS(NR(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pytcreated;scCs|jdS(NR(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pytsyncpublish>scKs|jd|||�dS(NR(R�(RR�R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pytsetsyncpublishAscCs|jdS(NR
(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR�DscKs|jd|||�dS(NR
(R�(RR�R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt
setpublishGscCs|jdS(NR(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR�JscKs|jd|||�dS(NR(R�(RR�R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pytsetactivateMscCs|jdS(NR(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pytrevokePscKs|jd|||�dS(NR(R�(RR�R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt	setrevokeSscCs|jdS(NR(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR�VscKs|jd|||�dS(NR(R�(RR�R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pytsetinactiveYscCs|jdS(NR(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pyRv\scKs|jd|||�dS(NR(R�(RR�R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt	setdelete_scCs|jdS(NR(RM(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt
syncdeletebscKs|jd|||�dS(NR(R�(RR�R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt
setsyncdeleteescCsw|dks|j|krdS|jdkrF|j|_||_n-|j|krjd|_||_n	||_dS(N(RORCRP(RRC((s./usr/lib/python2.7/site-packages/isc/dnskey.pytsetttlhs	cCs|jr
dSdS(NtKSKtZSK(R>(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pytkeytypetscCsd|j|j�|jfS(Ns
%s/%s/%05d(R2R�R4(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt__str__wscCs/d|j|j�|j|jr'dndfS(Ns%s/%s/%05d (%s)R�R�(R2R�R4R>(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt__repr__{scCs"|j�p!|j�p!|j�S(N(R�R�R�(R((s./usr/lib/python2.7/site-packages/isc/dnskey.pytdate�scCsZ|j|jkr"|j|jkS|j|jkrD|j|jkS|j�|j�kS(N(R2R3R�(Rtother((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt__lt__�s
cCsKd�}|s|}nttj��}|j�}|j�}|sLtS|sy||kru|dt|��ntS||kr�||kr�tS||kr�|dt|�tj|j	�p�df�tS||kr�|dt|��tS|j	dk	rG|||j	krG|dt|�tj|j	�p;df�tStS(Nc_sdS(N((targsRr((s./usr/lib/python2.7/site-packages/isc/dnskey.pytnoop�ssFWARNING: Key %s is scheduled for
	 activation but not for publication.s�WARNING: %s is scheduled to be
	 published and activated at the same time. This
	 could result in a coverage gap if the zone was
	 previously signed. Activation should be at least
	 %s after publication.sone DNSKEY TTLs0WARNING: Key %s is active before it is publisheds�WARNING: Key %s is activated too soon
	 after publication; this could result in coverage 
	 gaps due to resolver caches containing old data.
	 Activation should be at least %s after
	 publication.(R/R�R�R�REtreprRDRtdurationRCRO(RtoutputR�R�taRy((s./usr/lib/python2.7/site-packages/isc/dnskey.pytcheck_prepub�s<			"	cCsd�}|dkr|}n|dkr6|j}ntj�}|j�}|j�}|sdtS|s�||kr�|dt|��ntS||kr�||kr�tS||kr�|dt|��tS|||kr|dt|�tj	|�f�tStS(Nc_sdS(N((R�Rr((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR��ssEWARNING: Key %s is scheduled for
	 deletion but not for inactivation.s@WARNING: Key %s is scheduled for
	 deletion before inactivation.s�WARNING: Key %s scheduled for
	 deletion too soon after deactivation; this may 
	 result in coverage gaps due to resolver caches
	 containing old data.  Deletion should be at least
	 %s after inactivation.(
RORCR�RvR�RER�RDRR�(RR�ttimespanR�R�tdti((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt
check_postpub�s4		cCs�|s
dSddfddfddfddfddg}g}xj|D]b}||d||d}}|dkrG|jd
||d|dkr�dndf�qGqGWdj|�S(Ntyeari<iimtmonthitdaythourtminutetsecondiis%d %s%stsR5s, ii�Qi�3�ii�Qi�'ii�Qi(R�i<(R�i(ROR}Rn(R�tunitsR�tunittv((s./usr/lib/python2.7/site-packages/isc/dnskey.pyR��s					
7(	sCreatedsPublishsActivatesInactivesDeletesRevokeRsSyncPublishs
SyncDeleteN(	Ns-Ps-As-Is-Ds-RNs-Psyncs-Dsync(NRRRRRRRRNRNRRR R!R"(2R	R
t__doc__RURORmR�RR)R{tclassmethodR�R�tstaticmethodR�R�R�R~RVRXRWR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RvR�R�R�R�R�R�R�R�R�R�R�R�(((s./usr/lib/python2.7/site-packages/isc/dnskey.pyRsb	M	%*	 
																		1)((	R*R�R�t
subprocessRRRpRR(((s./usr/lib/python2.7/site-packages/isc/dnskey.pyt<module>s


Zerion Mini Shell 1.0