| Linux server27.hostingraja.org 2.6.32-954.3.5.lve1.4.93.el6.x86_64 #1 SMP Wed Oct 4 17:04:29 UTC 2023 x86_64 Path : /opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/resident/ |
| Current File : //opt/imunify360/venv/lib/python3.11/site-packages/im360/plugins/resident/update_files.py |
import logging
from defence360agent.contracts.messages import MessageType
from defence360agent.contracts.plugins import MessageSink, expect
from im360 import files
logger = logging.getLogger(__name__)
PHP_IMMUNITY_FILENAME = "/usr/share/i360-php-opts/autorules.yaml"
class UpdateFilesOnServerRequest(MessageSink):
async def create_sink(self, loop):
self._loop = loop
@expect(MessageType.UpdateFiles, list_type=files.MODSEC)
@expect(MessageType.UpdateFiles, list_type=files.IP_RECORD)
async def process_update_request(self, message):
logger.info(
"%s files will be updated on server request", message.list_type
)
await files.update_and_log_error(message.list_type)
@expect(MessageType.UpdateFiles, list_type=files.PHP_IMMUNITY)
@expect(MessageType.UpdateFiles, list_type=files.PHP_IMMUNITY_V2)
@expect(MessageType.UpdateFiles, list_type=files.PROACTIVE)
async def process_update_request_force(self, message):
logger.info(
"%s files will be force updated on server request",
message.list_type,
)
await files.update_and_log_error(message.list_type, force=True)