HEX
Server: Apache
System: Linux vps.rockyroadprinting.net 4.18.0 #1 SMP Mon Sep 30 15:36:27 MSK 2024 x86_64
User: rockyroadprintin (1011)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/share/lve/modlscapi/user/__pycache__/lve_diagnostic.cpython-36.pyc
3

��h�5�@s�ddlZddlmZdd�ZGdd�d�ZGdd�d�Zd	d
�Zdd�ZGd
d�d�ZGdd�d�Z	Gdd�de	�Z
Gdd�de	�ZGdd�de	�ZGdd�de	�Z
Gdd�de	�ZGdd�de	�ZGdd�de	�Zdd �Zd!d"�Zd#d$�ZdS)%�N)�versioncCstj|�}|j�S)N)�os�popen�read)�strZhandle�r�//usr/share/lve/modlscapi/user/lve_diagnostic.py�myExecs
r	c@s(eZdZdZdZdZdZdZdd�ZdS)�	LiteSpeedF�UnknowncCs^tjjd�|_tjjd�rZttd�jd��dkrZd|_dtd�k|_d	td
�k|_td�}dS)Nz/usr/local/lswsz/usr/local/lsws/bin/litespeedzps aux|grep litespeed�
�T�1z4grep enableLVE /usr/local/lsws/conf/httpd_config.xml�0z$grep -i phpSuexec\> httpd_config.xmlz%file -L /usr/local/lsws/bin/litespeed)	r�path�isfile�exist�lenr	�split�lve�suexec)�selfZarchrrr�__init__s"zLiteSpeed.__init__N)	�__name__�
__module__�__qualname__rrrrZcorrectArchrrrrrr
sr
c@steZdZdZdZdZdZdZdZdZ	dZ
dZdZdZ
dZdZdZdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�ZdS)�
ApacheInfoFrcCs|j|�dS)N)�detect)rrrrrr8szApacheInfo.__init__cCs2tj|j�tjd�krdStdd|jj�dSdS)Nz2.2.0Ti�z=Unable to determine list of loaded modules, apache version %sF)r�LooseVersion�
print_warning�apache)rrrr�
check_version;szApacheInfo.check_versioncCst|jjd|d�dk�S)N� �_moduler
���)r�modules�find)r�namerrr�isModuleBszApacheInfo.isModulecCsv|jrr|jd�|_|jd�|_|jd�|_|jd�|_|jd�|_|jd�|_|jd�|_|jd�|_	|jd	�|_
dS)
N�
hostinglimits�fcgidZphp5�cgi�cgid�suPHP�fastcgi�disable_suexecr)�
moduleInfor(r)r*�php_dsor+r,r-r.r/r)rrrr�parseModulesEszApacheInfo.parseModulescCsHtjj|�|_|j�rDt|d�}|jd�dkr�d}x.|jd�D] }|jd�dkr@|jdd�}Pq@W|dk	r�td|d|d	�t|d�}|dk	r�td|d
|�|jd�}xX|D]P}|jd�dkr�||jd�d
d�|_|jd�dkr�||j	d�d
d�|_
q�Wtj|j�tjd�k�rDd|_t|d�|_
|j�dS)Nz -V 2>&1zSyntax errorrr"z
lsapi.conf�:�zmv z.SAVEz.SAVE rzServer version:r
�/zServer MPM:z2.2Tz -M 2>&1r$r$)rrrrr	r&r�replacer�rfind�mpmrr0r%r2)rr�tmpZ
lsapi_conf�s�lines�linerrrrQs0

