gdddlZddlZddlZddlZddlZddlZddlmZddlm Z m Z GddZ e e Z dZ dZd d Zd Zd ZdS)N) remount_proc)SYSCTL_CL_CONF_FILE SysCtlConfc0eZdZgdZdZdZdZdZdZdS) KernelVersion)1r95TcRtjddgtjtj5}|\}}|jdkr#t dt jd|ddkr{| dd d ddd d |_ t |j nd |_ ddddS#1swxYwYdS) Nunamez-r)stdoutstderrrz?error: subprocess call error. Cant't get current kernel versionlveel.F) subprocessPopenPIPE communicate returncodeprintsysexitfindsplitstrip_system_kernel _cl_kernel)selfprocout_s py/clsetuplib.py__init__zKernelVersion.__init__&sM   dO??   (%%''FC!##XYYY xx"$$&)ii&6&6q&9&?&?&E&Ea&H"&M&S&S&U&U&[&[\_&`&`#d)****"' ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (sC!DD #D c|jr/|j|jkotjdSt dtjddS)Nz/proc/sys/fs/symlinkown_gidz1error: Feature is not supported on non CL kernel.r) r r_SECURELINKS_MIN_KERNELospathisfilerrrr!s r%securelinks_kernel_requirementz,KernelVersion.securelinks_kernel_requirement7sY ? #t'CCBGNN#@AA  ABBB  c<dd|jzS)Nrr)joinr(r,s r%get_securelinks_min_kernelz(KernelVersion.get_securelinks_min_kernelBssxx <====r.N) __name__ __module__ __qualname__r(rr r&r-r1r.r%rr!sU,nnNJ(((">>>>>r.r) config_filec@d}t||dS)zn Change /etc/sysctl.conf for apache gid :param apache_gid: id of apache's group :return: None zfs.symlinkown_gidN)sysctlset) apache_gidsymlink_commands r%set_securelinks_gidr<Is#*O JJ +++++r.cd} tt|}n#t$rd}YnwxYw t j|jn#t$rd}YnwxYw|dkrQd}tj d|dddt j |j }t ||tj d |d |dddd S) z 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 zfs.proc_super_gidr clsupergidz groupadd -f Tz /bin/bashF)shell executablecheckzusermod -a -G  N) intr8get ValueErrorgrpgetgrgidgr_nameKeyErrorrrungetgrnamgr_gidr9)usersgid_keyproc_super_gid sgid_names r%_add_to_super_gidrQTs<#HVZZ1122  ^$$,,,  1i11!k H H H Hi007 8^,,,N;N;;T;;+UDDDDDDs', ;;A A('A(TcrtjsdStd|rtdSdS)z: Add nagios to configured fs.proc_super_gid group Nnagios) cldetectlib get_nagiosrQrdo_remount_procs r% setup_nagiosrXwsI  ! # #hr.ctjdsdS tjdn#t $rYdSwxYwt ddS)z@ Detect "mailman" and add it to fs.proc_super_gid group z"/usr/local/cpanel/3rdparty/mailmanNmailman)r)r*isdirpwdgetpwnamrIrQr5r.r% setup_mailmanr^sp 7=== > > Y i     s8 AAc^tdttdS)z 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 FrVN)rXr^rr5r.r%setup_supergidsr`s- ''''OOONNNNNr.)T)rFr)r\rrrTcl_proc_hidepidrclcommon.sysctlrrrr8r<rQrXr^r`r5r.r%rcs *  ((((((;;;;;;;;">">">">">">">">J  3 4 4 4,,, D D DF     ! ! !     r.