-DE/ddlZddlmZddlmZmZmZmZddlm Z ddl m Z ej e ZdZdZdZd Zd ZGd d Zd ZdS)N) LicenseCLN) OsReleaseInfo check_runrunsystem_packages_info)get_hardened_php_feature) KernelCarez]wget -qq -O - https://repo.imunify360.cloudlinux.com/defence360/imunifyemail-deploy.sh | bashcptjtjzrtt fSdS)N)rid_likeRHEL_FEDORA_CENTOSr rr S/opt/imunify360/venv/lib/python3.11/site-packages/im360/subsys/features/__init__.pylist_feature_typesrs2!AA46677rrc.ttdS)N)z hardened-php kernelcare)rr r rrget_applicable_featuresrs022   rctD]4}t||d}t|r |5dS)z Features repo-files depends on server_id, so it should be actual after every registration operation :param str op: generate_repo/remove_repo N)rgetattrcallable)opfeaturemethod_to_calls rupdate_features_reposr%sY &'' B55 N # #  N   rcKtjr+tdt ddStdt ddS)Nz8Updating repositories configuration with new credentials generate_repoz>License is invalid. Repositories for features will be disabled remove_repo)ris_validloggerinforwarningr rr update_reposr"1so - NOOOo.....  L    m,,,,,rceZdZdZed dZed dZedefdZed dZ ed dZ dS) IMEmailWrapper imunifyemailreturnNcBKttdd{VdS)zInstalls imunifyemail.T)shellN)rINSTALL_IE_CMDclss rinstallzIMEmailWrapper.installAs3d333333333333rcKt|jgd{V}||j|d{VdSdS)z'Installs imunifyemail if not installed.N)rPKG_NAMEr,)r+imunify_email_packages rensure_installedzIMEmailWrapper.ensure_installedFsg';CL>&J&J J J J J J J  . 6++--          7 6rcnK tddgd{V\}}}n#t$rYdSwxYw|dkS)z'Checks whether imunifyemail is enabled./usr/sbin/ie-configzis-onNFr)rFileNotFoundError)r+ returncodeouterrs r is_enabledzIMEmailWrapper.is_enabledMsg ),.CW-M)N)N#N#N#N#N#N#N JSS    55 Qs  ..cpK|d{Vstgdd{VdSdS)z!Enables imunifyemail if disabled.N)r2-venabler7rr*s rensure_enabledzIMEmailWrapper.ensure_enabledWsf^^%%%%%%%% ECCCDD D D D D D D D D D E ErcpK|d{Vrtgdd{VdSdS)z!Disables imunifyemail if enabled.N)r2r9disabler;r*s rensure_disabledzIMEmailWrapper.ensure_disabled]sy!! ! ! ! ! ! ! 888           r)r&N) __name__ __module__ __qualname__r. classmethodr,r0boolr7r<r?r rrr$r$>sH444[4   [ [EEE[E [rr$cKtjdr@td{Vtd{VdStd{VdS)zK Enables or disables im-email based on active license permissions. IM_EMAILN)rhas_permissionr$r0r<r?r rrupdate_im_emailrHfs ,,/--/////////++-----------,,...........r)logging!defence360agent.contracts.licenserdefence360agent.utilsrrrr"im360.subsys.features.hardened_phpr+defence360agent.subsys.features.kernel_carer getLoggerr@rr)rrrr"r$rHr rrrOs888888 HGGGGGBBBBBB  8 $ $    - - -%%%%%%%%P/////r