403Webshell
Server IP : 162.144.4.212  /  Your IP : 216.73.216.108
Web Server : Apache
System : Linux gator2125.hostgator.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64
User : cozeellc ( 2980)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /lib/python3.9/site-packages/dnf-plugins/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /lib/python3.9/site-packages/dnf-plugins/__pycache__/osmsplugin.cpython-39.pyc
a

���f�,�@s@ddlZddlZddlZddlZddlZddlZddlZddlmZddl	Zddl
mZmZddl
Z
ej�dd�ddlmZddlmZddlmZddlmZmZmZd	Zed
�Zed�Zed�Zed
�Zed�Zed�Zed�Z ed�Z!Gdd�dej"�Z#Gdd�dej$j%�Z&dd�Z'Gdd�de(�Z)dd�Z*dd�Z+dS)�N)�PRIO_PLUGINCONFIG)�_�loggerz*/usr/share/oracle-cloud-agent/plugins/osms)�actions)�config)�ustr)�
get_cacert�	get_proxy�
OsmsServerz
_osms.jsonz)OSMS based repositories will be disabled.z2There was an error communicating with OSMS server.z/This system is not registered with OSMS server.z2This system is receiving updates from OSMS server.z�For security reasons packages from OSMS based repositories can be verified only with locally installed gpg keys. GPG key '%s' has been rejected.z.Package profile information could not be sent.z/Missing required login information for OSMS: %sz9OSMS plugin has to be run under with the root privileges.csJeZdZdZ�fdd�Zdd�Zddd�Zd	d
�Zdd�Zd
d�Z	�Z
S)�
OsmsPluginZ
osmsplugincstt|��||�||_||_tj�|jjj	t
�|_d|_i|_
t�|jj�|_|�|j�|_d|j��vr�|j�d�}|D]\}}|j�||t�q|tj��s�t�t�d|j_|jjs�dS|jjdkr�d}n"|jjdkr�d}n|jjdkr�d}t|�t�d�|��dS)NF�main��INFO�DEBUG�WARNINGzinitialized OSMS plugin) �superr�__init__�base�cli�os�path�join�conf�
persistdir�STORED_CHANNELS_NAME�stored_channels_path�connected_to_osms�up2date_cfg�copy�read_config�parser�sections�items�
_set_valuer�dnf�util�	am_i_rootr�warning�MUST_BE_ROOT�enabled�
debuglevel�init_root_logger�debug�activate_channels)�selfrr�options�key�value�	log_level��	__class__��:/usr/lib/python3.9/site-packages/dnf-plugins/osmsplugin.pyr,s4


zOsmsPlugin.__init__cCs |jjsdS|jrd|jj_dS)NT)rr)r�demands�	root_user�r.r5r5r6rHszOsmsPlugin.configTc
Cs<i}d}d}d}d}d}d}|��}	|s0|	}�nDt��|_t|jdd�\}}}t|j�}|jd}zt|jjd��	�}Wn6t
y�}
zt�dt
t|
�WYd}
~
dSd}
~
00t��}|r�|s�t�dtt�|�i�dSzt|jjd�j�|�}Wn8t
�y.}
zt�dt
t|
�WYd}
~
dSd}
~
00d|_t�t�|D]$}
|
d�rDt|
���||
d	<�qD|�|�|jj}|��D]�\}}|	�|�}d}|�r�|�d�}t�|j�}||j��v�r�|j�|�}|D]\}}|�||t ��q�|jj||||j|||||j!|j"d
�}t#||�}|�$|��q�t�%|�dS)NrT)ZexternalZuseNoSSLForPackages��timeout�%s
%s
%sz%s
%s�
last_modified�label)r�proxy�proxy_username�proxy_passwordr;�	sslcacert�
force_http�cached_version�
login_info�gpgcheckr))&�_read_channels_filer�initUp2dateConfigrr	rr
rr;�login�	Exceptionr�error�COMMUNICATION_ERROR�RHN_DISABLEDZgetSystemId�NOT_REGISTERED_ERROR�_write_channels_fileZup2dateZlistChannelsr�info�UPDATES_FROM_OSMS�dictr"r�repos�getrr r!r#rrFr)�OsmsRepo�addr,)r.Z
networkingZenabled_channelsrBrCZ	proxy_urlr@rArEZcached_channels�eZ	system_id�channels�channelrSZ
channel_idZchannel_dictZcached_channelrDrr/r0r1�opts�repor5r5r6r-Nsz