zApacheInfo.detectcCs�|jrxd|jd|jd|jd|jd|jd|jd|jd|jd	|j	d
|j
d|j}|SdSdS)NzApache verion: z, mpm=z, hostinglimits=z, cgi=z, cgid=z, fcgi=z
, fastcgi=z
, php DSO=z, suphp=z	, suexec=z, disable_suexec=)rrr8r)r+r,r*r.r1r-rr/)rrrrrrksnzApacheInfo.strN)rrrrrr8r)r*r+r1r,r-r.r/rr0r%rr!r(r2rrrrrrr(s(rcCs$td|�t||�td|�dS)NzCODE: z
Solution: )�print)�code�	error_str�
error_listZsolutionrrr�print_errorzs
rAcCstd|�t||�dS)Nz	WARNING: )r=)r>r?r@rrrr�s
rc@s4eZdZdZdZdZdZdd�Zdd�Zdd�Z	dS)	�KernelNFcCs^td�jd�|_|jjd�|_|jdkrN|j|jdd�|_tjjd�|_	nd|jk|_
dS)	Nz
/bin/uname -rrrr
�z/proc/lve/listZstabr$)r	�rstrip�
kernelNamer&�isLVEKernelrrrr�isLVEEnabled�
isVZKernel)rrrrr�s
zKernel.__init__cCs�|jr�|jr�tj|j�tjd�kr&dStj|j�tjd�krNtdd|jd�q�tj|j�tjd�krvtdd	|jd�q�td
d|jd�q�tdd
fd�n&|jr�tddfd�ntdd|jd�dS)Nz0.8.28Tz0.8.0i�z*You are running bugy kernel LVE version %szUpgrade Kernelz0.7.0i�zoYou are running old kernel LVE version %s
 That version doesn't support multiple cores per LVE or memory limitsi�z5You are running very old, bugy kernel, LVE version %si�zLVE is not enabledzACheck /etc/sysconfig/lve file, and make sure lve rpm is installediMzYou are running VZ or OpenVZzWCloudLinux is not compatible, see http://www.cloudlinux.com/vz-compat.php for more infoi�z9You are not running CloudLinux kernel. Your kernel is: %szCheck /boot/grub/grub.conf)rGrrrArH)rrrr�check�s$
zKernel.checkcCsNd}|jr|d|jd7}n,|jr8|d|jd7}n|d|jd7}|S)NzKernel: zOK (�)zVZ (z	Unknown ()rGrrHrE)r�resultrrrr�sz
Kernel.str)
rrrrrFrHrGrrIrrrrrrB�s	rBc@s8eZdZdZdZdZdd�Zdd�Zdd	�Zd
d�Z	dS)�CPz
Unknown CPrNcCstd�|_d|_t�|_dS)Nz/usr/sbin/apachectlz
/etc/httpd)rr �apache_pathrB�kernel)rrrrr�s
zCP.__init__cCs|jd|jd|jj�S)Nr")r'rrNr)rrrrr�szCP.strcCs|jS)N)r')rrrr�__str__�sz
CP.__str__cCs|jj�dS)N)rNrI)rrrrrI�szCP.check)
rrrr'rrNrrrOrIrrrrrL�srLcs(eZdZdZ�fdd�Zdd�Z�ZS)�CPanel�cPanelcsLtt|�j�td�|_td�|_tjj	d�r<d|_
d|_nd|_
d|_dS)Nz/usr/local/cpanel/cpanel -Vz/usr/local/bin/apachectlz/etc/cpanel/ea4/is_ea4ZEA4z/etc/apache2ZEA3z/usr/local/apache)�superrPrr	rrr rr�exists�earM)r)�	__class__rrr�s

zCPanel.__init__cCs|jS)N)rT)rrrrrO�szCPanel.__str__)rrrr'rrO�
__classcell__rr)rUrrP�srPcs eZdZdZ�fdd�Z�ZS)�Pleskcs4tt|�j�td�}|jd�d|_td�|_dS)Nz/bin/cat /usr/local/psa/versionr"rz/usr/sbin/apachectl)rRrWrr	rrrr )rr9)rUrrr�szPlesk.__init__)rrrr'rrVrr)rUrrW�srWcs eZdZdZ�fdd�Z�ZS)�DirectAdmincsftt|�j�td�}|jd�}d|_td�|_x0|D](}|jd�dkr6|jd�dj	�|_Pq6WdS)	Nz1/usr/local/directadmin/custombuild/build versionsrrz/usr/sbin/apachectlz!Installed version of DirectAdmin:r
r3r$)
rRrXrr	rrrr r&�strip)rr9�item)rUrrr�s


