diff --git a/.idea/workspace.xml b/.idea/workspace.xml index f05bb151f..ab6a3c9dd 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -6,8 +6,8 @@ - - + + diff --git a/CyberCP/settings.py b/CyberCP/settings.py index 650f09b0a..21cd676be 100644 --- a/CyberCP/settings.py +++ b/CyberCP/settings.py @@ -193,5 +193,5 @@ MEDIA_URL = '/usr/local/CyberCP/tmp/' MEDIA_ROOT = MEDIA_URL DATA_UPLOAD_MAX_MEMORY_SIZE = 2147483648 -# Security settings for CSF compliance +# Security settings X_FRAME_OPTIONS = 'SAMEORIGIN' \ No newline at end of file diff --git a/baseTemplate/templates/baseTemplate/index.html b/baseTemplate/templates/baseTemplate/index.html index bce3b0de2..b6513911d 100644 --- a/baseTemplate/templates/baseTemplate/index.html +++ b/baseTemplate/templates/baseTemplate/index.html @@ -1638,9 +1638,6 @@ ModSecurity Rules Packs - - CSF - Imunify 360 diff --git a/firewall/templates/firewall/csf.html b/firewall/templates/firewall/csf.html.deprecated similarity index 100% rename from firewall/templates/firewall/csf.html rename to firewall/templates/firewall/csf.html.deprecated diff --git a/firewall/urls.py b/firewall/urls.py index 621e892f1..56e9fc187 100644 --- a/firewall/urls.py +++ b/firewall/urls.py @@ -35,15 +35,15 @@ urlpatterns = [ path('getRulesFiles', views.getRulesFiles, name='getRulesFiles'), path('enableDisableRuleFile', views.enableDisableRuleFile, name='enableDisableRuleFile'), - # CSF - path('csf', views.csf, name='csf'), - path('installCSF', views.installCSF, name='installCSF'), - path('installStatusCSF', views.installStatusCSF, name='installStatusCSF'), - path('removeCSF', views.removeCSF, name='removeCSF'), - path('fetchCSFSettings', views.fetchCSFSettings, name='fetchCSFSettings'), - path('changeStatus', views.changeStatus, name='changeStatus'), - path('modifyPorts', views.modifyPorts, name='modifyPorts'), - path('modifyIPs', views.modifyIPs, name='modifyIPs'), + # CSF - Discontinued on August 31, 2025 + # path('csf', views.csf, name='csf'), + # path('installCSF', views.installCSF, name='installCSF'), + # path('installStatusCSF', views.installStatusCSF, name='installStatusCSF'), + # path('removeCSF', views.removeCSF, name='removeCSF'), + # path('fetchCSFSettings', views.fetchCSFSettings, name='fetchCSFSettings'), + # path('changeStatus', views.changeStatus, name='changeStatus'), + # path('modifyPorts', views.modifyPorts, name='modifyPorts'), + # path('modifyIPs', views.modifyIPs, name='modifyIPs'), # Imunify path('imunify', views.imunify, name='imunify'), diff --git a/plogical/upgrade.py b/plogical/upgrade.py index bf2aed119..fcba7e218 100644 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -3895,91 +3895,24 @@ pm.max_spare_servers = 3 except: pass - #command = 'csf -uf' - #Upgrade.executioner(command, 'fix csf if there', 0) - + # Remove CSF if installed and restore firewalld (CSF is being discontinued on August 31, 2025) if os.path.exists('/etc/csf'): - ##### Function to backup custom csf files and restore - - from datetime import datetime - - # List of files to backup - FILES = [ - "/etc/csf/csf.allow", - "/etc/csf/csf.deny", - "/etc/csf/csf.conf", - "/etc/csf/csf.ignore", - "/etc/csf/csf.rignore", - "/etc/csf/csf.blocklists", - "/etc/csf/csf.dyndns" - ] - - # Directory for backups - BACKUP_DIR = f"/home/cyberpanel/csf_backup_{datetime.now().strftime('%Y%m%d_%H%M%S')}" - - # Backup function - def backup_files(): - os.makedirs(BACKUP_DIR, exist_ok=True) - for file in FILES: - if os.path.exists(file): - shutil.copy(file, BACKUP_DIR) - print(f"Backed up: {file}") - else: - print(f"File not found, skipping: {file}") - - # Restore function - def restore_files(): - for file in FILES: - backup_file = os.path.join(BACKUP_DIR, os.path.basename(file)) - if os.path.exists(backup_file): - try: - shutil.copy(backup_file, file) - print(f"Restored: {file}") - except Exception as e: - print(f"Failed to restore {file}: {str(e)}") - else: - print(f"Backup not found for: {file}") - - # Backup the files - print("Backing up files...") - backup_files() - + print("CSF detected - removing CSF and restoring firewalld...") + print("Note: ConfigServer Firewall (CSF) is being discontinued on August 31, 2025") + + # Remove CSF and restore firewalld execPath = "sudo /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/csf.py" execPath = execPath + " removeCSF" - Upgrade.executioner(execPath, 'Remove CSF before reinstall', 0) - - execPath = "sudo /usr/local/CyberCP/bin/python /usr/local/CyberCP/plogical/csf.py" - execPath = execPath + " installCSF" - Upgrade.executioner(execPath, 'Install CSF', 0) - - # Restore the files AFTER installation - print("Restoring CSF configuration files...") - restore_files() + Upgrade.executioner(execPath, 'Remove CSF and restore firewalld', 0) - # Restart CSF to apply restored configuration - command = 'csf -r' - Upgrade.executioner(command, 'Restart CSF with restored config', 0) + print("CSF has been removed and firewalld has been restored.") + # Remove configservercsf directory if it exists if os.path.exists('/usr/local/CyberCP/configservercsf'): - command = 'rm -f /usr/local/CyberCP/configservercsf/signals.py' - Upgrade.executioner(command, 'remove /usr/local/CyberCP/configservercsf/signals.py', 1) - - sed_commands = [ - 'sed -i "s/url(r\'^configservercsf/path(\'configservercsf/g" /usr/local/CyberCP/CyberCP/urls.py', - 'sed -i "s/from django.conf.urls import url/from django.urls import path/g" /usr/local/CyberCP/configservercsf/urls.py', - 'sed -i "s/import signals/from . import signals/g" /usr/local/CyberCP/configservercsf/apps.py', - 'sed -i "s/url(r\'^$\'/path(\'\'/g" /usr/local/CyberCP/configservercsf/urls.py', - 'sed -i "s|url(r\'^iframe/$\'|path(\'iframe/\'|g" /usr/local/CyberCP/configservercsf/urls.py', - 'sed -i -E "s/from.*, response/from plogical.httpProc import httpProc/g" /usr/local/CyberCP/configservercsf/views.py', - 'find /usr/local/CyberCP -name "*.pyc" -delete', - 'find /usr/local/CyberCP -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true', - 'killall lswsgi' - ] - - for cmd in sed_commands: - Upgrade.executioner(cmd, 'fix csf if there', 1) + command = 'rm -rf /usr/local/CyberCP/configservercsf' + Upgrade.executioner(command, 'Remove configservercsf directory', 1) diff --git a/upgrade.sh b/upgrade.sh index 6e5455f01..b1fa007a6 100644 --- a/upgrade.sh +++ b/upgrade.sh @@ -16,7 +16,8 @@ fi cd /usr/local/CyberCP && /usr/local/CyberCP/bin/python manage.py collectstatic --no-input rm -rf /usr/local/CyberCP/public/static/* cp -R /usr/local/CyberCP/static/* /usr/local/CyberCP/public/static/ -mkdir /usr/local/CyberCP/public/static/csf/ +# CSF support removed - discontinued on August 31, 2025 +# mkdir /usr/local/CyberCP/public/static/csf/ find /usr/local/CyberCP -type d -exec chmod 0755 {} \; find /usr/local/CyberCP -type f -exec chmod 0644 {} \; chmod -R 755 /usr/local/CyberCP/bin