File manager - Edit - /opt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/__pycache__/libenter.cpython-311.opt-1.pyc
Back
� ��i� � �v � d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z ddl mZmZ de d ee d efd�ZdS )zBLibrary functions for executing commands inside CageFS for a site.� N)�Path)�List)�cpapi� )�get_website_id�get_user_var_cagefs_path�site�command�returnc �$ � | }|� d� � sG t j | � � d }n+# t j j $ r t d| � d�� � �w xY wt j � |� � st d|� d�� � �t |� � }t d� � }|� � � rY|d|� d �z }|� � � st d | � d�� � �t j dg|�i t j �d |i��� � S t t t j t j � � � � j � � � � }|d|� d �z }t j dg|�i t j �d |i��� � S )at Execute a command inside CageFS for a site (document root or domain). User only! Inside cagefs only! :site: Document root or domain name :command: Command and arguments to execute Returns: int: Exit code from the executed command Raises: ValueError: If site cannot be resolved or isolation is not configured �/r zDomain z not foundzDocument root z does not existz /var/.cagefs/zwebsite/z/.cagefs.tokenzWebsite z& not found or isolation is not enabledz/bin/cagefs_enter.proxied�WEBSITE_TOKEN_PATH)�envz.cagefs/website/z/bin/cagefs_enter)� startswithr �docroot�cpapiexceptions�NoDomain� ValueError�os�path�existsr r � subprocess�call�environr �pwd�getpwuid�getuid�pw_name)r r � document_root�docroot_md5�inside_cagefs_path�website_token_path� jail_paths ��/builddir/build/BUILDROOT/cagefs-7.6.29-2.el8.cloudlinux.x86_64/opt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/libenter.py� enter_siter% s� � �"