�
zOsmsPlugin.activate_channelsc
Csd|jjsdS|jsdSztj|jjd�Wn4ty^}zt�dt	t
|�WYd}~n
d}~00dS)z, Update system's profile after transaction. Nr:r<)rr)rrZpackage_refresh_listr;rJrrKrL�PROFILE_NOT_SENT)r.rWr5r5r6�transaction�szOsmsPlugin.transactionc
Cs�zHt|jd��(}|��}t�|�}|Wd�WS1s<0YWnJttfy~}z|jtjkrj�WYd}~nd}~0tj	j
y�Yn0iS)N�r)�openr�read�json�loads�FileNotFoundError�IOError�errno�ENOENT�decoder�JSONDecodeError)r.�
channels_file�contentrXrWr5r5r6rG�s
(zOsmsPlugin._read_channels_filec
Cs|z@t|jd�� }tj||dd�Wd�n1s40YWn6ttfyv}z|jtjkrb�WYd}~n
d}~00dS)N�w�)�indent)r_rra�dumprcrdrerf)r.�varrirWr5r5r6rO�s2zOsmsPlugin._write_channels_file)T)�__name__�
__module__�__qualname__�namerrr-r]rGrO�
__classcell__r5r5r3r6r(s
Jrcs:eZdZgd�Z�fdd�Zdd�Zd	�fdd�	Z�ZS)
rU)zX-RHN-Server-IdzX-RHN-Auth-User-Idz
X-RHN-AuthzX-RHN-Auth-Server-TimezX-RHN-Auth-Expire-Offsetc
s�tt���t|d�|�d��t|d��_�fdd�t��D��_|�d��_	|�d��_
|�d��_|�d	��_zt
|d
��_Wn>ty�}z&t�ttj�|��g�_WYd}~n
d}~00|d|�d�kr�d
�_|�d��_d�_d�_d
�_d�_|�d��_|�d��_|�d��_�j� d��rJt�!d�j�d�_"|�d��r`��#�n��$�t%�d��r���&�}|�r���'|�dS)Nr>rrscsg|]}|d�j�qS)z	/GET-REQ/)�id)�.0�urlr9r5r6�
<listcomp>��z%OsmsRepo.__init__.<locals>.<listcomp>rBr?r@rAZgpg_key_urlr=rD�rErr;rFrCZocidz3Set module_hotfixes = True for custom repository %sTr)�set_http_headers)(rrUrrrTrsrZ
getServerlURL�baseurlrBr?r@rA�get_gpg_key_urls�gpgkey�InvalidGpgKeyLocationrr'�GPG_KEY_REJECTEDr$�i18n�ucd�metadata_expirerEZ	keepalive�	bandwidth�retries�throttler;rFrCru�
startswithr,�module_hotfixes�enable�disable�hasattr�create_http_headersr{)r.rYrZrW�http_headersr3r9r6r�s@ 
zOsmsRepo.__init__cCs�g}|jD]X}||jvr,t|}tj�|��|j|dvrJ|�d|�q
|�d||j|f�q
t��}|dr�|�d|d�|j	s�|�d�|�d�|S)N)N�z*%s: 
X-libcurl-Empty-Header-Workaround: *z%s: %sZtenantIdzX-Tenant-Id: %sz.X-RHN-Transport-Capability: follow-redirects=3zContent-Length: 0)
�needed_headersrE�MISSING_HEADERr$�Error�	RepoError�appendrrHrC)r.r��headerrKrr5r5r6r��s



zOsmsRepo.create_http_headersTcs0tt|��||�}|��}|r,|�tj|�|S)N)rrU�_handle_new_remoter�Zsetopt�librepoZLRO_HTTPHEADER)r.�destdirZmirror_setup�handler�r3r5r6r�s
zOsmsRepo._handle_new_remote)T)rprqrrr�rr�r�rtr5r5r3r6rU�s(rUcCs&|��}|D]}t|�st|��q|S)a
    Parse the key urls and validate them.

    key_url_string is a space seperated list of gpg key urls that must be
    located in /etc/pkg/rpm-gpg/.
    Return a list of strings containing the key urls.
    Raises InvalidGpgKeyLocation if any of the key urls are invalid.
    )�split�is_valid_gpg_key_urlr)Zkey_url_stringZkey_urls�key_urlr5r5r6r}s
	
r}c@seZdZdS)rN)rprqrrr5r5r5r6r!srcCsP|�d�}t|�dkrdS|\}}|��dkr2dStj�|�}|�d�sLdSdS)Nz://r
F�filez/etc/pki/rpm-gpg/T)r��len�lowerrr�normpathr�)r�Zproto_split�protorr5r5r6r�%s

r�cCs6t��}|��rdSd|_|�t���|�|�dS)Nr)�logging�	getLogger�hasHandlers�	propagate�
addHandler�NullHandler�setLevel)r2Zroot_loggerr5r5r6r+4sr+),rrerar�r�sysr$�dnf.conf.configr�dnf.exceptions�dnfpluginscorerrr�r�insertZosmsrrZ	osms.i18nrZosms.serverrr	r
rrMrLrNrQr�r\r�r(�Pluginrr[�ReporUr}rJrr�r+r5r5r5r6�<module>sB�V

Youez - 2016 - github.com/yon3zu
LinuXploit