PHP 8.2.30
Preview: mount_config.py Size: 1.38 KB
//proc/thread-self/root/opt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/mount_config.py

#!/opt/cloudlinux/venv/bin/python3 -sbb
# -*- coding: utf-8 -*-
#
# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2021 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENCE.TXT
#
"""
Mount configuration builder for website isolation.

The code handles all standard behavior (docroot isolation, home overlay, etc).
"""

import os.path
from dataclasses import dataclass, field

from .jail_config import MountEntry


@dataclass
class IsolatedRootConfig:
    """
    Configuration for a directory overlay.

    Closes access to a directory by mounting a fake/empty directory over it,
    then selectively exposing only whitelisted paths.

    Storage is computed as: {storage_base}/{name}
    """

    # Path to the root of this storage (e.g. ~/.clcagefs/website/123/home)
    root_path: str

    # Real directory to close
    target: str

    # Use temporary tmpfs for storage (default: real directory)
    persistent: bool = True

    # List of mounts made inside of this root (dynamically)
    mounts: list[MountEntry] = field(default_factory=list)

    def mount(self, type_, source, target, opts: tuple = tuple()):
        """Mounts whatever asked into the root of isolated storage"""
        relative_path = os.path.relpath(target, self.target)
        self.mounts.append(MountEntry(type_, source, f"{self.root_path}/{relative_path}", opts))

Directory Contents

Dirs: 2 × Files: 13

Name Size Perms Modified Actions
crontab DIR
- drwxr-xr-x 2026-04-09 07:00:57
Edit Download
- drwxr-xr-x 2026-04-09 07:00:57
Edit Download
3.07 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
1.74 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
2.72 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
6.21 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
4.93 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
2.23 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
1.38 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
4.96 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
1.26 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
3.39 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
1.76 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
1.90 KB lrw-r--r-- 2026-03-24 09:59:14
Edit Download
248 B lrw-r--r-- 2026-03-24 09:59:14
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).