mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 00:36:34 +02:00
Remove CSF support as it's being discontinued on August 31, 2025
- Remove CSF menu item from sidebar navigation - Disable CSF-related URL endpoints in firewall module - Update upgrade process to automatically remove CSF and restore firewalld - Archive CSF template and configuration files - Clean up CSF references in settings and upgrade scripts CSF (ConfigServer Security & Firewall) is shutting down on August 31, 2025. This commit removes CSF integration and ensures firewalld is restored as the default firewall solution during upgrades. Fixes #1473
This commit is contained in:
6
.idea/workspace.xml
generated
6
.idea/workspace.xml
generated
@@ -6,8 +6,8 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="5251c5c9-f2a1-41f2-bc76-10b517091df1" name="Changes" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/dns/dnsManager.py" beforeDir="false" afterPath="$PROJECT_DIR$/dns/dnsManager.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/plogical/acl.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/acl.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/baseTemplate/templates/baseTemplate/index.html" beforeDir="false" afterPath="$PROJECT_DIR$/baseTemplate/templates/baseTemplate/index.html" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/plogical/upgrade.py" beforeDir="false" afterPath="$PROJECT_DIR$/plogical/upgrade.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -119,7 +119,7 @@
|
||||
<workItem from="1754429757112" duration="3503000" />
|
||||
<workItem from="1754433799097" duration="517000" />
|
||||
<workItem from="1754448353513" duration="2970000" />
|
||||
<workItem from="1754511414251" duration="36009000" />
|
||||
<workItem from="1754511414251" duration="40030000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
|
||||
@@ -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'
|
||||
@@ -1638,9 +1638,6 @@
|
||||
<a href="{% url 'modSecRulesPacks' %}" class="menu-item">
|
||||
<span>ModSecurity Rules Packs</span>
|
||||
</a>
|
||||
<a href="{% url 'csf' %}" class="menu-item">
|
||||
<span>CSF</span>
|
||||
</a>
|
||||
<a href="{% url 'imunify' %}" class="menu-item">
|
||||
<span>Imunify 360</span>
|
||||
</a>
|
||||
|
||||
@@ -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'),
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user