-*MBdZddlZddlmZddlmZddlmZddlm Z ddl m Z ddl m Z gZejeZd Zed ee jDZed d Zd eDZGddejZdS)z]Endpoints for configuration management commands. - manage ModSecurity directives, rulesets. N) namedtuple)lookup)ValidationError)Scope)config) hosting_panel1000c#xK|]5}|d|ttj|fV6dS)SecN) startswithgetattrrModSecurityDirectives).0attrs ^/opt/imunify360/venv/lib/python3.11/site-packages/im360/simple_rpc/configuration_management.py rsZ  u 76/ 6 67Issuezid title fix url ignoredc g|]@\}}||ttdjditddtzdfAS)zXWrong value for {directive} ModSecurity directive. Expected: {expected!r} Got: {{got!r}}z4Run `imunify360-agent fix modsec directives` commandz#https://docs.imunify360.com/issues/Fignored)r%ISSUE_ID_MODSEC_DIRECTIVE_WRONG_VALUEformatvars)r directiveexpecteds r rs  8  1 < 55; F F>Bff F F B 13 4    rceZdZejZfdZejddddZ ejddddZ ejdddd Z ejdddd Z xZ S) ModSecEndpointsczt|tj|_dSN)super__init__r HostingPanel)selfsink __class__s rr$zModSecEndpoints.__init__0s2 *799rcheckmodsec directivesc Ktjj}g}tD]\}}}|j|d{V}||krt d|||||}| t| |j j dittd|Dst!|d|iS)Nzdirective %r got %r expected %rr)titlec3&K|] }|dV dS)rNr)rissues rrz=ModSecEndpoints.validate_modsec_directives..Es'885#888888ritemsr)r StopManagingMODSEC_DIRECTIVESissues_modsec_directivesrmodsec_get_directiveloggerdebug_replaceappenddict_asdictr-rrallr)r&skipissuesrrr/gots rvalidate_modsec_directivesz*ModSecEndpoints.validate_modsec_directives4s"4*B   &Ix*?? JJJJJJJJCh 5  t44 0B 0B0L0LTVV0L0LMMM8888888 *!&)) )  rfixcxKtjjrddgiS|jd{VdgiS)Nr0zSkipped resetting ModSecurity directives. To reenable the command, run: imunify360-agent config update '{"STOP_MANAGING": {"modsec_directives": false}}')rr1r2rreset_modsec_directivesr&s rrBz'ModSecEndpoints.reset_modsec_directivesJs_   0 o  88:::::::::}rrulesetscKtr"NotImplementedErrorrCs rvalidate_modsec_rulesetsz(ModSecEndpoints.validate_modsec_rulesetsW !!rcKtr"rFrCs rreset_modsec_rulesetsz%ModSecEndpoints.reset_modsec_rulesets[rIr)__name__ __module__ __qualname__rIM360SCOPEr$rbindr?rBrHrK __classcell__)r(s@rr r -s KE:::::V[(L11!!21!*V[,//  0/ V[(J//""0/"V[*--"".-"""""rr )__doc__logging collectionsrdefence360agent.rpc_toolsr"defence360agent.rpc_tools.validaterdefence360agent.utilsrim360.contractsrim360.subsys.panelsr__all__ getLoggerrLr5rr9dirrr2rr0r3 RootEndpointsr rrrr_sV"""""",,,,,,>>>>>>''''''""""""------   8 $ $(.%DF011  7677 16688$0"0"0"0"0"f*0"0"0"0"0"r