Server IP : 66.29.132.122 / Your IP : 18.226.4.248 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /opt/imunify360/venv/lib/python3.11/site-packages/defence360agent/migrations/ |
Upload File : |
import logging import os import shutil from defence360agent.utils import OsReleaseInfo logger = logging.getLogger(__name__) _DEBIAN_MODSEC_DISABLE_SYMLINK_PATH = ( "/etc/apache2/plesk.conf.d/i360_modsec_disable.conf" ) _DEBIAN_MODSEC_DISABLE_SYMLINK = ( "/etc/apache2/conf-enabled/zz999_modsec2.imunify_disable.conf" ) _MODSEC_DISABLE_SYMLINK_PATH = ( "/etc/httpd/conf/plesk.conf.d/i360_modsec_disable.conf" ) _MODSEC_DISABLE_SYMLINK = ( "/etc/httpd/conf.d/zz999_modsec2.imunify_disable.conf" ) _DEBIAN_NEW_MODSEC_DISABLE_FILENAME = ( "/etc/apache2/plesk.conf.d/i360_modsec_disable.conf" ) _DEBIAN_OLD_MODSEC_DISABLE_FILENAME = ( "/etc/apache2/conf/plesk.conf.d/i360_modsec_disable.conf" ) def migrate(migrator, database, fake=False, **kwargs): if fake: return old_file_name = None new_file_name = None if OsReleaseInfo.id_like() & OsReleaseInfo.DEBIAN: old_file_name = _DEBIAN_OLD_MODSEC_DISABLE_FILENAME new_file_name = _DEBIAN_NEW_MODSEC_DISABLE_FILENAME symlink_path = _DEBIAN_MODSEC_DISABLE_SYMLINK_PATH symlink = _DEBIAN_MODSEC_DISABLE_SYMLINK else: symlink_path = _MODSEC_DISABLE_SYMLINK_PATH symlink = _MODSEC_DISABLE_SYMLINK if old_file_name and os.path.exists(old_file_name): try: shutil.move(old_file_name, new_file_name) except Exception as e: logger.exception("Failed move %s", old_file_name) if os.path.islink(symlink): try: os.unlink(symlink) os.symlink(symlink_path, symlink) except Exception as e: logger.exception("Failed change symlink %s", symlink) def rollback(migrator, database, fake=False, **kwargs): pass