lNCa)j d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlmZ d dl m
Z
d dlmZm
Z
dZdZd Zd
efdZded
efd
Zded
efdZded
efdZd Zd Zded
efdZd ZdS ) N)Path)ClPwd)drop_privileges)get_user_var_cagefs_path)apply_metadata_nofollow
write_via_tmpl %#Ds_ 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.pyget_jail_config_pathr s( )$//J<:???@@@
document_rootc l t }| d D ]}||z }|t z dz }|dS )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)_FNV_OFFSET_BASISencode
_FNV_PRIME)r
hash_valuechars r
get_website_idr sP #J$$W-- D Dd
:-1CC
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/