Submit
Path:
~
/
/
opt
/
alt
/
python37
/
lib
/
python3.7
/
site-packages
/
File Content:
clsetuplib.py
# -*- coding: utf-8 -*- # CLSETUP 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: # # Kernel # check min kernel for securelinks # Setup: # # setup apache gid for securelinks # setup nagios from __future__ import print_function from __future__ import absolute_import import sys, subprocess, os, grp, pwd import cldetectlib from cl_proc_hidepid import remount_proc from clcommon.sysctl import SysCtlConf, SYSCTL_CL_CONF_FILE # Kernel Version Class class KernelVersion: _SECURELINKS_MIN_KERNEL = ['1','1','95'] _system_kernel = '' _cl_kernel = True def __init__(self): p = subprocess.Popen(['uname', '-r'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) (out, err) = p.communicate() if (p.returncode != 0): print('error: subprocess call error. Cant\'t get current kernel version') sys.exit(1) if (out.find('lve') != -1): self._system_kernel = out.split('lve')[1].split('el')[0][:-1].strip().split('.') print(self._system_kernel) else: self._cl_kernel = False # Check if system kernel newer then securelinks min kernel def securelinks_kernel_requirement(self): if self._cl_kernel: if (self._system_kernel >= self._SECURELINKS_MIN_KERNEL) and os.path.isfile('/proc/sys/fs/symlinkown_gid'): return True else: return False else: print('error: Feature is not supported on non CL kernel.') sys.exit(1) # return _SECURELINKS_MIN_KERNEL def get_securelinks_min_kernel(self): return 'lve' + '.'.join(self._SECURELINKS_MIN_KERNEL) sysctl = SysCtlConf(config_file=SYSCTL_CL_CONF_FILE) def set_securelinks_gid(apache_gid): """ Change /etc/sysctl.conf for apache gid :param apache_gid: id of apache's group :return: None """ symlink_command = 'fs.symlinkown_gid' sysctl.set(symlink_command, apache_gid) def _add_to_super_gid(user): """ Add user to the group specified by fs.proc_super_gid. If fs.proc_super_gid is 0 (means undefined) or group doesn't really exists then create "clsupergid" group, configure it as fs.proc_super_gid and add user to this group """ sgid_key = 'fs.proc_super_gid' try: # sysctl.get may return empty string in some cases like cldeploy # when CL kernel is not loaded yet and proc has no such param proc_super_gid = int(sysctl.get(sgid_key)) except ValueError: proc_super_gid = 0 try: # Check that group with this gid really exists, and if not, then reset # it to undefined so it will be replaced with clsupergid below grp.getgrgid(proc_super_gid).gr_name except KeyError: proc_super_gid = 0 if proc_super_gid == 0: # Create and configure group if it was undefined sgid_name = 'clsupergid' subprocess.run('groupadd -f ' + sgid_name, shell=True, executable='/bin/bash') proc_super_gid = grp.getgrnam(sgid_name).gr_gid sysctl.set(sgid_key, proc_super_gid) # If user already in this group or it's primary group == proc_super_gid # this will do nothing subprocess.run('usermod -a -G {} {}'.format(proc_super_gid, user), shell=True, executable='/bin/bash') def setup_nagios(do_remount_proc=True): """ Add nagios to configured fs.proc_super_gid group """ if not cldetectlib.get_nagios(): return # Nothing to do _add_to_super_gid('nagios') # CAG-796: use hidepid=2 when mounting /proc if do_remount_proc: remount_proc() def setup_mailman(): """ Detect "mailman" and add it to fs.proc_super_gid group """ if not os.path.isdir('/usr/local/cpanel/3rdparty/mailman'): return try: pwd.getpwnam('mailman') except KeyError: return _add_to_super_gid('mailman') def setup_supergids(): """ Configure "special" users to be in fs.proc_super_gid group, if it's necessary. If this GID was undefined(0) then create and setup special clsupergid group """ setup_nagios(do_remount_proc=False) setup_mailman() # CAG-796: use hidepid=2 when mounting /proc remount_proc()
Submit
FILE
FOLDER
Name
Size
Permission
Action
Babel-2.9.1-py3.7.egg-info
---
0755
Beaker-1.11.0-py3.7.egg-info
---
0755
Jinja2-3.0.3-py3.7.egg-info
---
0755
Mako-1.1.0-py3.7.egg-info
---
0755
OpenSSL
---
0755
Paste-1.7.5.1-py3.7.egg-info
---
0755
PyJWT-1.7.1-py3.7.egg-info
---
0755
Tempita-0.5.1-py3.7.egg-info
---
0755
__pycache__
---
0755
_distutils_hack
---
0755
aiosignal
---
0755
aiosignal-1.2.0a0-py3.7.egg-info
---
0755
alembic
---
0755
alembic-0.8.3-py3.7.egg-info
---
0755
asn1crypto
---
0755
asn1crypto-0.22.0-py3.7.egg-info
---
0755
async_timeout
---
0755
async_timeout-4.0.2-py3.7.egg-info
---
0755
attr
---
0755
attrs-17.4.0-py3.7.egg-info
---
0755
babel
---
0755
beaker
---
0755
beautifulsoup4-4.5.1-py3.7.egg-info
---
0755
bs4
---
0755
certifi
---
0755
certifi-2018.4.16-py3.7.egg-info
---
0755
chardet
---
0755
chardet-3.0.4-py3.7.egg-info
---
0755
charset_normalizer
---
0755
charset_normalizer-2.0.12-py3.7.egg-info
---
0755
cl_dom_collector
---
0755
clcommon
---
0755
clconfig
---
0755
clconfigure
---
0755
cldashboard
---
0755
clevents
---
0755
cllicense
---
0755
cllimits
---
0755
cllimits_validator
---
0755
cllimitslib_v2
---
0755
clpackages
---
0755
clquota
---
0755
clselect
---
0755
clselector
---
0755
clsentry
---
0755
clsummary
---
0755
clveconfig
---
0755
clwizard
---
0755
clwpos
---
0755
cssselect
---
0755
cssselect-0.9.2-py3.7.egg-info
---
0755
distlib
---
0755
docopt-0.6.2-py3.7.egg-info
---
0755
filelock
---
0755
filelock-0.0.0-py3.7.egg-info
---
0755
future
---
0755
future-0.17.0-py3.7.egg-info
---
0755
html5lib
---
0755
html5lib-1.0.1-py3.7.egg-info
---
0755
idna
---
0755
idna-2.5-py3.7.egg-info
---
0755
importlib_metadata
---
0755
importlib_metadata-0.0.0-py3.7.egg-info
---
0755
jinja2
---
0755
jsonschema
---
0755
jsonschema-3.2.0-py3.7.egg-info
---
0755
jwt
---
0755
libfuturize
---
0755
libpasteurize
---
0755
lve_utils
---
0755
lvemanager
---
0755
lvestats
---
0755
mako
---
0755
nose
---
0755
nose-1.3.7-py3.7.egg-info
---
0755
packaging
---
0755
packaging-16.8-py3.7.egg-info
---
0755
past
---
0755
paste
---
0755
pip
---
0755
pip-20.2.4.dist-info
---
0755
pkg_resources
---
0755
platformdirs
---
0755
platformdirs-0.0.0-py3.7.egg-info
---
0755
ply
---
0755
ply-3.8-py3.7.egg-info
---
0755
prettytable-0.7.2-py3.7.egg-info
---
0755
pyOpenSSL-17.3.0-py3.7.egg-info
---
0755
pycparser
---
0755
pycparser-2.14-py3.7.egg-info
---
0755
pyparsing-2.1.10-py3.7.egg-info
---
0755
python_editor-0.4-py3.7.egg-info
---
0755
pytz
---
0755
pytz-2017.2-py3.7.egg-info
---
0755
raven
---
0755
raven-6.3.0-py3.7.egg-info
---
0755
requests
---
0755
requests-2.26.0-py3.7.egg-info
---
0755
schema-0.7.1-py3.7.egg-info
---
0755
sentry_sdk
---
0755
sentry_sdk-0.19.4-py3.7.egg-info
---
0755
setuptools
---
0755
setuptools-58.3.0.dist-info
---
0755
six-1.15.0-py3.7.egg-info
---
0755
ssa
---
0755
svgwrite
---
0755
svgwrite-1.3.0-py3.7.egg-info
---
0755
tempita
---
0755
typing_extensions-3.7.4.3-py3.7.egg-info
---
0755
urllib3
---
0755
urllib3-1.26.6-py3.7.egg-info
---
0755
vendors_api
---
0755
virtualenv
---
0755
virtualenv-20.13.0-py3.7.egg-info
---
0755
webencodings
---
0755
webencodings-0.5.1-py3.7.egg-info
---
0755
wmt
---
0755
zipp-0.0.0-py3.7.egg-info
---
0755
Paste-1.7.5.1-py3.7-nspkg.pth
534 bytes
0644
PySocks-1.5.7-py3.7.egg-info
322 bytes
0644
cl_proc_hidepid.py
4549 bytes
0644
clcontrollib.py
53127 bytes
0644
cldetectlib.py
18745 bytes
0644
cldiaglib.py
48675 bytes
0644
clhooklib.py
1432 bytes
0644
cli_utils.py
1775 bytes
0644
cllicenselib.py
8220 bytes
0644
clsetuplib.py
4422 bytes
0644
clsudo.py
15049 bytes
0644
cpanel.py
29687 bytes
0644
distlib-0.3.4-py3.7.egg-info
1162 bytes
0644
distutils-precedence.pth
152 bytes
0644
docopt.py
19946 bytes
0644
editor.py
2550 bytes
0755
lve_stats-2.0-py3.7.egg-info
185 bytes
0644
lveapi.py
19697 bytes
0644
lvectllib.py
94545 bytes
0644
lvestat.py
7106 bytes
0644
prettytable.py
54204 bytes
0644
pyparsing.py
229867 bytes
0644
remove_ubc.py
5670 bytes
0755
schema.py
29198 bytes
0644
secureio.py
17387 bytes
0644
six.py
34159 bytes
0644
socks.py
29952 bytes
0644
sockshandler.py
2913 bytes
0644
typing_extensions.py
83727 bytes
0644
zipp.py
8425 bytes
0644
N4ST4R_ID | Naxtarrr