Implement ImunifyAV asset management and routing

- Added a static method to ensure ImunifyAV assets are created and permissions set correctly in CageFS.py.
- Updated the URL routing in urls.py to include paths for ImunifyAV, supporting both legacy and new routes.
- Modified the ImunifyAV HTML template to use Django's URL template tag for better maintainability.
- Enhanced the cyberpanel_fixes.sh script to ensure ImunifyAV UI assets are installed during fixes.
- Improved database user resolution and password handling in mysqlUtilities.py for better security and reliability.

This update enhances the integration and management of ImunifyAV within the CyberPanel environment.
This commit is contained in:
Master3395
2025-11-15 23:25:13 +01:00
parent 34f10cebe3
commit 0aca2a5aaf
8 changed files with 352 additions and 13 deletions

View File

@@ -249,6 +249,30 @@ pattern_to_watch = ^/home/.+?/(public_html|public_ftp|private_html)(/.*)?$
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)
@staticmethod
def _ensure_imunifyav_assets(statusFile):
try:
commands = [
'mkdir -p /etc/sysconfig/imunify360/generic',
'mkdir -p /usr/local/CyberCP/public/imunifyav',
'chown -R lscpd:lscpd /usr/local/CyberCP/public/imunifyav 2>/dev/null || true',
'chmod 755 /usr/local/CyberCP/public/imunifyav 2>/dev/null || true',
'chown -R lscpd:lscpd /etc/sysconfig/imunify360 2>/dev/null || true'
]
for command in commands:
ServerStatusUtil.executioner(command, statusFile)
if os.path.exists('/etc/redhat-release'):
pkg_cmd = 'yum install -y imunify-ui-generic imunify-antivirus || yum reinstall -y imunify-ui-generic'
else:
pkg_cmd = 'apt-get update -y >/dev/null 2>&1 && apt-get install -y imunify-antivirus || true'
ServerStatusUtil.executioner(pkg_cmd, statusFile)
except BaseException as msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
f"ImunifyAV asset verification warning: {str(msg)}\n", 1)
@staticmethod
def submitinstallImunifyAV():
try:
@@ -327,6 +351,8 @@ ui_path_owner = lscpd:lscpd
command = 'bash imav-deploy.sh --yes'
ServerStatusUtil.executioner(command, statusFile)
CageFS._ensure_imunifyav_assets(statusFile)
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"ImunifyAV reinstalled..\n", 1)