#6@'vdZddlZddlZddlZddlmZddlmZddlm Z ddl m Z m Z de d ee d efd ZdS) zBLibrary functions for executing commands inside CageFS for a site.N)Path)List)cpapi)get_website_idget_user_var_cagefs_pathsitecommandreturncr|}|dsG tj|d}n+#tjj$rt d|dwxYwt j|st d|dt|}td}|rY|d|d z }|st d |d tj d g|it j d |iStttjt jj}|d|d z }|st d |d tj dg|it j d |iS)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 /rzDomain 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.proxiedWEBSITE_TOKEN_PATH)envz.cagefs/website/z/bin/cagefs_enter) startswithrdocrootcpapiexceptionsNoDomain ValueErrorospathexistsrr subprocesscallenvironrpwdgetpwuidgetuidpw_name)r r document_root docroot_md5inside_cagefs_pathwebsite_token_path jail_paths Uopt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/libenter.py enter_siter%s"M  # #C ( (9 9!M$//2MM$- 9 9 97t77788 8 9 7>>- ( (JH-HHHIII //Ko..  "" /2X[2X2X2XX!((** VTTTTUU U ( 37 3H2:H35GHH    1#,ry{{2K2K2STTUU &)WK)W)W)WW!((** VTTTTUU U +7 +H2:H35GHH    s 4(A)__doc__rrrpathlibrtypingrclcommonr jail_utilsrrstrintr%r$r/sIH @@@@@@@@3 S3 493 3 3 3 3 3 3 r.