5/9eFddlmZddlmZddlZddlZddlZddlZddlZddlZddl m Z ddl m Z m Z GddZe e Zd Zd Zdd Zd ZdZdS))print_function)absolute_importN) remount_proc) SysCtlConfSYSCTL_CL_CONF_FILEc0eZdZgdZdZdZdZdZdZdS) KernelVersion)1r 95Tc"tjddgtjtj}|\}}|jdkr#t dt jd|ddkr|| dd d ddd d |_ t |j dSd |_ dS) Nunamez-r)stdoutstderrrz?error: subprocess call error. Cant't get current kernel versionlveel.F) subprocessPopenPIPE communicate returncodeprintsysexitfindsplitstrip_system_kernel _cl_kernel)selfpouterrs py/clsetuplib.py__init__zKernelVersion.__init__#s  gt_Z_Z_ ] ] ]]]__ c LA   T U U U HQKKK HHUOOr ! !"%))E"2"21"5";";D"A"A!"DSbS"I"O"O"Q"Q"W"WX["\"\D  $% & & & & &#DOOOc|jr3|j|jkr!tjdrdSdSt dtjddS)Nz/proc/sys/fs/symlinkown_gidTFz1error: Feature is not supported on non CL kernel.r) r"r!_SECURELINKS_MIN_KERNELospathisfilerrrr#s r'securelinks_kernel_requirementz,KernelVersion.securelinks_kernel_requirement0s[ ? #t'CCCXuIvIvCtu E F F F HQKKKKKr)c<dd|jzS)Nrr)joinr+r/s r'get_securelinks_min_kernelz(KernelVersion.get_securelinks_min_kernel<ssxx <====r)N) __name__ __module__ __qualname__r+r!r"r(r0r3r)r'r r 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>Cs#*O JJ +++++r)cd} tt|}n#t$rd}YnwxYw t j|jn#t$rd}YnwxYw|dkrPd}tj d|zddt j |j }t ||tj d ||ddd 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/bash)shell executablezusermod -a -G {} {}N)intr:get ValueErrorgrpgetgrgidgr_nameKeyErrorrrungetgrnamgr_gidr;format)usersgid_keyproc_super_gid sgid_names r'_add_to_super_gidrRNs!#HVZZ1122  ^$$,,,  ~ 1+VVVVi007 8^,,,N(//EE+777777s', ;;A A('A(TcrtjsdStd|rtdSdS)z: Add nagios to configured fs.proc_super_gid group Nnagios) cldetectlib get_nagiosrRrdo_remount_procs r' setup_nagiosrYpsI  ! # #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-isdirpwdgetpwnamrIrRr7r)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 FrWN)rYr_rr7r)r'setup_supergidsras- ''''OOONNNNNr))T) __future__rrrrr,rFr]rUcl_proc_hidepidrclcommon.sysctlrrr r:r>rRrYr_rar7r)r'res6*&%%%%%&&&&&&$$$$$$$$$$$$$$$$$$$$((((((;;;;;;;;>>>>>>>>D  3 4 4 4,,,777D     ! ! !     r)