zDirectAdmin.__init__)rrrr'rrVrr)rUrrX�srXcs(eZdZdZ�fdd�Zdd�Z�ZS)�HSpherezH-Spherecs8tt|�j�td�}|jd�dj�|_|j�|_dS)NzA/bin/cat /hsphere/local/home/cpanel/shiva/psoft_config/HS_VERSIONrr
)	rRr[rr	rrYr�get_apache_typer )rr9)rUrrr�szHSphere.__init__cCs~tjjd�rvtd�}|j�}|j�xP|D]H}|jd�dj�}|jd�dj�}|dkr*|dkrjtd�Std�Sq*Wtd	�S)
Nz#/hsphere/shared/scripts/scripts.cfg�=rr
Zapache_versionrz /hsphere/shared/apache/bin/httpdz%/hsphere/shared/apache2/bin/apachectlr4)	rrr�open�	readlines�closerrYr)r�fr;rZ�key�valuerrrr\�s
zHSphere.get_apache_type)rrrr'rr\rVrr)rUrr[�sr[cs(eZdZdZ�fdd�Zdd�Z�ZS)�iWorx�	InterWorxcs,tt|�j�d|_|j�|_td�|_dS)Nz/usr/local/interworx/iworx.iniz/usr/sbin/apachectl)rRrdr�ini_file�find_versionrrr )r)rUrrrs
ziWorx.__init__cCsjyPt|jd��}|j�}WdQRX|jd�djdd�jdd�jdd�jd�d	Stk
rddSXdS)
N�rr�rr4r]�"�[r)r^rfrrr6�	Exception)rZini_info�outrrrrgs0ziWorx.find_version)rrrr'rrgrVrr)rUrrd
srdcs eZdZdZ�fdd�Z�ZS)�ISPMgr�
ISPManagercs"tt|�j�d|_td�|_dS)NZunkz/usr/sbin/apachectl)rRrnrrrr )r)rUrrrszISPMgr.__init__)rrrr'rrVrr)rUrrnsrncs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�CustomPanelcs&tt|�j�|j�d|_d|_dS)Nz /usr/share/lve/modlscapi/custom/)rRrpr�
config_reader�root_dirr )r)rUrrr%szCustomPanel.__init__cCs�ddl}|j�}|j|jd�|d}|j|�|jd�|_|jd�|_|jd�|_|jd�|_	|jd	�|_
|jr�t|j�|_dS)
z�Read all configurations related to Custom Panel from config.ini in the 'root_dir' folder.
        config.ini file must include GLOBAL section.
        rNz
config.iniZGLOBAL�VERSIONZAPACHECTL_BIN_LOCATIONZDOC_URLZEXECUTABLE_BINZ
PANEL_NAME)
�configparser�ConfigParserrrr�check_config_ini�getrZ	apachectl�doc_url�
executable�
panel_namerr )rrt�config�	cp_configrrrrq+s
zCustomPanel.config_readercCsVdddddg}g}x$|D]}|j|�dkr|j|�qW|rRtd|���td�dS)NrZapachectl_bin_locationrxZexecutable_binrzz&Config file is missing required keys: r
)rw�appendr=�exit)rr|Z
required_keysZmissing_keysrbrrrrv>s
zCustomPanel.check_config_ini)rrrr'rrqrvrVrr)rUrrp#srpcCs�tjjd�rtStjjd�r tStjjd�r<tjjd�r<tStjjd�rLtStjjd�r\tStjjd�rlt	Stjjd�r|t
StS)	Nz/usr/local/cpanel/cpanelz/usr/local/psa/versionz/usr/local/directadminz(/usr/local/directadmin/custombuild/buildz8/hsphere/local/home/cpanel/shiva/psoft_config/HS_VERSIONz/usr/local/ispmgrz/usr/local/interworx/iworx.iniz*/usr/share/lve/modlscapi/custom/config.ini)rrrrPrW�isdirrXr[rnrdrprLrrrr�
_get_cp_classLsr�cCst�jS)a�
    Call this when you only need to detect Control Panel type, and don't need its complete properties.

    The function avoids creating an instance of CP successor class.
    This is safer for calling from installation scriptlets, when the system state can be inconsistent -
    because instance initialization tries to collect much more info than _get_cp_class().
    For example, 'apachectl' utility, used to gather server attributes into 'apache' instance variable,
    can fail half-way 'mod_lsapi' post-installation. Specifically:
    when the upgrade brings a non-backward compatible change of 'mod_lsapi.so'<->'liblscapi.so' binary interface,
    at the moment when we have 'liblscapi.so' already updated,
    but the new 'mod_lsapi.so' not yet copied into the Apache modules directory,
    'apachectl' would fail due to unloadable modules, print errors instead of Apache properties,
    and eventually produce installation failure.
    See CLOS-3184.
    )r�r'rrrr�get_cp_name]sr�cCst��S)z�
    Call this when you want full Control Panel properties, not only its type.

    Properties can fail to be obtained, or be invalid, in intermediate machine state, like half-installed 'mod_lsapi'.
    See CLOS-3184.
    )r�rrrr�get_cposr�)rZ	distutilsrr	r
rrArrBrLrPrWrXr[rdrnrpr�r�r�rrrr�<module>s$R1	)