??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177

Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
 )gc@sddlmZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZddlmZddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddlm#Z#ddlm$Z$ddlm%Z%ddlm&Z&ddl'm(Z(m)Z)m*Z*m+Z+m,Z,ddl$m-Z-m.Z.m/Z/dZ0dZ1dZ2dZ3d Z4dZ5d"Z6d#Z7ej8d$ej9Z:ej8d%Z;ej<j=d&re j<j>d'd&nej?d(d)e@eArdd*lBmCZCmDZDmEZEmFZFmGZGmHZHnejIjJejKd+ZLd,ZMd-ZNd.ZOd/ZPdd0ZRd1ZSd2ZTd3ZUd4ZVd5ZWd6ZXd7eYfd8YZZd9e.fd:YZ[d;e.fd<YZ\d=e.fd>YZ]d?Z^ed@Z_ddAZ`dBZadCZbiZcdDZdede*je_fege dEdsyRddlhZiddljZkeijljmekjneijljmdFkreodGnWneok rqXdHZpe*jqZrdIesfdJYZtdKe*jqfdLYZueue*_qnejvdMZwdNZxdOZydPesfdQYZzdRZ{dSZ|eAdTZ}dUZ~dVZeAdWZdXZdYZdZZd[Zd\Zd]Zd^Zd_Zd`ZdaZdbZdcZddZdeZddfZdgZdhZdiZdjZdkeAdlZdmZdnZdoZdpZdkeAdqZdrZdsZdtdduYZdvZdwZdxZdyZejejvdzZd{Zejd|Zd}Zd~ZdZddZdZdZdS(i(tprint_functionN(tArgumentParser(tdatetime(tcontextmanageri(tconfig(t constants(t log_utils(tutils(t process_utils(tplatform_utils(t http_utils(tauth(tconfig_handlers(tlibcare(tselinux(tfetch(t update_utils(terrors(tkcare(t server_info(tURLErrort HTTPErrorthttplibt urlencodetjson_loads_nstr(tSafeExceptionWrappert KcareErrortNotFoundictv2t12ht24ht48httests./etc/sysconfig/kcare/freezer.modules.blacklists/usr/libexec/kcare/kcdoctor.shs latest.v2s /etc/sysconfig/kcare/sysctl.confi s$==BLACKLIST== (.*)==END BLACKLIST== s'(kpatch.*|ksplice.*|kpatch_livepatch.*)s/usr/libexec/kcare/pythonitignoretcategory(tOptionaltDicttTupletAnytUniontSetcCs_t}tjjtr[ttd}x!|D]}|j|jq1W|jn|S(Ntr( tsettostpathtisfiletFREEZER_BLACKLISTtopentaddtrstriptclose(tresulttftline((s./usr/libexec/kcare/python/kcarectl/__init__.pytget_freezer_blacklistJs   cCsY|jd}|r8dj|d||dg}ndj|d|dg}|S(Nt.ii(tsplittjoin(tptypetfilenamet name_parts((s./usr/libexec/kcare/python/kcarectl/__init__.pyt _apply_ptypeTs #cCsmt|tjt_t|tjt_t|tjt_t|tjt_t|tjt_dS(N(R=Rt PATCH_BINt PATCH_INFOtBLACKLIST_FILEt FIXUPS_FILEt PATCH_DONE(R:((s./usr/libexec/kcare/python/kcarectl/__init__.pyt apply_ptype]s c Csntj\}}}d}t|trt|t ry)d|jtj|j|jf}Wqt t fk r|qXnut|t t t frt|t rd|}n@t|t r|jpt|j}|jpd|j}ntj}itjd6tjd6|dd6|dd 6t|d t|d 6|d 6djtj|d d6S(Nts[Errno %i] %s: '%s's%st agent_versiontpython_versionitdistroitdistro_versiont__name__terrortdetailsidt traceback(tsystexc_infot isinstancetOSErrorRterrnoR+tstrerrorR;tAttributeErrort TypeErrortKeyErrortIOErrorRtetypettypetinnerRKR t get_distroRtVERSIONtget_python_versiontgetattrtstrR9RLt format_tb(RWtvaluettbtdetails_sanitizedRG((s./usr/libexec/kcare/python/kcarectl/__init__.pyt format_exception_without_detailses*)(      cCstjr dStjt}tjtjtj |}tj dd|}t j |t j}yt j|Wntk rnXdS(Ns/api/kcarectl-traces?trace=(RtUPDATE_FROM_LOCALtjsontdumpsRcRtnstrtbase64turlsafe_b64encodetbstrtget_patch_server_urlR t http_requestR tget_http_auth_stringt urlopen_baset Exception(ttracet encoded_traceturltrequest((s./usr/libexec/kcare/python/kcarectl/__init__.pytsend_excs ! cCstj}|dkr,tj|ddStjtj}|dkr^tjdntjdttjd3}tj |j dtj |j dWdQX|rt j |ny |Wn.t k rtjjdtjdnXtjddS(s Run func in a fork in an own process group (will stay alive after kcarectl process death). :param func: function to execute :return: iNtaiisWait exception(R+tforktwaitpidtsetsidt_exitR2R/RtLOG_FILEtdup2tfilenottimetsleepRoRtkcarelogt exception(tfuncR~tpidtfd((s./usr/libexec/kcare/python/kcarectl/__init__.pyt nohup_forks(        c Cstjjtjd}tjj|rt|d\}yAt|j}|t j t j kr|t ||nWnt k rnXWdQXntj|tjdS(sCheck the fact that there was a failed patching attempt. If anchor file not exists we should create an anchor with timestamp and schedule its deletion at $timeout. If anchor exists and its timestamp more than $timeout from now we should raise an error. s.kcareprev.lockR)N(R+R,R9Rt PATCH_CACHER-R/tinttreadRtSUCCESS_TIMEOUTR}tPreviousPatchFailedExceptiont ValueErrorRt atomic_writet timestamp_str(tanchor_filepathtafilet timestamp((s./usr/libexec/kcare/python/kcarectl/__init__.pyt touch_anchors  cCsy#tjtjjtjdWntk r6nXtd|tj j yt ddWn!t k rt jjdnXdS(s See touch_anchor() for detailed explanation of anchor mechanics. See KPT-730 for details about action registration. :param state_data: dict with current level, kernel_id etc. s.kcareprev.locktdonetreasonsCannot send update info!N(R+tremoveR,R9RRRPtregister_actionRtget_loaded_modulestcleartget_latest_patch_levelRoRRR(t state_data((s./usr/libexec/kcare/python/kcarectl/__init__.pyt commit_updates#    cCs8tjtjjtjddtj||ddS(Ntpatchest exclude_pathRD( Rtclean_directoryR+R,R9RRRtget_cache_path(tkhashtplevel((s./usr/libexec/kcare/python/kcarectl/__init__.pyt clear_cachescCs\tjp d}dj||g}tjd|f}|rL||f7}ntjj|S(Ntnonet-tmodules(RtPREFIXR9RRR+R,(Rtfnametprefixt module_dirR3((s./usr/libexec/kcare/python/kcarectl/__init__.pytget_current_level_paths cCs)tjt|dt|dtdS(Ntlatestt ensure_dir(RRRR^tTrue(Rt patch_level((s./usr/libexec/kcare/python/kcarectl/__init__.pytsave_cache_latestscCswt|d}tjj|rsy5tt|djj}tj ||SWqst t fk roqsXndS(NRR)( RR+R,R-RR/RtstripRtLegacyKernelPatchLevelRRT(Rtpath_with_latesttpl((s./usr/libexec/kcare/python/kcarectl/__init__.pytget_cache_latests!tCertificateErrorcBseZRS((RIt __module__(((s./usr/libexec/kcare/python/kcarectl/__init__.pyRstUnknownKernelExceptioncBseZdZRS(cCs9tj|djtjdtjtjdS(NsLNew kernel detected ({0} {1} {2}). There are no updates for this kernel yet.i( Rot__init__tformatR RZtplatformtreleaseRtget_kernel_hash(tself((s./usr/libexec/kcare/python/kcarectl/__init__.pyRs(RIRR(((s./usr/libexec/kcare/python/kcarectl/__init__.pyRstApplyPatchErrorcBseZdZdZRS(cOsctt|j||||_||_||_||_tjd|_ t j |_ dS(Ni( tsuperRRtcodet freezer_styletlevelt patch_fileR RZRGRR(RRRRRtargstkwargs((s./usr/libexec/kcare/python/kcarectl/__init__.pyR s    c CsPdj|j|j|j|j|jdjg|jD]}t|^q4S(Ns0Unable to apply patch ({0} {1} {2} {3} {4}, {5})s, ( RRRRRGRR9RR^(Rti((s./usr/libexec/kcare/python/kcarectl/__init__.pyt__str__s(RIRRR(((s./usr/libexec/kcare/python/kcarectl/__init__.pyR s RcBseZdZdZRS(cOs/tt|j||||_||_dS(N(RRRRtanchor(RRRRR((s./usr/libexec/kcare/python/kcarectl/__init__.pyR#s cCsd}|j|j|jS(NsIt seems, the latest patch, applying at {0}, crashed, and further attempts will be suspended. To force patch applying, remove `{1}` file(RRR(Rtmessage((s./usr/libexec/kcare/python/kcarectl/__init__.pyR(s(RIRRR(((s./usr/libexec/kcare/python/kcarectl/__init__.pyR"s cCstjdj|}ytj|}tjtj|j}t |d}|dkrot dnE|dkrt dn,|dkrt dnt d j||SWn#t k r}t j ||nXd S( Ns"/nagios/register_key.plain?key={0}RisKey successfully registeredisWrong key format or sizeis!No KernelCare license for that IPsUnknown error {0}i(RtREGISTRATION_URLRR turlopenRt data_as_dictRgRRtprintRRtprint_cln_http_error(tkeyRrtresponsetresRte((s./usr/libexec/kcare/python/kcarectl/__init__.pyt!set_monitoring_key_for_ip_license1s       ccsUtjr"tjtjdtnz dVWdtjrPtjtjdtnXdS(Ntshell(RtBEFORE_UPDATE_COMMANDRt run_commandRtAFTER_UPDATE_COMMAND(((s./usr/libexec/kcare/python/kcarectl/__init__.pyt execute_hooksEs    cCs$t}|j}|j}tj}|dkrit|d6tjd6tj d6t j d6|d6t t jd6|d6}td ttj|nutd tt|td t|ttjttj tt j t|tt jd S( s1 The output will consist of: Ignore output up to the line with "--START--" Line 1: show if update is needed: 0 - updated to latest, 1 - update available, 2 - unknown kernel 3 - kernel doesn't need patches 4 - no license, cannot determine Line 2: licensing message (can be skipped, can be more then one line) Line 3: LICENSE: CODE: 1: license present, 2: trial license present, 0: no license Line 4: Update mode (True - auto-update, False, no auto update) Line 5: Effective kernel version Line 6: Real kernel version Line 7: Patchset Installed # --> If None, no patchset installed Line 8: Uptime (in seconds) If *format* is 'json' return the results in JSON format. Any other output means error retrieving info :return: Ret updateCodet autoUpdateteffectiveKernelt realKerneltloadedPatchLeveltuptimetlicenses --START--s LICENSE: N(t_patch_level_infoRt applied_lvlR t license_infoR^Rt AUTO_UPDATERt kcare_unameRRRR t get_uptimeRReRf(tfmttplit update_codet loaded_pltlicense_info_resulttresults((s./usr/libexec/kcare/python/kcarectl/__init__.pyt plugin_infoQs.              cCsutj}ytdd}Wntk r@tjr<dSdSX|dkrQdS||kradStjrqdSdS(NRtinfoiiii( Rtloaded_patch_levelRRRtIGNORE_UNKNOWN_KERNELtNoneRtstatus_gap_passed(t current_leveltlatest_patch_level((s./usr/libexec/kcare/python/kcarectl/__init__.pytget_update_statuss    cCs=tjd \}}|dkr5|jdr5dSdSdS(Nit CloudLinuxs7.textraRD(R RZt startswith(RGtversion((s./usr/libexec/kcare/python/kcarectl/__init__.pytedf_fallback_ptypescCs|j|jf}tj||}tj||j|_|jjtj tj d|tkr~|jj d t|RRRRR R4R5RRRotdebugR^RtSIGR(RR:tbin_urlR<Rr((s./usr/libexec/kcare/python/kcarectl/__init__.pyt probe_patchs( &" &cCsg|tjkr$|jtj}n|j|}|j|}tj||tjdtj |S(Nt hash_checker( RtKMOD_BINtkmod_urlR@t cache_pathRt fetch_urlRt USE_SIGNATUREtget_hash_checker(RtnameRrtdst((s./usr/libexec/kcare/python/kcarectl/__init__.pytfetch_and_verify_kernel_file2s t PatchFetchercBsAeZddZdZdZdZdZdZRS(cCs ||_dS(N(R(RR((s./usr/libexec/kcare/python/kcarectl/__init__.pyR<scCst|j|S(N(RNR(RRL((s./usr/libexec/kcare/python/kcarectl/__init__.pyt_fetch?scCs|jjtj}|jjtj}|jjtj}|jjtj}td||||fDot j j |dkot j j |dkS(Ncss!|]}tjj|VqdS(N(R+R,R-(t.0R,((s./usr/libexec/kcare/python/kcarectl/__init__.pys Isi( RRHRRBR>R?RRFtallR+R,tgetsize(Rtpatch_done_pathtpatch_bin_pathtpatch_info_patht kmod_bin_path((s./usr/libexec/kcare/python/kcarectl/__init__.pytis_patch_fetchedBs"cCs|jdkrtdn|js.|jS|jrNtjd|jStjdt|jtjry(t j |jj t j dd}Wntk rqX|jjdd}|r|jjtj||_qny|jt j Wn5tk r6tdj|jt jp*dnX|jt j|jtj|jtj|jjt jd d d tj tj!|jS( Ns+Cannot fetch patch as no patch level is setsUpdates already downloadedsDownloading updatesR>R?s KC-Base-UrlsfThe `{0}` patch level is not found for `{1}` patch type. Please select valid patch type or patch leveltdefaultRDR:twb("RRRRXRtloginfoRORRR R4R@RR>RR7RtupgradeRRgRPRRt PATCH_TYPER?RRFtextract_blacklistRRHRBRtrestore_selinux_contextR(RtrespR-((s./usr/libexec/kcare/python/kcarectl/__init__.pyt fetch_patchNs8    ( $  %cCsqt|jjtjdj}|rmtj|}|rmtj |jjtj |j dqmndS(NR)i( R/RRHRR?Rt BLACKLIST_REtsearchRRR@tgroup(Rtbuftmo((s./usr/libexec/kcare/python/kcarectl/__init__.pyR^vs $cCs|dkrdSyt|tj}Wntk r:dSX|jjdd}|rq|jtj |}n|j tj}t |d2}t g|j D]}|j^q}WdQXx|D]}t||qWtjtjdS(s Download fixup files for defined patch level :param level: download fixups for this patch level (usually it's a level of loaded patch) :return: None Ns KC-Base-UrlR)(RRNRRARR7RR\RRgRHR/R*t readlinesRRR_RR(RRR`R-t fixups_fnameR4tfixuptfixups((s./usr/libexec/kcare/python/kcarectl/__init__.pyt fetch_fixups}s  1 N( RIRRRRPRXRaR^Rk(((s./usr/libexec/kcare/python/kcarectl/__init__.pyRO;s    ( cCsIt}t|j|jtjkr8tjdn tjddS(Nii(RRtmsgRtPLItPATCH_NEED_UPDATERMtexit(R((s./usr/libexec/kcare/python/kcarectl/__init__.pyt kcare_checks   c Cstt}t|}ytj}Wntk r>i}nXtj}d}|dk r|tj |dj d}ntj }t |j dg}td|D}tj}|stdn tdtdj|td j||d kr'td j|n|d krItd j|n||d krftd ntddS(NtUnknownttss%Y-%m-%dRcss'|]}t|jdgVqdS(RN(tlenR(RQtrec((s./usr/libexec/kcare/python/kcarectl/__init__.pys ss$KernelCare live patching is disableds"KernelCare live patching is actives - Last updated on {0}s - Effective kernel version {0}is* - {0} kernel vulnerabilities live patcheds- - {0} userspace vulnerabilities live patcheds% - This system has no applied patchess(Type kcarectl --patch-info to learn more(Rt_kcare_patch_info_jsonR tlibcare_patch_info_basicRRt get_stateRRt fromtimestamptstrftimeRRsRtsumRRR( Rt kcare_infot libcare_infotstatet latest_updateteffective_versiontkernel_vulnerabilitiestuserspace_vulnerabilitiesR((s./usr/libexec/kcare/python/kcarectl/__init__.pytshow_generic_infos4             c Cs4ytdddtj}|s*tn|jtj}tjt j |j }|rgi}}xU|j dD]D}tj |}|rd|kr|j|q}|j|q}W||dR(t applied_levelt new_levelR((s./usr/libexec/kcare/python/kcarectl/__init__.pytkcare_need_updates   cCstjrtjjto-tjttjsMtj j dj tdSt j dddtgdt\}}}|dkrtj j dj |qndS(Ns-File {0} does not exist or has no read accesss /sbin/sysctls-qs-pt catch_stdoutis%Unable to load kcare sysctl.conf: {0}(RtUPDATE_SYSCTL_CONFIGR+R,R-t SYSCTL_CONFIGtaccesstR_OKRRtwarningRRRR(Rt_((s./usr/libexec/kcare/python/kcarectl/__init__.pyt update_sysctl+s '* cstjjts(ttdjntjttjsZtj j dj tdSttd}|j }|j dx:|D]2tfd|Ds|jqqWx|D]}|j|dqW|jWdQXdS(s*Update SYSCTL_CONFIG accordingly the editsRusFile {0} has no read accessNsr+ic3s|]}j|VqdS(N(R(RQR)(R5(s./usr/libexec/kcare/python/kcarectl/__init__.pys Ess (R+R,R-RR/R2RRRRRRRgtseektanytwritettruncate(RRtsysctltlinesRu((R5s./usr/libexec/kcare/python/kcarectl/__init__.pytedit_sysctl_conf5s    cCs<x5|D]-}tj|rtdj|qqWdS(NsDDetected '{0}' kernel module loaded. Please unload that module first(tCONFLICTING_MODULES_REtmatchRR(Rtmodule((s./usr/libexec/kcare/python/kcarectl/__init__.pytdetect_conflicting_modulesMs cCsdjtjS(Ns/lib/modules/{0}/extra/kcare.ko(RR tget_system_uname(((s./usr/libexec/kcare/python/kcarectl/__init__.pytget_kcare_kmod_linkSscCsstdd}tjtj|tj}tjj|sCdSt |d}|j ddkSWdQXdS(NRRtrbis~Module signature appended~ ( RRRRRRFR+R,R-R/R(Rt kmod_filetvfd((s./usr/libexec/kcare/python/kcarectl/__init__.pytkmod_is_signedWs cKsd|g}x3|jD]%\}}|jdj||qWtj|dt\}}}|dkrtdj||ndS(Ns /sbin/insmods{0}={1}RisLUnable to load kmod ({0} {1}). Try to run with `--check-compatibility` flag.(titemsRRRRRR(tkmodRtcmdRR`RR((s./usr/libexec/kcare/python/kcarectl/__init__.pyt load_kmod`s   cCs\tjr%t r%tdntjsItjsItjrXtdndS(Ns4Secure boot is enabled. Not supported by KernelCare.sWYou are running inside a container. Kernelcare should be executed on host side instead.(R tis_secure_bootRRtinside_vz_containertinside_lxc_containertinside_docker_container(((s./usr/libexec/kcare/python/kcarectl/__init__.pytcheck_compatibilityis$cCsstjddd|g}g}xK|jdD]:}|jr1|jd\}}}|j|q1q1W|S(Ns /sbin/modinfos-Ftparms t:(RRR8Rt partitionR(t kcare_linktstdouttavailable_paramsR5t param_nameR((s./usr/libexec/kcare/python/kcarectl/__init__.pytget_kmod_available_paramsps cCsitjrdndd6tjr(dndd6tjrAtjndd6ttjtrctjndd6tjrydndd6S( Niit kpatch_debugt kmsg_outputt kcore_outputRDt kdumps_dirtenable_crashreporter( Rt KPATCH_DEBUGt KMSG_OUTPUTt KCORE_OUTPUTtKCORE_OUTPUT_SIZEROt KDUMPS_DIRR^tENABLE_CRASHREPORTER(((s./usr/libexec/kcare/python/kcarectl/__init__.pytmake_kmod_new_paramszs "cCsctjr2tjjtj r2tjtjnx*tjD]\}}t||qBWdS(N( RRR+R,texiststmakedirsRRtupdate_kmod_param(tparamtval((s./usr/libexec/kcare/python/kcarectl/__init__.pyR8scCsd}tjj||}tjj|s1dSy/t|d}|jt|WdQXWn'tk rtj j d||nXdS(Ns/sys/module/kcare/parameterstws!failed to set %s kmod param to %s( R+R,R9RR/RR^RoRRRJ(tkmod_param_namet param_valuet params_roott param_pathR4((s./usr/libexec/kcare/python/kcarectl/__init__.pyRs cst}tj||tj}ytj||Wntk rN|}nXtj rt j j tj  rt j tj nt}t|tfd|jD}t||tdS(Nc3s-|]#\}}|kr||fVqdS(N((RQtktv(tavailable_kmod_params(s./usr/libexec/kcare/python/kcarectl/__init__.pys s(RRRRRFtshutiltcopyRoRRR+R,RRRRtdictRRt update_depmod(RRRt kcare_filet kmod_params((Rs./usr/libexec/kcare/python/kcarectl/__init__.pytload_kcare_kmods     " cCsdg}|dk r+|jd|gntj|dtdt\}}}|rtjdjdj|||dt ndS(Ns /sbin/depmods-aRt catch_stderrs%Running of `{0}` failed with {1}: {2}t t print_msg( RtextendRRRRtlogerrorRR9R5(tunameRRRtstderr((s./usr/libexec/kcare/python/kcarectl/__init__.pyRs   $cCsOtjd|gdt\}}}|dkrKtdj||ndS(Ns /sbin/rmmodRisUnable to unload {0} kmod {1}(RRRRR(tmodnameRR((s./usr/libexec/kcare/python/kcarectl/__init__.pyt unload_kmods$ cCsug}xhdg|D]Y}tj||dj|}tjj|rt||jdj|qqW|S(Ntvmlinuxs fixup_{0}.kos fixup_{0}(RRRR+R,RRR(RRRtloadedtmodtmodpath((s./usr/libexec/kcare/python/kcarectl/__init__.pyt apply_fixupss cCsKxD|D]<}yt|Wqtk rBtjjd|qXqWdS(Ns$Exception while unloading module %s.(RRoRRR(RjR((s./usr/libexec/kcare/python/kcarectl/__init__.pyt remove_fixupss   cCs|r|}nMtjr$tj}n8tj|rId|tjtfSd|tjtfSidd6dd6dd6dd6dd 6}|j}||kr||}n!td j||tjt||tjtfS( Ntfreeze_conflictRYt freeze_nonetNONEtNOFREEZEt freeze_alltFULLtFREEZEtSMARTs3Unable to detect freezer style ({0}, {1}, {2}, {3})( Rt PATCH_METHODR6t intersectionRR5tupperRR(tfreezerRR>tpatch_method_map((s./usr/libexec/kcare/python/kcarectl/__init__.pytget_freezer_styles$       !RDc sZi|d6|d6|d6tdtj}tj}t|t||}tj||tj}t ||dj |tj t j tj|} d|k} | otj||} |dk } | ot|otj| } ji|d6| d6| r+td dS| rtd t|||}td t|td t|n| rtd tdt} n| stdt||n|rtntdt|||| |ttjdj |tjt j!tdt"fddtj#dS(NRtfutureR:tstarts{0}-{1}:{2};{3}Rtcurrentt kmod_changedRtfxptunpatchtunfxptunloadtloadtpatchs5Patch level {0} applied. Effective kernel version {1}twaitcs tS(N(R((R(s./usr/libexec/kcare/python/kcarectl/__init__.pyt/sR~($RRRRRRRRR>RRR]RRt parse_unametis_kmod_version_changedRRtkcare_update_effective_versionRRtkpatch_ctl_unpatchRRR5RRtkpatch_ctl_patchRRR[RRttouch_status_gap_fileRR(RRR:Rt use_anchorRRRRt descriptiont kmod_loadedRt patch_loadedt same_patchRj((Rs./usr/libexec/kcare/python/kcarectl/__init__.pyt kcare_loadsR     $  !              c Cstjg}tj||tj}tjj|rL|j d|gn|j dd|g|j d|dg|j |t j |dt \}}}|dkrt||||ndS(Ns-bR s-ds-miR(RRRRRR@R+R,RRRRRRR( RRRRRRtblacklist_fileRR((s./usr/libexec/kcare/python/kcarectl/__init__.pyR2s   cCstjtjdd|dgdtdt\}}}|dkrtjdj||dtt dj|t |ndS( NRs-miRRs4Error unpatching, kpatch_ctl stdout: {0} stderr: {1}RsError unpatching [{0}] {1}( RRRRRRRRR5RR^(RRRR((s./usr/libexec/kcare/python/kcarectl/__init__.pyR?s 1 cCsL||dRRRRMRoR RRRRRRRrRRRgRR(tfileR:tsR<RRRR((s./usr/libexec/kcare/python/kcarectl/__init__.pyR1s2    #   c CsRg}|stS|jd}|d}|d}|jd}||krgtdt|n|s|j|jkS|dkr|jdnY|jds|jdr|jtj |n"|jtj |j dd x$|D]}|jtj |qWtj d d j |d tj } | j|S( shMatching according to RFC 6125, section 6.4.3 http://tools.ietf.org/html/rfc6125#section-6.4.3 R7iit*s,too many wildcards in certificate DNS name: s[^.]+sxn--s\*s[^.]*s\As\.s\Z(R5R8R'RtreprtlowerRRtretescapetreplacetcompileR9t IGNORECASER( tdnthostnamet max_wildcardstpatstpiecestleftmostt remaindert wildcardstfragtpat((s./usr/libexec/kcare/python/kcarectl/__init__.pyt_dnsname_matchs(    " &c Csg}xxt|jD]d}|j|}|jdkrgt|jdD]}|jjdd^qV}qqW|stdng}xC|D];\}}|dkrt||rdS|j |qqW|s|j j } t| |r dS|j |nt |dkrYt dj|djtt|n=t |dkrt d j||d n t d dS( NtsubjectAltNamet,Ristempty or no certificate, match_hostname needs a SSL socket or SSL context with either CERT_OPTIONAL or CERT_REQUIREDtDNSs(hostname {0} doesn't match either of {1}s, shostname {0} doesn't match {1}is=no appropriate commonName or subjectAltName fields were found(trangetget_extension_countt get_extensiontget_short_nameR^R8RRRRt get_subjectt commonNameRsRRR9tmapRt( tcertR|tsanRRtittdnsnamesRR`tcn((s./usr/libexec/kcare/python/kcarectl/__init__.pyR%s0A  -c Cstdddd}|jddddd |jd d dd dd |jd dddd |jdddddd |jddddd |jddddd |jddddd |jddddd|jddddd |jddddd |jd!dd"dd |jd#dd$dd |jd%dd&dd |jd'dd(dd |jd)dd*dd+|jd,dd-dd |jd.dd/dd |jd0dd1dd |jd2dd3dd |jd4dd5dd |jd6dd7dd8|jd9dd:dd;|jd<dd=dd |jd>dd?dd+|jd@ddAdd |jdBddCdd |jdDddEdd |jdFddGdd |jdHddIdd |jdJddKdd |jdLddMdd |jdNddOdd |jdPddQddRdStdTddUt|jdVddWdd |jdXddYdd |j}|jdZdd[ddR|jd\dd]dd |jd^dd_dd |jd`ddaddRdTddUt|jdbdcddddd dUt|jdeddf|jdgddhdd |jdiddjddkddltjs|jdmddndodpddqdrt|jdsddtdodpddqdrt|jduddvdd |jdwdxddydd |jdzdddd |jd{d|dd}dd |jd~ddddd |jdddddd|jddddddrddd|jddddd |jddddd n|j }tj j t j tjstjdg7_n|jdk rWttd|jjdjtjrPdSdSn|jsi|jrtjrtjt_qtjt_n|jrtjt_n|jstjdkrt ddt!j"dSnt#j$}|jrt#j%}n|jrt#j&}nt'j(||j)r3t*j+n|j,r|j,dkrst-|j,t_.t j/dtj.qdt_.t j/ddn|j0dk rt j/d|j0|j0t_1n|j2rtt_3n|j4rtt_5n|j6rtt_7n|j8rt8n|j9r.t:j;dt<nN|j=r|tj>dkr|tj?dkr[dntj?pgdT|_@t|_ q|n|jAr|jAt_Bn|jCrt:j;dt<dt_BntjBjDdt_BtjBr tjBtEkr t'jFjGdjHtjBdjItEn|jJr6 tt_Kd|jJt_Ln|j@rO tM|j@ntj>dkr tNt_>t:j;djHtj>p dTt<n|jOr t tPjOd|jQdStRtj>|jSr tTdS|jUr |jQr tUddntUdS|jVr t j/dddS|jWr= t j/dddS|jXrZ t jY|jXdS|jZrp t[|jZS|j\r t]j\n|j^r tj>dkr t j/ddnt]j^|j^|j_S|j`r t]j`dkr dSdSn|jadk r tb|jaS|jcr" t tjdnte|dpddk rN tfjg|jhdStjs |jirj tfjjS|jkr tfjldk r t'jmdq n|jnr tfjldtjon#|jpr tfjqt'jmdn|jrr t tfjsn|jtr t tfjun|jvr@ tfjwr@ t tfjx|jvn|jydk r |jydkr tjzpy t{tfj|j}}n1g|jyjdD]}|jDj~^q }tfjldt|dk r t'jmdq n|jr tfjldtjoddq n|jr+ t td|jQnd}|jrS t:j;dt<d}n|jrh |j}n|jr t|dtjdtjn|j r t|dtjt'jmdn|jr t tjn|jrt|d|jt'jmdn|jrEtt_tjtjddt|dtjon|jratd|jQn|jrqtS|jrtd|jQn|jrtntt!jdkrtndS(NtprogtkcarectlRs)Manage KernelCare patches for your kernels--debugthelpRDRt store_trues-is--infos]Display information about KernelCare. Use with --json parameter to get result in JSON format.s --app-infoscDisplay information about KernelCare agent. Use with --json parameter to get result in JSON format.s-us--updates<Download latest patches and apply them to the current kernels--unloadsUnload patchess--smart-updates,Patch kernel based on UPDATE POLICY settingss --auto-updates-Check if update is available, if so -- updates--localsNUpdate from a server local directory; accepts a path where patches are locatedtmetavartPATHs --patch-infos"Return the list of applied patchess --freezers)Freezer type: full (default), smart, noneRs --nofreezes/[deprecated] Don't freeze tasks before patchings--unamesReturn safe kernel versions--license-infosReturn current license infos--statussReturn status of updatess --registersRegister using KernelCare KeyRps--register-autoretrys=Retry registering indefinitely if failed on the first attempts --unregisters7Unregister from KernelCare (for key-based servers only)s--checksCheck if new update availables--latest-patch-infosiReturn patch info for the latest available patch. Use with --json parameter to get result in JSON format.s--tests&[deprecated] Use --prefix=test insteads--tags7Tag server with custom metadata, for ePortal users onlytTAGs--prefixspPatch source prefix used to test different builds by downloading builds from different locations based on prefixRs --nosignaturesDo not check signatures--set-monitoring-keysPSet monitoring key for IP based licenses. 16 to 32 characters, alphanumeric onlys--doctors@Submits a vitals report to CloudLinux for analysis and bug-fixess--enable-auto-updatesEnable auto updatess--disable-auto-updatesDisable auto updatess --plugin-infosProvides the information shown in control panel plugins for KernelCare. Use with --json parameter to get result in JSON format.s--jsonsoReturn '--plugin-info', '--latest-patch-info', '--patch-info', '--app-info' and '--info' results in JSON formats --versions(Return the current version of KernelCares--kpatch-debugsEnable the debug modes--no-check-certs2Disable the patch server SSL certificates checkings--set-patch-levelsBSet patch level to be applied. To select latest patch level set -1tstoreRXRYtrequireds--check-compatibilitysCheck compatibility.s --clear-cachesClear all cached filess--set-patch-types@Set patch type feed. To select default feed use 'default' options --edf-enableds"Enable exploit detection frameworks--edf-disableds#Disable exploit detection frameworks--set-sticky-patchsjSet patch to stick to date in DDMMYY format, or retrieve it from KEY if set to KEY. Leave empty to unsticks-qs--quiets=Suppress messages, provide only errors and warnings to stderrs --has-flagssCheck agent featuress--forces-Force action and ignore several restristions.s --set-configsChange configuration optionRs KEY=VALUEs--disable-libcaresDisable libcare servicestdesttenable_libcaret store_consttconsts--enable-libcaresEnable libcare servicess --lib-updatesIDownload latest patches and apply them to the current userspace librariess --lib-unloads--userspace-unloadsUnload userspace patchess--lib-auto-updates --lib-infos--userspace-infos&Display information about KernelCare+.s--lib-patch-infos--userspace-patch-infos,Return the list of applied userspace patchess --lib-versions--userspace-versionsReturn safe package versiont PACKAGENAMEs--userspace-updatetUSERSPACE_PATCHEStnargsR*sODownload latest patches and apply them to the corresponding userspace processess--userspace-auto-updates--userspace-statuss"Return status of userspace updatesslibcare-enabledRiisPlease run as rootRqR.R9sTFlag --edf-enabled has been deprecated and will be not available in future releases.RXsMFlag --test has been deprecated and will be not available in future releases.R t/s(Prefix `{0}` is not in expected one {1}.Rsfile:s+edf patches are deprecated. Fallback to {0}RRReRtYEStNORZR]RsUserspace patches are applied.R:sUserspace patches are unloaded.tlimitsQFlag --nofreeze has been deprecated and will be not available in future releases.RRsKernel is safeR,s=KernelCare protection disabled. Your kernel might not be safei<(Rt add_argumentRRR5tadd_mutually_exclusive_groupRtLIBCARE_DISABLEDRt parse_argst__dict__RR tget_config_settingstFLAGSt has_flagsR*tfilterR8tissubsettquiett auto_updatetSILENCE_ERRORSRtPRINT_CRITICALt PRINT_LEVELt PRINT_ERRORRAt PRINT_DEBUGRR+tgetuidRRMRtloggingtINFOtWARNINGtDEBUGRtinitialize_loggingRRtclear_all_cachetset_patch_levelR^R.R[tset_sticky_patchR9t nosignatureRJt no_check_certRRRRt edf_enabledtwarningstwarntDeprecationWarningt edf_disabledR]tPREV_PATCH_TYPEtset_patch_typeRRR RtEXPECTED_PREFIXRRRR9tlocalRdRKR`Rtapp_infoR ReRCtdoctorRPRtenable_auto_updatetdisable_auto_updatet set_configtupdate_config_from_argstset_monitoring_keyRt unregisterR tregistertregister_autoretryRR=RBRR[R]R tset_libcare_statusRtuserspace_statustget_userspace_update_statust lib_updatetdo_userspace_updateR[tlib_auto_updateRdt lib_unloadtlibcare_unloadtlib_infoR|tlib_patch_infotlibcare_patch_infot lib_versiontlibcare_server_startedtlibcare_versiontuserspace_updateRtlistt USERSPACE_MAPtkeysRutsortedtuserspace_auto_updateRR{tnofreezeRt smart_updateRfRet UPDATE_POLICYRlRRR R0R,tCHECK_CLN_LICENSE_STATUSR}R~trandomtuniformRtstatusRtlatest_patch_infoRtcheckRpRstargvR(tparsertexclusive_groupRRRtptchR((s./usr/libexec/kcare/python/kcarectl/__init__.pytmain:s    -                       '   +    %                         !1                 (RRRstest(s latest.v2((t __future__RRhReRR+RRRvRRtsslRMRFR}RLRtargparseRRt contextlibRRDRRRRRR R R R R RRRRRRtpy23RRRRRRRRR^RQRR.RER/RR+RytDOTALLRbRR,RtinserttfilterwarningsRR5ttypingR#R$R%R&R'R(RtsetLevelRR6R=RCRcRtRRRRRRRRRRRRRRRRRRRRRRR]tdistutils.versiont distutilst OpenSSL.SSLRRt StrictVersiont __version__t ImportErrorR tHTTPSConnectiontPureHTTPSConnectiontobjectR RRlR=RDRNRORpRRRuRRRRRRRRRRRRRR8RRRRRRRRRRRR&R0R{R1RmRRBRPRRRRR`RfRnRoR1RR%R(((s./usr/libexec/kcare/python/kcarectl/__init__.pyts               (1    %        4      '      ` #              ?  ,  2   % 5   , 3 )