#6@' v d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z ddl
mZmZ de
d ee
d
efdZdS )zBLibrary functions for executing commands inside CageFS for a site. N)Path)List)cpapi )get_website_idget_user_var_cagefs_pathsitecommandreturnc r | }| 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 }| st d
| d 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.proxiedWEBSITE_TOKEN_PATH)envz.cagefs/website/z/bin/cagefs_enter)
startswithr docrootcpapiexceptionsNoDomain
ValueErrorospathexistsr r
subprocesscallenvironr pwdgetpwuidgetuidpw_name)r r
document_rootdocroot_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 97t777888 9 7>>-(( JH-HHHIII //Ko.. ""
/2X[2X2X2XX!((** VTTTTUUU
(373H2:H35GHH
1#,ry{{2K2K2STTUU &)WK)W)W)WW!((** VTTTTUUU
+7+H2:H35GHH
s 4 (A)__doc__r r r pathlibr typingr clcommonr
jail_utilsr r strintr% r$