🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-08-09 15:07:33 | 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: jail_utils.cpython-311.opt-1.pyc
Read Only
� �9Vj� � �� � d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dl m Z d dlmZm Z dZdZd � Zd efd�Zded efd �Zdedededefd�Zded efd�Zded efd�Zd� Zd� Zded efd�Zd� ZdS )� N)�Path)�ClPwd)�drop_privileges)�get_user_var_cagefs_path)�apply_metadata_nofollow� write_via_tmpl %#D�s�_ l � c �N � t | � � }t j |� d�� � S )Nz/.cagefs/isolates.mounts)r �pathlibr )�user� cagefs_dirs �Wopt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/jail_utils.py�get_jail_config_pathr s( � �)�$�/�/�J��<�:�?�?�?�@�@�@� � document_rootc � � | � d� � pd} t }| � d� � D ]}||z }|t z dz }�|d�S )z� Generates unique id for an isolate website using FNV-1a 64-bit hash. FNV-1a has excellent avalanche properties and distribution. Must match the docroot_hash() function in jail C code. �/zutf-8l ���� �016x)�rstrip�_FNV_OFFSET_BASIS�encode� _FNV_PRIME)r � hash_value�chars r �get_website_idr sh � � "�(�(��-�-�4��M�"�J��$�$�W�-�-� D� D���d�� � �:�-�1C�C� � ����r r c � � t � � � | � � }t |� � }t t | � � � � dz }||z }|� ddd�� � |� dd�� � t t |� � ddd� � t d� � }|� d �}t |||� � t |d |j d� � |� d�}t |||� � t |ddd� � d S )z� Create website token directory structure and files in /var/cagefs. Creates: - /var/cagefs/<user>/.cagefs/website/<website_id>/ - token directory �.cagefs/websiteTi� )�exist_ok�parents�modei� )r r r � z/.cagefs.token� z/.cagefs.websitei$ N)r �get_pw_by_namer r r �mkdirr �str�_generate_passwordr �pw_uid) r r �pw� website_id�website_base_dir�website_dir�token�token_file_path�docroot_file_paths r �create_website_token_directoryr. 0 s+ � � ��� � �� %� %�B�� �.�.�J� �4�T�:�:�;�;�>O�O��"�Z�/�K� ���D�$�U��C�C�C����t�%��0�0�0� �C��,�,�e�Q��:�:�:��r�"�"�E� %�4�4�4�O��+���6�6�6��O�U�B�I�q�A�A�A� '�8�8�8���+�0�-�@�@�@� �-�u�a��;�;�;�;�;r � parent_fd�namer �returnc �� � t j ||| �� � n# t $ r Y nw xY wt j |t j t j z t j z t j z | �� � S )u� Create or open ``name`` under ``parent_fd`` rejecting any symlink. mkdirat(name, parent_fd) followed by openat(name, parent_fd, O_NOFOLLOW | O_DIRECTORY) — the open raises ELOOP if the path was pre-planted as a symlink and ENOTDIR if it is a non-directory inode. EEXIST on the mkdir is benign (idempotent re-run); other errors propagate. Returns an fd opened on the real directory inode that the caller is responsible for closing. )r �dir_fd)r3 )�osr# �FileExistsError�open�O_RDONLY� O_NOFOLLOW�O_DIRECTORY� O_CLOEXEC)r/ r0 r s r �_mkdir_nofollow_underr; _ sz � � � ���D��3�3�3�3�3��� � � ��� ���� �7�� ��b�m�#�b�n�4�r�|�C��� � � s � � '�'c �& � t � � � | � � }t |j � � � � � sdS t j |j t j t j z t j z � � } t | � � 5 t |dd� � } t |dd� � } t |t |� � d� � }t j |� � t j |� � n# t j |� � w xY w t j |� � n# t j |� � w xY w ddd� � n# 1 swxY w Y t j |� � dS # t j |� � w xY w)z� Create overlay storage directory in user's home. Creates: - <homedir>/.cagefs/websites/<website_id>/ - storage base for overlays Drops privileges to user before creating to ensure proper ownership. N�.cagefsi� �websites)r r"