🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-08-09 16:10:34 | PHP 8.2.33
📂
/ (Root)
/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
clcagefslib
/
webisolation
/
__pycache__
📍 /opt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/__pycache__
🔄 Refresh
✏️
Editing: litespeed.cpython-311.opt-1.pyc
Read Only
� �9VjY4 � � � d Z ddlZddlZddlZ ej e� � ZdZdZdZ dZ dZdZd Z d ZdZdZd efd�Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� ZdS )a+ CLOS-4642: dedicated per-domain lsphp pools for standalone LiteSpeed (LSWS). Background ---------- On standalone LiteSpeed under cPanel, PHP runs as ONE shared lsphp pool per Linux user (the ``APVH_<user>`` external app), and LiteSpeed multiplexes every vhost of the account over it. CageFS per-website isolation masks sibling docroots with a per-website mount namespace, and a process can live in only ONE namespace at a time -- so a single shared worker cannot serve several isolated docroots correctly (addon vhosts return 500, or nothing is masked). Apache + mod_lsapi is unaffected: it already runs a per-vhost lsphp pool and passes a per-vhost DOCUMENT_ROOT, so the existing startup site-isolation constructor works there. Fix --- Make LiteSpeed run a DEDICATED lsphp pool per isolated domain so each pool enters its own website namespace: * ``DedicatePhpHandler on`` in a per-vhost cPanel *userdata* include (``/etc/apache2/conf.d/userdata/{std,ssl}/2_4/<user>/<vhost>/``). cPanel always emits a per-vhost ``Include`` for that directory, so the directive survives every ``httpd.conf`` regeneration (account/domain changes, EA4 updates). * ``DOCUMENT_ROOT=$DOC_ROOT`` in LiteSpeed's global ``<phpConfig>`` so each dedicated pool receives its own document root at spawn time; the alt-php lsphp startup constructor (CLOS-4506) then re-execs the worker into the matching website namespace. ``$DOC_ROOT`` is expanded per vhost by LiteSpeed. Every public helper here is a strict NO-OP unless the active web server is standalone LiteSpeed on a cPanel server. � Nz/usr/local/lsws/bin/lswsctrlz%/usr/local/lsws/conf/httpd_config.xmlz//usr/local/cpanel/scripts/ensure_vhost_includesz/etc/cpanel/ea4/paths.confz/var/cpanel/userdata)z$/etc/apache2/conf.d/userdata/std/2_4z$/etc/apache2/conf.d/userdata/ssl/2_4zcl_siteiso.confz9<IfModule LiteSpeed> DedicatePhpHandler on </IfModule> zDOCUMENT_ROOT=$DOC_ROOTz' <env>DOCUMENT_ROOT=$DOC_ROOT</env> �returnc �* � ddl m} n# t $ r Y dS w xY w | � � sdS t t d�� � 5 }|D ])}|� d� � rd|v c cddd� � S �* ddd� � n# 1 swxY w Y n# t $ r Y nw xY wdS ) a� True only on a cPanel server whose ACTIVE web server is standalone LiteSpeed. Apache+mod_lsapi, Plesk and DirectAdmin return False, so every helper below becomes a no-op there. Checking that lswsctrl merely exists is NOT enough: LiteSpeed can be installed but switched out for Apache. cPanel records the active server's control binary in ea4/paths.conf (bin_apachectl -> lswsctrl when LiteSpeed is active, -> apachectl when Apache is), so use that as the source of truth. r )� is_cpanelF�utf-8��encoding� bin_apachectl�lswsctrlN)�cldetectlibr �ImportError�open�EA4_PATHS_CONF� startswith�OSError)r �fh�lines �Vopt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/litespeed.py�is_litespeed_activer F sF � ��)�)�)�)�)�)�)��� � � ��u�u������9�;�;� ��u� � �.�7� 3� 3� 3� .�r�� .� .���?�?�?�3�3� .�%��-�-�-� .� .� .� .� .� .� .� .�.� .� .� .� .� .� .� .� .� .� .� .� .���� .� .� .� .��� � � � ��� �����5sL � � ��B �A7�B �)A7�+B �7A;�;B �>A;�?B � B�Bc � � |� d� � }g }t j � t | � � } t j |� � }n# t $ r |cY S w xY w|D �]}|dv s|� d� � r�t j � ||� � }t j � |� � s�] t |dd�� � 5 }|D ]u} | � d� � r^| � dd � � d � � � � d� � } | |k r|� |� � n�vd d d � � n# 1 swxY w Y ��# t $ r Y ��w xY w|S )a� Map a document root to the cPanel vhost key(s) that serve it. cPanel stores one userdata file per vhost in ``/var/cpanel/userdata/<user>`` keyed by the vhost ServerName (an addon domain ``foo.com`` is served by a vhost like ``sub.maindomain.com``). The per-vhost include directory is keyed by that same name, so resolve the key by matching ``documentroot:``. �/)�main�cache)z.cache�_SSLr �replace)r �errorsz documentroot:�:� N)�rstrip�os�path�join�CPANEL_USERDATA�listdirr �endswith�isfiler r �split�strip�append)�user� document_root�target�keys�user_dir�entries�namer r r �drs r �_vhost_keys_for_docrootr1 a s� � � � !� !�#� &� &�F� �D��w�|�|�O�T�2�2�H���*�X�&�&����� � � ���������� � ���$�$�$�� � �6H�(I�(I�$���w�|�|�H�d�+�+���w�~�~�d�#�#� �� ��d�W�Y�?�?�?� �2�� � �D�����7�7� �!�Z�Z��Q�/�/��2�8�8�:�:�A�A�#�F�F����<�<� �K�K��-�-�-��� � � � � � � � � � � � ���� � � � ��� � � � ��H� �����KsH �A �A"�!A"�E)�A9E�E)�E � E)�#E �$E)�) E7�6E7c �. � �� � �fd�t D � � S )Nc �R �� g | ]#}t j � |��� � ��$S � )r r r! )�.0�rootr) � vhost_keys ��r � <listcomp>z!_include_dirs.<locals>.<listcomp>� s+ �� �S�S�S�D�B�G�L�L��t�Y�/�/�S�S�S� )�USERDATA_INCLUDE_ROOTS)r) r7 s ``r � _include_dirsr; � s"