HEX
Server: LiteSpeed
System: Linux cpir1.prohostdns.com 4.18.0-553.123.2.lve.el8.x86_64 #1 SMP Thu May 7 23:17:13 UTC 2026 x86_64
User: pelakir (2976)
PHP: 8.2.31
Disabled: exec, shell_exec, system, passthru, proc_open, proc_close, proc_terminate, proc_get_status, popen, pclose, pcntl_exec
Upload Files
File: //proc/self/root/lib/python3.6/site-packages/up2date_client/__pycache__/rhnreg.cpython-36.pyc
3

/V)j�.�@s�ddlZddlZddlZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddl
mZdd	lm
Z
mZy4ddlZddlZdd
lmZmZmZmZmZmZWnDek
r�ddljZddljZeZeZeZe Ze!Ze!Ze"Z#YnXddl$Z$e$j%ddd
�Z&e'e&d��s e&j$e&_(e&j(Z)dZ*dZ+ddddd�Z,dd�e,j-�D�Z.ddlm/Z/e/j0�Z1ej2�Z3dd�Z4dd�Z5dd�Z6e e7d�d d!�Z8e7d"�d#d$�Z9d6d&d'�Z:d7e7d(�d)d*�Z;d+d,�Z<e d-�d.d/�Z=d8d0d1�Z>d2d3�Z?d4d5�Z@dS)9�N)�up2dateUtils)�
up2dateErrors)�up2dateAuth)�	rhnserver)�
up2dateLog)�
statistics)�getPlatform)�ustr�sstr)�ListType�	TupleType�
StringType�UnicodeType�DictType�DictionaryTypezrhn-client-toolsT)Zfallback�ugettextz/etc/sysconfig/rhnz/etc/sysconfig/rhn/jwt.tokenZ
shared_pro�shared�solo�admin)zCloudLinux OS Shared ProzCloudLinux OS SharedzCloudLinux OS SolozCloudLinux OS AdmincCsi|]\}}||�qS�r)�.0�k�vrr�/usr/lib/python3.6/rhnreg.py�
<dictcomp>5sr)�configcCstjtdtj�S)N�systemIdPath)�os�access�cfg�R_OKrrrr�
registered=sr!cCs�tjj|�}tj|tj�sdStjj|�rJytj||d�Wn
dStj|tjtj	Btj
BtjBtjBd�}ytj
|d�}Wn tk
r�tj|��YnXz|jt|��Wd|j�XdS)z; Write a file to disk that is not readable by other users. Fz.savei��wNT)r�path�dirnamer�W_OK�lexists�rename�open�O_WRONLY�O_CREAT�
O_NOFOLLOW�O_EXCL�	O_CLOEXEC�fdopen�	Exception�close�writer
)Zsecure_fileZ
file_contentsZdir_name�fdZfd_filerrr�_write_secure_file@s*

r3cCsttd|�}|S)Nr)r3r)�systemId�resrrr�
writeSystemIddsr6)�token�allowTransitioncCszddl}ddl}|jjd�s dSddg}|r6|jd�|j||jd�}|j|j�d�\}}|j	dkrvt
jd	||f�dS)
zH
    Execute binary file which we use as hook for jwt token updates
    rNz /opt/cloudlinux/venv/bin/python3z/usr/sbin/cl-pre-jwt-updatez--new-token-stdinz--allow-transition)�stdin)�inputz7Pre jwt update hook failed with stdout=%s and stderr=%s)�
subprocessrr#�exists�append�Popen�PIPE�communicate�encode�
returncode�log�log_me)r7r8r;r�cmd�p�stdout�stderrrrr�_execute_pre_jwt_update_hookis

rI)r8cCsjddl}ddl}|jjd�s dSdg}|r4|jd�|j|�}|j�\}}|jdkrftj	d||f�dS)zH
    Execute binary file which we use as hook for jwt token updates
    rNz /opt/cloudlinux/venv/bin/python3z/usr/sbin/cl-post-jwt-updatez--allow-transitionz8Post jwt update hook failed with stdout=%s and stderr=%s)
r;rr#r<r=r>r@rBrCrD)r8r;rrErFrGrHrrr�_execute_post_jwt_update_hook|s


rJFcCs�tj�}y|jj|�}WnFtjk
r.dStjtjtjtj	fk
r^t
jtj
��dSXt|t�s�t|�dks�tjd|�r�t|ttf�r�t|�nd}t
jdt|�j|f�dSt||�tt|�t|�dS)z�
    Get a JWT token from CLN and save it to the file
    :param systemId: content of file `/etc/sysconfig/rhn/systemid`
    :return: None
    Ni@z2\A[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\Zzn/azIInvalid JWT token received from server (type=%s, len=%s), skipping update)rZ	RhnServerZup2dateZgetJWTTokenr�UnknownMethodExceptionZAuthenticationTicketErrorZRhnUuidUniquenessError�CommunicationErrorZ$AuthenticationOrAccountCreationErrorrCZ
