REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 1.74 KB
Close
/proc/self/root/opt/cloudlinux/venv/lib/python3.11/site-packages/clcagefslib/webisolation/config.py
Text
Base64
# -*- 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 # import dataclasses import json import os import pathlib from pathlib import Path from clcommon import ClPwd from clcagefslib.io import write_via_tmp DOCROOTS_ISOLATED_BASE = Path("/var/clwebisolate/users") @dataclasses.dataclass class UserConfig: enabled_websites: list[str] = dataclasses.field(default_factory=list) def load_user_config(user: str) -> UserConfig: path = _get_user_config_path(user) if not path.exists(): return UserConfig() try: return UserConfig(**json.loads(path.read_text())) except json.JSONDecodeError: return UserConfig() def save_user_config(user: str, config: UserConfig | None) -> None: path = _get_user_config_path(user) if not config or not config.enabled_websites: path.unlink(missing_ok=True) return path.parent.mkdir(parents=True, exist_ok=True) write_via_tmp(str(path.parent), str(path), json.dumps(dataclasses.asdict(config), indent=4)) # Set ownership and permissions so user can read their config (but not write) # root:user_group with 0o640 = owner (root) can read/write, group (user_group) can read only # User can read via group membership but cannot write because group has no write permission pw = ClPwd().get_pw_by_name(user) os.chown(path, os.getuid(), pw.pw_gid) # root:user_group os.chmod(path, 0o640) # rw-r----- def _get_user_config_path(user: str) -> pathlib.Path: pw = ClPwd().get_pw_by_name(user) directory = DOCROOTS_ISOLATED_BASE / str(pw.pw_uid) return Path(directory / f"{pw.pw_uid}.json")
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 2 × Files: 13
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
crontab
DIR
-
drwxr-xr-x
2026-04-09 07:00:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__pycache__
DIR
-
drwxr-xr-x
2026-04-09 07:00:57
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
admin_config.py
3.07 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
config.py
1.74 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
jail_config.py
2.72 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
jail_config_builder.py
6.21 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
jail_utils.py
4.93 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
libenter.py
2.23 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
mount_config.py
1.38 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
mount_ordering.py
4.96 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
mount_types.py
1.26 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
php.py
3.39 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
service.py
1.76 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
triggers.py
1.90 KB
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__init__.py
248 B
lrw-r--r--
2026-03-24 09:59:14
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).