403Webshell
Server IP : 61.19.30.66  /  Your IP : 216.73.216.15
Web Server : Apache/2.2.22 (Ubuntu)
System : Linux klw 3.11.0-15-generic #25~precise1-Ubuntu SMP Thu Jan 30 17:39:31 UTC 2014 x86_64
User : www-data ( 33)
PHP Version : 5.3.10-1ubuntu3.48
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python2.7/dist-packages/landscape/broker/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python2.7/dist-packages/landscape/broker/registration.pyc
ó
}9Rc@s?dZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZmZddl
mZddlmZdd	lmZd
ZdefZdefd
„ƒYZd„Zd„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZd„Zd„Zed„ZdS(sË
Handle client registration against the server.

When the service is started for the first time it connects to the server
as a new client without providing any identification credentials, and the
server replies with the available registration mechanisms. At this point
the machinery in this module will notice that we have no identification
credentials yet and that the server accepts regiration messages, so it
will craft an appropriate one and send it out.
iÿÿÿÿN(tDeferred(tloads(tlog_failure(tfetcht
FetchError(tis_valid_tag_list(tget_fqdn(tget_vm_infos169.254.169.254shttp://%s/latesttInvalidCredentialsErrorcBseZdZRS(sx
    Raised when an invalid account title and/or registration key
    is used with L{RegistrationManager.register}.
    (t__name__t
__module__t__doc__(((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyRscs+‡fd†}‡fd†}t||ƒS(Ncs|jjˆƒS(N(t_persisttget(tself(tname(sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR
&scs|jjˆ|ƒdS(N(Rtset(Rtvalue(R(sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR)s(tproperty(RR
R((RsA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pytpersist_property$scs‡fd†}t|ƒS(Ncst|jˆƒS(N(tgetattrt_config(R(R(sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR
1s(R(RR
((RsA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pytconfig_property/stIdentitycBs_eZdZedƒZedƒZedƒZedƒZedƒZ	edƒZ
d„ZRS(sfMaintains details about the identity of this Landscape client.

    @ivar secure_id: A server-provided ID for secure message exchange.
    @ivar insecure_id: Non-secure server-provided ID, mainly used with
        the ping server.
    @ivar computer_title: See L{BrokerConfiguration}.
    @ivar account_name: See L{BrokerConfiguration}.
    @ivar registration_password: See L{BrokerConfiguration}.
    @ivar tags: See L{BrokerConfiguration}

    @param config: A L{BrokerConfiguration} object, used to set the
        C{computer_title}, C{account_name} and C{registration_password}
        instance variables.
    s	secure-idsinsecure-idtcomputer_titletaccount_nametregistration_keyttagscCs||_|jdƒ|_dS(Ntregistration(Rtroot_atR(Rtconfigtpersist((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyt__init__Ns	(R	R
RRt	secure_idtinsecure_idRRRRRR (((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR7stRegistrationHandlercBskeZdZdd„Zd„Zd„Zd„Zd„Zd„Z	d„Z
d„Zd	„Zd
„Z
RS(sÉ
    An object from which registration can be requested of the server,
    and which will handle forced ID changes from the server.

    L{register} should be used to perform initial registration.
    cCsâ||_||_||_||_||_||_|jjd|jƒ|jjd|jƒ|jjd|j	ƒ|jj
d|jƒ|jj
d|jƒ|jj
d|j
ƒd|_||_d|_d|_dS(Ntrunspre-exchanges
exchange-donesset-ids
unknown-idR(Rt	_identityt_reactort	_exchanget_pingert_message_storetcall_ont_fetch_ec2_datat_handle_pre_exchanget_handle_exchange_donetregister_messaget_handle_set_idt_handle_unknown_idt_handle_registrationtNonet_should_registert_fetch_asynct_otpt	_ec2_data(RRtidentitytreactortexchangetpingert
message_storetfetch_async((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR [s"						
			cCsv|j}|jrtS|jjr2|jjdƒS|jjrN|jjdƒSt|j	or|j
or|jjdƒƒS(Nsregister-cloud-vmsregister-provisioned-machinetregister(R%R!tFalseRtcloudR)tacceptstprovisioning_otptboolRR(Rtid((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pytshould_registeros		cCs;d|j_d|j_t|jƒj}|jjƒ|S(sô
        Attempt to register with the Landscape server.

        @return: A L{Deferred} which will either be fired with None if
            registration was successful or will fail with an
            L{InvalidCredentialsError} if not.
        N(	R2R%R!R"tRegistrationResponseR&tdeferredR'R9(Rtresult((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR={s

cCs|jt|ƒj|jƒS(st
        Get data at C{path} on the EC2 API endpoint, and add the result to the
        C{accumulate} list.
        (R4tEC2_APItaddCallbacktappend(Rtpatht
accumulate((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyt	_get_data‰sc	s ˆj}ˆjjr|jrg‰ˆjtdƒjtƒjˆj	ƒ}dddddddd	g}x*|D]"}|j|‡‡fd
†ƒqrW|j‡fd†ƒ|jˆj	ƒ|j‡fd†ƒ|jˆj	ƒ‡‡fd
†}d„}|j|ƒ|j|ƒndS(sARetrieve available EC2 information, if in a EC2 compatible cloud.s
/user-datas/meta-data/instance-ids/meta-data/reservation-ids/meta-data/local-hostnames/meta-data/public-hostnames/meta-data/ami-launch-indexs/meta-data/ami-ids/meta-data/local-ipv4s/meta-data/public-ipv4csˆj|ˆƒS(N(RM(tignoreRK(Rtec2_data(sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyt<lambda>¨scsˆjtdƒjtƒS(Ns/meta-data/ramdisk-id(R4RHt
addErrbackR(RN(R(sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyRP«scsˆjtdƒjtƒS(Ns/meta-data/kernel-id(R4RHRQR(RN(R(sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyRP°scsÔˆ\}}}}}}}}}	}
}i
|d6|d6|d6|d6|d6|d6|
d6|d6|	d	6|d
6ˆ_xQˆjjƒD]@\}}
|
dkr°|dkr°q†n|
jdƒˆj|<q†Wtˆjdƒˆjd<ˆjjrˆjjˆ_dSt|t|ƒƒ}|dk	rÐ|d
ˆ_|d}|d}ˆj	j
j|ƒ|ˆj_|ˆj_
d|krÀddlm}|ˆj|dƒ}|ˆj_|ˆj	j
_nˆjjƒndS(s1Record the instance data returned by the EC2 API.tinstance_keytreservation_keytlocal_hostnametpublic_hostnametlaunch_indext
kernel_keytramdisk_keyt	image_keytpublic_ipv4t
local_ipv4sutf-8Ntotpsexchange-urlsping-urlsssl-ca-certificateiÿÿÿÿ(tstore_public_key_data(sramdisk_keys
kernel_key(R6titemsR2tdecodetintRR\R5t_extract_ec2_instance_dataR't
_transporttset_urlturltping_urltlandscape.configurationR]tssl_public_keyt_pubkeytwrite(RNt
raw_user_dataRRRSRTRURVtami_keytlocal_ipt	public_ipRXRWtktvt
instance_datatexchange_urlReR]tpublic_key_file(RRO(sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pytrecord_data´sJ'



cSst|dd|jfƒdS(Ntmsgs&Got error while fetching meta-data: %r(RR(terror((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyt	log_errorásN(
R%RR?R!R4RHRQRRIRJ(RRCRFtpathsRKRsRv((RROsA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR+s4		
-	
cCs*|jƒr&|jr&|jjƒndS(sMRegistered handler for the C{"exchange-done"} event.

        If we are not registered yet, schedule another message exchange.

        The first exchange made us accept the message type "register", so
        the next "pre-exchange" event will make L{_handle_pre_exchange}
        queue a registration message for delivery.
        N(RDR3R'R9(R((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR-ès	cCs²|jƒ|_|jr®|j}|jjƒ|j}t|ƒsYd}tj	dƒn|j
jr£|jdk	r£|j
rítjdƒidd6|j
d6tƒd6dd6dd6|d	6tƒd
6}|j|jƒ|jj|ƒq«|jrdd|gt|ƒ}tjd
|j|fƒidd6dd6tƒd6|jd6|jd6|d	6tƒd
6}|j|jƒ|jj|ƒq«|jjdƒq®|jrUddgt|jƒ}dd|gt|ƒ}tjd|j||fƒidd6|jd6|jd6|jd6tƒd6|d	6tƒd
6}|jj|ƒq®|j
jr›tjdƒidd6|j
jd6}|jj|ƒq®|jjdƒndS(sÈ
        An exchange is about to happen.  If we don't have a secure id already
        set, and we have the needed information available, queue a registration
        message with the server.
        s-Invalid tags provided for cloud registration.s%Queueing message to register with OTPsregister-cloud-vmttypeR\thostnameRtregistration_passwordRsvm-infotuand tags %s uBQueueing message to register with account %r %sas an EC2 instance.sregistration-failedtwithouttwithu=Queueing message to register with account %r %s%s a password.R=RuEQueueing message to register with OTP as a newly provisioned machine.sregister-provisioned-machineN(RDR3R%R)tdelete_all_messagesRRR2tloggingRuRR?R6R5tinfoRRtupdateR'tsendRRBRR&tfireRRA(RRCRtmessaget	with_tagst	with_word((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR,ôsn		
		




	




			







cCs|j}|jdƒ|_|jdƒ|_tjd|jd|jƒtjd|jƒ|jj	dƒ|jj	dƒdS(	s×Registered handler for the C{"set-id"} event.

        Record and start using the secure and insecure IDs from the given
        message.

        Fire C{"registration-done"} and C{"resynchronize-clients"}.
        RCsinsecure-ids2Using new secure-id ending with %s for account %s.iöÿÿÿsUsing new secure-id: %ssregistration-donesresynchronize-clientsN(
R%R
R!R"RR€RtdebugR&Rƒ(RR„RC((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR/=s		cCs'|ddkr#|jjdƒndS(NR€sunknown-accountsregistration-failed(R&Rƒ(RR„((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR1NscCs©|j}|jdƒ}|dkr;tjd|jƒnXtjd|ƒ||jjkrqd|jj}nd|jj|f}||j_d|_d|_	dS(Nsclone-ofs,Client has unknown secure-id for account %s.sClient is clone of computer %ss
%s (clone)s%s (clone of %s)(
R%R
R2RR€RRRR!R"(RR„RCtclonettitle((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR0Rs		
	N(R	R
RR2R RDR=RMR+R-R,R/R1R0(((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR#Ss				X		I		REcBs2eZdZd„Zd„Zd„Zd„ZRS(sµA helper for dealing with the response of a single registration request.

    @ivar deferred: The L{Deferred} that will be fired as per
        L{RegistrationHandler.register}.
    cCsI||_|jd|jƒ|_|jd|jƒ|_tƒ|_dS(Nsregistration-donesregistration-failed(R&R*t_donet_done_idt_failedt
_failed_idRRF(RR8((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyR os	cCs*|jj|jƒ|jj|jƒdS(N(R&tcancel_callR‹R(R((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyt
_cancel_callsuscCs|jjdƒ|jƒdS(N(RFtcallbackR2R(R((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyRŠyscCs!|jjtƒƒ|jƒdS(N(RFterrbackRR(R((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyRŒ}s(R	R
RR RRŠRŒ(((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyREhs
			cCsyt|ƒ}Wn&tk
r8tjd|fƒdSXt|tƒs`tjd|fƒdSx5dD]-}||krgtjd||fƒdSqgWt|dƒ|krÉtjd||fƒdSi|d|d	6|dd6|dd6}d
|kr|d
|d
<n|S(sà
    Given the raw string of EC2 User Data, parse it and return the dict of
    instance data for this particular instance.

    If the data can't be parsed, a debug message will be logged and None
    will be returned.
    sGot invalid user-data %rNsuser-data %r is not a dicttotpssexchange-urlsping-urls!user-data %r doesn't have key %r.s1user-data %r doesn't have OTP for launch index %dR\sssl-ca-certificate(R’sexchange-urlsping-url(Rt
ValueErrorRR‡t
isinstancetdicttlen(RjRVt	user_datatkeyRp((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyRa‚s.

		cCs˜d}d}tjƒ}xytr“tjƒ}y%|jt|fƒ|jƒdSWqtjk
rtjdƒtjƒ||krPqqXqWdS(s0
    Keep trying to connect to the EC2 metadata server until it becomes
    accessible or until five minutes pass.

    This is necessary because the networking init script on Ubuntu is
    asynchronous; the network may not actually be up by the time the
    landscape-client init script is invoked.
    ii<iPNii,(ttimetTruetsockettconnecttEC2_HOSTtcloseRutsleep(ttimeouttporttstartts((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyt_wait_for_network¤s		

cCsktƒy0|tdddƒ}|tdddƒ}Wntk
rKtSXt|t|ƒƒ}|dk	S(s
    Return C{True} if the machine has been started by Landscape, i.e. if we can
    find the expected data inside the EC2 user-data field.
    s
/user-datatconnect_timeoutis/meta-data/ami-launch-indexN(R¤RHRR>RaR`R2(RRjRVRp((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pytis_cloud_managed½s
	


( RR™RR›ttwisted.internet.deferRtlandscape.lib.bpickleRtlandscape.lib.logRtlandscape.lib.fetchRRtlandscape.lib.tagRtlandscape.lib.networkRtlandscape.lib.vm_infoRRRHt	ExceptionRRRtobjectRR#RERaR¤R¦(((sA/usr/lib/python2.7/dist-packages/landscape/broker/registration.pyt<module>
s,
		ÿ	"	

Youez - 2016 - github.com/yon3zu
LinuXploit