zdZddlZddlmZddlmZddlmZddlm Z m Z ddl m Z ddlmZdd lmZmZdd lmZdd lmZeeZd Zd ZGdde ZdS)z A plugin responsible for periodically launching AppVersionDetector and optionally limiting ModSecurity rulesets for the sites that use various CMS. Currently it sets up and maintains a cron job to achieve this. N) getLogger) SystemConfig) MessageType) MessageSinkexpect)Modsec) web_server) load_state save_state) HostingPanel)try_restore_config_from_backupzK/opt/imunify360/venv/share/imunify360/scripts/update_components_versions.pyz/etc/cron.d/waf_configuratorcReZdZdZdZdZeejdZ dS)WAFRuleSetConfiguratorcKtdd|_|j|jtjkr'tj|_t d{VdSdSNrapp_specific_ruleset)r get_app_specific_rulesetConfigAPP_SPECIFIC_RULESETr )selfloops Y/opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/waf_rules_configurator.py create_sinkz"WAFRuleSetConfigurator.create_sink!s~%/0H%I%I%M%M "& & "  & .)V-HHH)/)DD &022 2 2 2 2 2 2 2 2 2IHc8Ktdd|jidSr)r r)rs rshutdownzWAFRuleSetConfigurator.shutdown,s0 $ #T%? @     rc`K t}tj|}|jrWt |dtjd{Vt ddSdS#ttf$rYdSwxYw)z[ If app-specific httpd config exists and is not empty, truncate it wNz%App specific ruleset config truncated) r get_app_specific_waf_configosstatst_sizeopencloser graceful_restartloggerinfoFileNotFoundErrorNotImplementedError)r config_pathsts r_truncate_confz%WAFRuleSetConfigurator._truncate_conf2s E&..DDFFK%%Bz E[#&&,,... 1333333333 CDDDDD E E"#67    DD s4BB-,B-cKt|dtrrEs+ 999999::::::AAAAAAAA333333------JJJJJJJJ:::::: 8  $<)0)0)0)0)0[)0)0)0)0)0r