log_exception�sys�exc_info�
isinstance�str�len�re�match�bytesrD�type�__name__rIr3�	JWT_TOKENrJ)r4r8Z
xmlrpm_server�resultZ
result_lenrrr�getAndWriteJWTTokenToFile�s*

rY)�human_readablec	CsFd}tjj|�sdSt|�� }|j�jd�}|r4|St|SQRXdS)Nz/opt/cloudlinux/cl_editionr�
)rr#r<r(�read�strip�_human_readable_to_product)rZZedition_cache_file�fZraw_editionrrr�getServerEdition�s
r`cCsVyt|�}WnPtjk
rH}ztd|j�tjd�WYdd}~Xntjk
r\dSXt�}|d}||krxdS|r�tdj	t
|t
|d��td�tjd�|�sRtjj�s�td�td�t
|�dt
|�d	�}d
dd�}|j
|�}	|	dk	�rJtj�}
|
|	k�r6td||�d
|
�d��tjd�n|�d||�d�}t|�dS)Nz%s��editionz�WARNING: Automatic registration in yum transactions is only available when edition matches the provided license. Your current edition is {current_edition} and your license is {new_edition}.)Zcurrent_editionZnew_editionz0Run clnreg_ks manually to complete registration.aError: interactive input required for edition migration, but tool is running in non-interactive mode. Please try running the tool again in interactive shell or add `--migrate-silently` flag to accept allquestions and perform the edition migration silently.za edition installed on your server does not match license you are trying to register server with: zh. Migration is required. You may lose access to the services which are not supported by the new edition.�)rrz@The license you are trying to register with allows a maximum of z% hosting accounts which is less than z) users detected on this server. Aborting.zG Also, the license you are trying to register with allows a maximum of zM hosting accounts. Make sure that your system complies with this requirement.)�checkKeyrrL�print�errmsgrM�exitrKr`�format�_product_to_human_readabler9�isatty�getrZcount_server_users�_askConfirmation)�
activationKeyZ
strictEditionZsilentMigrationZlicenseInformation�eZcurrentEditionZlicenseEdition�messageZedition_to_users_limitZlicense_users_limitZusers_on_serverrrr�checkLicenseKey�sB




rp)�confirmationMessagecCs2t|�td�}|j�dkr.td�tjd�dS)zS
    Prints message and makes sure that client is ready for edition migration.
    z Do you want to continue? [N/y]: �yzAborted.raN)rer:�lowerrMrg)rqZresponserrrrls
rlcCs�|dkr|dkstd��|tj�tj�tj�d�}tj�}|dk	rJ||d<|rlx|j�D]\}}	|	||<qXW|rz||d<n||d<||d<|dk	r�||d<n(tj	j
d	�r�d
ntj	j
d�r�dnd
|d<tj�}
|
j
j|�}|S)ziWrapper for the old xmlrpc to register a system. Activates subscriptions
    if a reg num is given.

    Nz)username and password usage is deprecated)Zprofile_nameZ
os_releaseZrelease_nameZarchitectureZ	system_idr7�username�passwordrbz/etc/cloudlinux-edition-solorz/etc/cloudlinux-edition-adminrr)�AssertionErrorrZ
getVersionZgetOSReleaseZgetArchrZgetSystemId�itemsrr#r<r�RegistrationRhnServer�registrationZ
new_system)rtruZprofileNamer7�otherrbZ	auth_dictZ
system_id_xml�key�item�s�retrrr�registerSystem
s.

rcCstj�}|jj|�}|S)zG
    Check the activation key and return it's edition and customer
    )rrxryZ
license_check)rmr}r~rrrrd9srdcGs�g}x�|D]�}t|�}|tkr(t|�}nZ|tkrDtdd�|D��}n>|tkr\dd�|D�}n&|tksl|tkr�tdd�|j	�D��}|j
|�q
Wt|�dkr�|dSt|�SdS)	u� All the data we gathered from dmi, bios, gudev are in utf-8,
            we need to convert characters beyond ord(127) - e.g ® to unicode.
        css|]}t|�VqdS)N)�_encode_characters)r�irrr�	<genexpr>Nsz%_encode_characters.<locals>.<genexpr>cSsg|]}t|��qSr)r�)rr�rrr�
<listcomp>Psz&_encode_characters.<locals>.<listcomp>cSsg|]\}}t||��qSr)r�)r�name�valrrrr�RsrarN)rUr
r	r�tuplerrr�dictrwr=rQ)�argsrXr|Z	item_typerrrr�Ds

r�)F)F)NNNNNN)ArrRrMZup2date_clientrrrrrrZup2date_client.pkgplatformrZrhn.i18nr	r
ZurlparseZ	xmlrpclib�typesrrr
rrr�ImportErrorZurllib.parse�parseZ
xmlrpc.clientZclient�listr�rTrPr��intZlong�gettextZtranslation�t�hasattrr�_Z	SYSID_DIRrWr^rwrirZinitUp2dateConfigrZinitLogrCr!r3r6�boolrIrJrYr`rprlrrdr�rrrr�<module>	sl$


$
%>
*