MOON
Server: Apache
System: Linux vps.erhabenn.com.br 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User: sonne (1011)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyo
�
d�bc@sddlZddlZddlmZmZddljjZddljjZddl	m
Z
mZddlm
Z
ddlmZddlmZddlmZddlmZmZd	Zd
ZdZdZd
ZdZd�Zdefd��YZdS(i����N(tdatetimet	timedelta(t	add_eventtWALAEventOperation(tustr(t
get_osutil(ttextutil(t	CryptUtil(t
AGENT_NAMEtCURRENT_VERSIONs%a, %d %b %Y %H:%M:%S %Zs%Y-%m-%dsTransportPrivate.pemtJIT_AccountiicCs
t|�S(N(tRemoteAccessHandler(tprotocol((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pytget_remote_access_handler)sRcBsMeZd�Zd�Zd�Zd�Zed��Zd�Zd�Z	RS(cCs@t�|_||_ttj��|_d|_t	|_
dS(N(Rt_os_utilt	_protocolRtconftget_openssl_cmdt
_cryptUtiltNonet_remote_accesstTruet_check_existing_jit_users(tselfR((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyt__init__.s
		c
Cs�y2|jjr1|jjj�|_|j�nWnPtk
r�}djt	j
|��}ttdt
dtjdtd|�nXdS(Nu<Exception processing goal state for remote access users: {0}tversiontopt
is_successtmessage(Rtjit_enabledRtclienttget_remote_accessRt_handle_remote_accesst	ExceptiontformatRtformat_exceptionRRR	RtRemoteAccessHandlingtFalse(Rtetmsg((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pytrun5s		cs)�jj�}t�fd�|D��S(Nc3s,|]"}�j|d�r|dVqdS(iiN(t_is_jit_user(t.0tu(R(sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pys	<genexpr>Es(Rt	get_userstset(Rt	all_users((RsC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyt_get_existing_jit_usersCsc
Cs:|jdk	r�tjd�t|_|j�}td�|jjj	D��}x�|jjj	D]�}y�|j
}tj|t
�}tj�}|j|kr�||kr�|j|j|j|�nA|j|kr||krtjd|j�|j|j�nWq`tk
r:}tjd|jt|��q`Xq`Wx�|D]U}y ||krk|j|�nWqFtk
r�}tjd|t|��qFXqFWn�|jr6tjd�|j�}t}	xT|D]L}y|j|�Wq�tk
r}tjd|t|��t}	q�Xq�W|	s6t|_q6ndS(Ns-Processing remote access users in goal state.css|]}|jVqdS(N(tname(R*R+((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pys	<genexpr>Nss!Remote access user '{0}' expired.s/Error processing remote access user '{0}' - {1}s-Error removing remote access user '{0}' - {1}s)Looking for existing remote access users.(RRtloggertinfoRRR/R-t	user_listtuserst
expirationRtstrptimetREMOTE_USR_EXPIRATION_FORMATtutcnowR0t	_add_usertencrypted_passwordt_remove_userR!terrorRR%(
Rtexisting_jit_userstgoal_state_userstacctraw_expirationtaccount_expirationtnowR&tusertremove_user_errors((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyR GsF
		$
$	

cCs
|tkS(N(tREMOTE_ACCESS_ACCOUNT_COMMENT(tcomment((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyR){scCs�t}y�|tdd�jt�}tjd||�|jj||t�t	}tjd|�t
jjt
j�t�}|jj||�}|jj||t
j�t
j��|jj|�Wn*tk
r�|r�|j|�n�nXdS(Ntdaysis8Adding remote access user '{0}' with expiration date {1}s*Adding remote access user '{0}' to sudoers(R%RtstrftimetDATE_FORMATR1R2RtuseraddRERtostpathtjoinRtget_lib_dirtTRANSPORT_PRIVATE_CERTRtdecrypt_secrettchpasswdtget_password_cryptidtget_password_crypt_salt_lentconf_sudoerR!R;(RtusernameR:RAt
user_addedtexpiration_datetprv_keytpwd((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyR9s%
cCs$tjd|�|jj|�dS(Ns!Removing remote access user '{0}'(R1R2Rtdel_account(RRU((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyR;�s(
t__name__t
__module__RR(R/R tstaticmethodR)R9R;(((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyR-s				4	( RKtos.pathRRtazurelinuxagent.common.conftcommonRtazurelinuxagent.common.loggerR1tazurelinuxagent.common.eventRRtazurelinuxagent.common.futureRtazurelinuxagent.common.osutilRtazurelinuxagent.common.utilsRt&azurelinuxagent.common.utils.cryptutilRtazurelinuxagent.common.versionRR	R7RIROREtMAX_TRY_ATTEMPTtFAILED_ATTEMPT_THROTTLER
tobjectR(((sC/usr/lib/python2.7/site-packages/azurelinuxagent/ga/remoteaccess.pyt<module>s$