#!/usr/bin/python # # Copyright CloudLinux Zug GmbH 2010-2015 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENCE.TXT # import os CP_NAME = None def getCPName(): """ Detect control panel and return its name """ global CP_NAME if CP_NAME: return CP_NAME # cPanel check if os.path.isfile('/usr/local/cpanel/cpanel'): CP_NAME = 'cPanel' # Plesk check elif os.path.isfile('/usr/local/psa/version'): CP_NAME = 'Plesk' # DirectAdmin check elif os.path.isfile('/usr/local/directadmin/directadmin'): CP_NAME = 'DirectAdmin' # ISPmanager v4 or v5 check elif os.path.isfile('/usr/local/ispmgr/bin/ispmgr') or os.path.isfile('/usr/local/mgr5/sbin/mgrctl'): CP_NAME = 'ISPManager' # InterWorx check elif os.path.isfile('/usr/local/interworx/iworx.ini'): CP_NAME = 'InterWorx' # HSphere check elif os.path.isdir('/hsphere/shared'): CP_NAME = 'H-Sphere' elif os.path.isfile('/lib64/libnss_ng.so'): CP_NAME = 'HostingNG' # CentOS Web Panel check elif os.path.isfile('/etc/rc.d/init.d/cwpsrv'): CP_NAME = 'CentOS_WEB_Panel' elif os.path.isfile('/etc/httpd/conf.d/atomia-pa-apache.conf') or os.path.isdir('/storage/configuration/cloudlinux'): CP_NAME = 'Atomia_agent' else: CP_NAME = 'Unknown' return CP_NAME def add_server_stats(status_report): """ Add server statistics to status_report dict :param status_report: dict to add statistics to :type status_report: dict """ from up2date_client import clpwd res = {} cp_name = getCPName() if cp_name != 'Unknown': res['cp'] = cp_name if cp_name == 'Plesk': clpwdinstance = clpwd.ClPwd(10000) else: clpwdinstance = clpwd.ClPwd() d = clpwdinstance.get_uid_dict() users = 0 sys_users = set(['nfsnobody', 'avahi-autoipd', 'exim', 'clamav', 'varnish', 'nagios', 'saslauth', 'mysql', 'lsadm', 'systemd-bus-proxy', 'systemd-network', 'polkitd', 'firebird', 'nginx', 'dovecot', 'dovenull', 'roundcube_sysuser', 'avahi-autoipd', 'cpanel', 'cpanelhorde', 'cpanelphpmyadmin', 'cpanelphppgadmin', 'cpanelroundcube', 'mailman', 'cpaneleximfilter', 'cpanellogaholic', 'cpanellogin', 'munin', 'cpaneleximscanner', 'cpanelphpgadmin', 'cpses', 'cpanelconnecttrack', 'cpanelrrdtool', 'admin', 'webapps' 'apache', 'diradmin', 'majordomo', 'viapm', 'iworx', 'iworx-web', 'iworx-pma', 'iworx-backup', 'iworx-horde', 'iworx-roundcube', 'iworx-sqmail', 'iworx_support_user', 'psaadm', 'popuser', 'psaftp', 'drweb', 'sw-cp-server', 'horde_sysuser']) for uid in d: found = False for entry in d[uid]: if entry.pw_name in sys_users: found = True break if not found: users += 1 res['users'] = users status_report['cln'] = res
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
__pycache__ | Folder | 0755 |
|
|
__init__.py | File | 0 B | 0644 |
|
capabilities.py | File | 7.28 KB | 0644 |
|
cldetect.py | File | 2.97 KB | 0644 |
|
clientCaps.py | File | 2.16 KB | 0644 |
|
clpwd.py | File | 3.56 KB | 0644 |
|
config.py | File | 12.5 KB | 0644 |
|
debUtils.py | File | 2.73 KB | 0644 |
|
getMethod.py | File | 4.2 KB | 0644 |
|
haltree.py | File | 4.53 KB | 0644 |
|
hardware.py | File | 31.91 KB | 0644 |
|
hardware_gudev.py | File | 12.89 KB | 0644 |
|
hardware_hal.py | File | 11.32 KB | 0644 |
|
hardware_udev.py | File | 12.99 KB | 0644 |
|
pkgUtils.py | File | 295 B | 0644 |
|
pkgplatform.py | File | 309 B | 0644 |
|
pmPlugin.py | File | 2.79 KB | 0644 |
|
rhnChannel.py | File | 4.4 KB | 0644 |
|
rhnHardware.py | File | 328 B | 0644 |
|
rhnPackageInfo.py | File | 2.21 KB | 0644 |
|
rhncli.py | File | 9.12 KB | 0644 |
|
rhnreg.py | File | 32.72 KB | 0644 |
|
rhnreg_constants.py | File | 18.13 KB | 0644 |
|
rhnserver.py | File | 8.66 KB | 0644 |
|
rpcServer.py | File | 10.96 KB | 0644 |
|
rpmUtils.py | File | 5.2 KB | 0644 |
|
transaction.py | File | 4.09 KB | 0644 |
|
tui.py | File | 43.7 KB | 0644 |
|
up2dateAuth.py | File | 9.29 KB | 0644 |
|
up2dateErrors.py | File | 10.26 KB | 0644 |
|
up2dateLog.py | File | 2.06 KB | 0644 |
|
up2dateUtils.py | File | 5.06 KB | 0644 |
|