/opt/cloudlinux/venv/lib/python3.11/site-packages
NameSizeModeActions
aiohttp/-0755rm
aiohttp-3.9.2.dist-info/-0755rm
aiosignal/-0755rm
aiosignal-1.3.1.dist-info/-0755rm
alembic/-0755rm
alembic-1.11.1.dist-info/-0755rm
astroid/-0755rm
astroid-2.15.6.dist-info/-0755rm
async_timeout/-0755rm
async_timeout-4.0.3.dist-info/-0755rm
attr/-0755rm
attrs/-0755rm
attrs-23.1.0.dist-info/-0755rm
certifi/-0755rm
certifi-2023.5.7.dist-info/-0755rm
chardet/-0755rm
chardet-5.2.0.dist-info/-0755rm
charset_normalizer/-0755rm
charset_normalizer-2.1.1.dist-info/-0755rm
clcagefslib/-0755rm
clcommon/-0755rm
clconfig/-0755rm
clconfigure/-0755rm
cldashboard/-0755rm
clevents/-0755rm
clflags/-0755rm
cllicense/-0755rm
cllimits/-0755rm
cllimitslib_v2/-0755rm
cllimits_validator/-0755rm
cllvectl/-0755rm
clpackages/-0755rm
clquota/-0755rm
clselect/-0755rm
clselector/-0755rm
clsentry/-0755rm
clsummary/-0755rm
clveconfig/-0755rm
clwizard/-0755rm
clwpos/-0755rm
cl_dom_collector/-0755rm
colorama/-0755rm
colorama-0.4.6.dist-info/-0755rm
contextlib2/-0755rm
contextlib2-21.6.0.dist-info/-0755rm
coverage/-0755rm
coverage-7.2.7.dist-info/-0755rm
Cython/-0755rm
Cython-0.29.35.dist-info/-0755rm
ddt-1.6.0.dist-info/-0755rm
dill/-0755rm
dill-0.3.6.dist-info/-0755rm
distlib/-0755rm
distlib-0.3.8.dist-info/-0755rm
docopt-0.6.2.dist-info/-0755rm
dodgy/-0755rm
dodgy-0.2.1.dist-info/-0755rm
filelock/-0755rm
filelock-3.13.1.dist-info/-0755rm
flake8/-0755rm
flake8-5.0.4.dist-info/-0755rm
flake8_polyfill/-0755rm
flake8_polyfill-1.0.2.dist-info/-0755rm
frozenlist/-0755rm
frozenlist-1.4.0.dist-info/-0755rm
future/-0755rm
future-0.18.3.dist-info/-0755rm
git/-0755rm
gitdb/-0755rm
gitdb-4.0.10.dist-info/-0755rm
GitPython-3.1.32.dist-info/-0755rm
guppy/-0755rm
guppy3-3.1.3.dist-info/-0755rm
idna/-0755rm
idna-3.4.dist-info/-0755rm
iniconfig/-0755rm
iniconfig-2.0.0.dist-info/-0755rm
isort/-0755rm
isort-5.12.0.dist-info/-0755rm
jinja2/-0755rm
Jinja2-3.1.2.dist-info/-0755rm
jsonschema/-0755rm
jsonschema-3.2.0.dist-info/-0755rm
jwt/-0755rm
lazy_object_proxy/-0755rm
lazy_object_proxy-1.9.0.dist-info/-0755rm
libfuturize/-0755rm
libpasteurize/-0755rm
lvemanager/-0755rm
lvestats/-0755rm
lve_stats-2.0.dist-info/-0755rm
lve_utils/-0755rm
lxml/-0755rm
lxml-4.9.2.dist-info/-0755rm
mako/-0755rm
Mako-1.2.4.dist-info/-0755rm
markupsafe/-0755rm
MarkupSafe-2.1.3.dist-info/-0755rm
mccabe-0.7.0.dist-info/-0755rm
mock/-0755rm
mock-5.1.0.dist-info/-0755rm
multidict/-0755rm
multidict-6.0.4.dist-info/-0755rm
numpy/-0755rm
numpy-1.24.3.dist-info/-0755rm
packaging/-0755rm
packaging-23.1.dist-info/-0755rm
past/-0755rm
pep8_naming-0.10.0.dist-info/-0755rm
pip/-0755rm
pip-24.1.2.dist-info/-0755rm
pkg_resources/-0755rm
platformdirs/-0755rm
platformdirs-3.11.0.dist-info/-0755rm
pluggy/-0755rm
pluggy-1.2.0.dist-info/-0755rm
prettytable/-0755rm
prettytable-3.8.0.dist-info/-0755rm
prometheus_client/-0755rm
prometheus_client-0.8.0.dist-info/-0755rm
prospector/-0755rm
prospector-1.10.2.dist-info/-0755rm
psutil/-0755rm
psutil-5.9.5.dist-info/-0755rm
psycopg2/-0755rm
psycopg2-2.6.2.dist-info/-0755rm
pycodestyle-2.9.1.dist-info/-0755rm
pydocstyle/-0755rm
pydocstyle-6.3.0.dist-info/-0755rm
pyfakefs/-0755rm
pyfakefs-5.2.3.dist-info/-0755rm
pyflakes/-0755rm
pyflakes-2.5.0.dist-info/-0755rm
PyJWT-2.8.0.dist-info/-0755rm
pylint/-0755rm
pylint-2.17.4.dist-info/-0755rm
pylint_celery/-0755rm
pylint_celery-0.3.dist-info/-0755rm
pylint_django/-0755rm
pylint_django-2.5.3.dist-info/-0755rm
pylint_flask/-0755rm
pylint_flask-0.6.dist-info/-0755rm
pylint_plugin_utils/-0755rm
pylint_plugin_utils-0.7.dist-info/-0755rm
pylve-2.1-py3.11.egg-info/-0755rm
pymysql/-0755rm
PyMySQL-0.7.11.dist-info/-0755rm
pyparsing/-0755rm
pyparsing-3.0.9.dist-info/-0755rm
pyrsistent/-0755rm
pyrsistent-0.19.3.dist-info/-0755rm
pytest/-0755rm
pytest-7.4.0.dist-info/-0755rm
pytest_subprocess/-0755rm
pytest_subprocess-1.5.0.dist-info/-0755rm
pyvirtualdisplay/-0755rm
PyVirtualDisplay-3.0.dist-info/-0755rm
pyximport/-0755rm
PyYAML-6.0.1.dist-info/-0755rm
raven/-0755rm
raven-6.10.0.dist-info/-0755rm
requests/-0755rm
requests-2.31.0.dist-info/-0755rm
requirements_detector/-0755rm
requirements_detector-1.2.2.dist-info/-0755rm
schema-0.7.5.dist-info/-0755rm
semver/-0755rm
semver-3.0.1.dist-info/-0755rm
sentry_sdk/-0755rm
sentry_sdk-1.29.2.dist-info/-0755rm
setoptconf/-0755rm
setoptconf_tmp-0.3.1.dist-info/-0755rm
setuptools/-0755rm
setuptools-70.2.0.dist-info/-0755rm
simplejson/-0755rm
simplejson-3.19.1.dist-info/-0755rm
six-1.16.0.dist-info/-0755rm
smmap/-0755rm
smmap-5.0.0.dist-info/-0755rm
snowballstemmer/-0755rm
snowballstemmer-2.2.0.dist-info/-0755rm
sqlalchemy/-0755rm
SQLAlchemy-1.3.24.dist-info/-0755rm
ssa/-0755rm
svgwrite/-0755rm
svgwrite-1.4.3.dist-info/-0755rm
tap/-0755rm
tap.py-3.1.dist-info/-0755rm
testfixtures/-0755rm
testfixtures-7.1.0.dist-info/-0755rm
toml/-0755rm
toml-0.10.2.dist-info/-0755rm
tomlkit/-0755rm
tomlkit-0.11.8.dist-info/-0755rm
typing_extensions-4.7.1.dist-info/-0755rm
unshare-0.22.dist-info/-0755rm
urllib3/-0755rm
urllib3-2.0.3.dist-info/-0755rm
vendors_api/-0755rm
virtualenv/-0755rm
virtualenv-20.21.1.dist-info/-0755rm
wcwidth/-0755rm
wcwidth-0.2.6.dist-info/-0755rm
wheel/-0755rm
wheel-0.37.0.dist-info/-0755rm
wmt/-0755rm
wrapt/-0755rm
wrapt-1.15.0.dist-info/-0755rm
xray/-0755rm
yaml/-0755rm
yarl/-0755rm
yarl-1.9.2.dist-info/-0755rm
_distutils_hack/-0755rm
_pytest/-0755rm
_yaml/-0755rm
__pycache__/-0755rm
clcontrollib.py531400644editdlrm
cldetectlib.py188700644editdlrm
cldiaglib.py468720644editdlrm
clhooklib.py14320644editdlrm
cli_utils.py17780644editdlrm
cllicenselib.py80980644editdlrm
clsetuplib.py44220644editdlrm
clsudo.py150490644editdlrm
cl_proc_hidepid.py46790644editdlrm
cython.py5200644editdlrm
ddt.py152730644editdlrm
distutils-precedence.pth1510644editdlrm
docopt.py199460644editdlrm
lveapi.py199760644editdlrm
lvectllib.py1045690644editdlrm
lvestat.py71060644editdlrm
mccabe.py106540644editdlrm
pep8ext_naming.py190520644editdlrm
py.py2630644editdlrm
pycodestyle.py1035010644editdlrm
pylve.cpython-311-x86_64-linux-gnu.so209280755editdlrm
remove_ubc.py56730755editdlrm
schema.py302210644editdlrm
secureio.py192500644editdlrm
simple_rpm.so72800755editdlrm
six.py345490644editdlrm
typing_extensions.py1110820644editdlrm
unshare.cpython-311-x86_64-linux-gnu.so184640755editdlrm
_pyrsistent_version.py230644editdlrm
Edit: /opt/cloudlinux/venv/lib/python3.11/site-packages/cllicenselib.py (8098B)
# -*- coding: utf-8 -*- # CL LICENSE CHECK python lib # # 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 # CLASSES: # # LicenseData - main class for CL licence check # : check_license # : get_ip # : date_format # : open_letter_template # : format_letter # # FUNCTIONS: # # License update cron : update_license_timestamp_file # License update new key : update license with new key # Check license : check_license # Return Last License check date : last_license_check # Return Template to display : return_template_to_display from __future__ import print_function from __future__ import absolute_import from future.moves.urllib import request, error import os, sys, subprocess, struct, time, datetime, socket import cldetectlib as detect from clcommon.utils import mod_makedirs RHN_CHECK_FILE = '/usr/sbin/rhn_check' RHN_UPDATE_NEW_KEY = '/usr/sbin/rhnreg_ks' LICENSE_TIMESTAMP_FILE = '/var/lve/lveinfo.ver' LICENSE_TIMESTAMP_DIR = os.path.dirname(LICENSE_TIMESTAMP_FILE) RHN_DIRECTORY = '/etc/sysconfig/rhn' RHN_SYSTEMID = os.path.join(RHN_DIRECTORY, 'systemid') JWT_TOKEN = os.path.join(RHN_DIRECTORY, 'jwt.token') JWT_TOKEN_TIMESTAMP_FILE = os.path.join(LICENSE_TIMESTAMP_DIR, 'jwt_last_update_ts') CACHE_TIME = 259200 # 3 days JWT_UPDATE_INTERVAL = 3600 * 4 NO_VALID_LICENSE_FOUND_TEMPLATE = '/usr/share/cloudlinux/no_valid_license_screen.txt' LICENSE_OUT_OF_DATE_EMAIL_TEMPLATE = '/usr/share/cloudlinux/license_out_of_date_email.txt' TEMPLATES = { 'Email': { 'template_file': LICENSE_OUT_OF_DATE_EMAIL_TEMPLATE, 'error_msg': 'Error: License out of date, email template missing.' }, 'NoValid': { 'template_file': NO_VALID_LICENSE_FOUND_TEMPLATE, 'error_msg': 'Error: No valid license found, template is missing.' } } SHOW_IP_LINK = 'http://cloudlinux.com/showip.php' # License Data Class class LicenseData: _license_last_timestamp = '' _server_ip = '' _letter_template = '' @staticmethod def _is_license_needs_update(license_timestamp_file): """ Update license when: in case JWT token present: - if no timestamp file with jwt token last update time - if jwt token was not updated during last 4 hours - if jwt token was updated later than our timestamp in file in case JWT token is not present, but systemid exists (fallback for licensing w/o token) - update license only if systemid was changed after last timestamp update when no jwt and no systemid - re-update license """ if os.path.exists(JWT_TOKEN): if not os.path.exists(JWT_TOKEN_TIMESTAMP_FILE): return True rhn_updated = int(os.path.getmtime(JWT_TOKEN)) if rhn_updated < int(time.time()) - JWT_UPDATE_INTERVAL: return True jwt_last_update_timestamp = read_time_from_file(JWT_TOKEN_TIMESTAMP_FILE) if jwt_last_update_timestamp < rhn_updated: return True return False elif os.path.exists(RHN_SYSTEMID): rhn_updated = os.path.getmtime(RHN_SYSTEMID) return rhn_updated > os.path.getmtime(license_timestamp_file) return True def check_license(self, license_timestamp_file): """ Checks license: 1. Reads cache file with timestamp 2. Ensures license must be re-checked: - if timestamp in cache file > CACHE_TIME -> check if we need to re-update licensing """ try: # Get timestamp of last license check self._license_last_timestamp = read_time_from_file(license_timestamp_file) if (int(time.time()) - self._license_last_timestamp) > CACHE_TIME: if self._is_license_needs_update(license_timestamp_file): return update_license_timestamp_file() # because if server does not have jwt token and license is not needed update # consider no license return os.path.exists(JWT_TOKEN) else: return True except (IOError, struct.error): return False # Get IP def get_ip(self): if not self._server_ip: try: self._server_ip = request.urlopen(SHOW_IP_LINK).read().strip() except error.URLError as e: print('Error: Get server IP. ' + str(e)) sys.exit(1) # Format Date def date_format(self, format): return datetime.datetime.fromtimestamp(self._license_last_timestamp).strftime(format) # Open letter template def open_letter_template(self, template): try: self._letter_template = open(template, "r").read() except IOError as e: print('Error: Failed to open template file. ' +str(e)) sys.exit(1) # Format Screen def format_letter(self): admin_email = detect.getCPAdminEmail() if admin_email: self.get_ip() if not self._license_last_timestamp: return self._letter_template.replace('%LIC_DATE%','').replace('%IP%',self._server_ip).replace('%HOSTNAME%',socket.gethostname()).replace('%FROM%',admin_email) else: return self._letter_template.replace('%LIC_DATE%',' since ' + self.date_format('%b %d, %y')).replace('%IP%',self._server_ip).replace('%HOSTNAME%',socket.gethostname()).replace('%FROM%',admin_email) else: return None # License Data Class Object License = LicenseData() def read_time_from_file(file: str): with open(file, 'rb') as f: return struct.unpack('i', f.read())[0] def write_time_to_file(file: str, timestamp: int): with open(file, 'wb') as f: f.write(struct.pack('i', timestamp)) # License update cron def update_license_timestamp_file(): try: if not os.path.isdir(LICENSE_TIMESTAMP_DIR): mod_makedirs(LICENSE_TIMESTAMP_DIR, 0o755) p = subprocess.Popen([RHN_CHECK_FILE], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) (out, err) = p.communicate() if p.returncode == 0: write_time_to_file(LICENSE_TIMESTAMP_FILE, int(time.time())) if os.path.exists(JWT_TOKEN): write_time_to_file(JWT_TOKEN_TIMESTAMP_FILE, int(os.path.getmtime(JWT_TOKEN))) return True return False except (OSError, IOError): return False # update license with new key def update_license_with_key(key): try: if not os.path.isdir(LICENSE_TIMESTAMP_DIR): mod_makedirs(LICENSE_TIMESTAMP_DIR, 0o755) p = subprocess.Popen([RHN_UPDATE_NEW_KEY, '--activationkey='+key, '--force'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) (out, err) = p.communicate() if p.returncode == 0: write_time_to_file(LICENSE_TIMESTAMP_FILE, int(time.time())) if os.path.exists(JWT_TOKEN): write_time_to_file(JWT_TOKEN_TIMESTAMP_FILE, int(os.path.getmtime(JWT_TOKEN))) print('OK') return True else: print(out.strip()) return False except (OSError, IOError): print('Error: New key activation failed, please try again later.') return False # Returns: # True == license is Ok # False == license expired or not found def check_license(): # Check for license timestamp file in /var/lve/lveinfo.ver if os.path.isfile(LICENSE_TIMESTAMP_FILE): return License.check_license(LICENSE_TIMESTAMP_FILE) # try to re-update license file if jwt token is present # or systemid file as fallback when jwt absent (goDaddy) elif os.path.exists(JWT_TOKEN) or os.path.exists(RHN_SYSTEMID): return update_license_timestamp_file() return False # Return Last license check Date def last_license_check(is_valid): if is_valid: return 'OK' # Check for license timestamp file in /var/lve/lveinfo.ver if os.path.isfile(LICENSE_TIMESTAMP_FILE): return 'No valid license found, last successful check was on ' + License.date_format('%b %d, %y') else: return 'No valid license found.' def get_email_template(): return get_template_to_display(TEMPLATES['Email']) def get_novalid_template(): return get_template_to_display(TEMPLATES['NoValid']) # Return Template Email, No Valid license found template. def get_template_to_display(template): # check for template in /usr/share/cloudlinux if os.path.isfile(template['template_file']): if check_license(): return None else: # set template text into License class attr. License.open_letter_template(template['template_file']) # Return Formatted Template return License.format_letter() else: return template['error_msg']