mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-10-26 07:46:35 +01:00
Changes to modsec
This commit is contained in:
@@ -104,6 +104,7 @@
|
||||
<label class="col-sm-4 control-label">SecDebugLogLevel</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="selector" style="width: 79px;"><span style="width: 57px; -moz-user-select: none;">{$ SecDebugLogLevel $}</span><select ng-model="SecDebugLogLevel" class="custom-select">
|
||||
<option>0</option>
|
||||
<option>1</option>
|
||||
<option>2</option>
|
||||
<option>3</option>
|
||||
@@ -120,17 +121,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label">SecAuditLogParts</label>
|
||||
<div class="col-sm-6">
|
||||
<div class="selector" style="width: 79px;"><span style="width: 57px; -moz-user-select: none;">{$ SecAuditLogParts $}</span><select ng-model="SecAuditLogParts" class="custom-select">
|
||||
<option>A</option>
|
||||
<option>AB</option>
|
||||
<option>ABI</option>
|
||||
<option>ABIJ</option>
|
||||
<option>ABIJD</option>
|
||||
<option>ABIJDE</option>
|
||||
<option>ABIJDEF</option>
|
||||
<option>ABIJDEFH</option>
|
||||
<option>ABIJDEFHZ</option>
|
||||
</select><i class="glyph-icon icon-caret-down"></i></div>
|
||||
<input placeholder="ABIJDEFHZ" type="text" class="form-control" ng-model="SecAuditLogParts" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -687,8 +687,8 @@ class preFlightsChecks:
|
||||
|
||||
count = 0
|
||||
while (1):
|
||||
#command = "wget http://cyberpanel.net/CyberPanel.1.7.0.tar.gz"
|
||||
command = "wget http://cyberpanel.net/CyberPanelTemp.tar.gz"
|
||||
command = "wget http://cyberpanel.net/CyberPanel.1.7.1.tar.gz"
|
||||
#command = "wget http://cyberpanel.net/CyberPanelTemp.tar.gz"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
if res == 1:
|
||||
@@ -707,8 +707,8 @@ class preFlightsChecks:
|
||||
|
||||
count = 0
|
||||
while(1):
|
||||
#command = "tar zxf CyberPanel.1.7.0.tar.gz"
|
||||
command = "tar zxf CyberPanelTemp.tar.gz"
|
||||
command = "tar zxf CyberPanel.1.7.1.tar.gz"
|
||||
#command = "tar zxf CyberPanelTemp.tar.gz"
|
||||
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<div class="col-md-8 col-lg-6 clearfix center-margin">
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<h3 class="text-transform-upr font-size-17">CyberPanel Ent<span class="opacity-80">v 1.7</span></h3>
|
||||
<h3 class="text-transform-upr font-size-17">CyberPanel <span class="opacity-80">v 1.7</span></h3>
|
||||
<p class="font-gray">Web Hosting Control Panel</p>
|
||||
<div class="divider"></div>
|
||||
<ul class="reset-ul">
|
||||
|
||||
@@ -148,7 +148,7 @@ def loadLoginPage(request):
|
||||
firstName="Cyber",lastName="Panel", acl=acl)
|
||||
admin.save()
|
||||
|
||||
vers = version(currentVersion="1.7",build=0)
|
||||
vers = version(currentVersion="1.7",build=1)
|
||||
vers.save()
|
||||
|
||||
package = Package(admin=admin, packageName="Default", diskSpace=1000,
|
||||
|
||||
@@ -57,11 +57,11 @@ class modSec:
|
||||
module mod_security {
|
||||
modsecurity on
|
||||
modsecurity_rules `
|
||||
SecDebugLogLevel 9
|
||||
SecDebugLogLevel 0
|
||||
SecDebugLog /usr/local/lsws/logs/modsec.log
|
||||
SecAuditEngine on
|
||||
SecAuditLogRelevantStatus "^(?:5|4(?!04))"
|
||||
SecAuditLogParts ABIJDEFHZ
|
||||
SecAuditLogParts AFH
|
||||
SecAuditLogType Serial
|
||||
SecAuditLog /usr/local/lsws/logs/auditmodsec.log
|
||||
SecRuleEngine On
|
||||
|
||||
@@ -32,7 +32,7 @@ class Upgrade:
|
||||
r = requests.get(url, verify=True)
|
||||
data = json.loads(r.text)
|
||||
version_number = str(data['version'])
|
||||
version_build = str(data['build'])
|
||||
version_build = str(0)
|
||||
return (version_number + "." + version_build + ".tar.gz")
|
||||
except BaseException, msg:
|
||||
Upgrade.stdOut(str(msg) + ' [downloadLink]')
|
||||
@@ -126,8 +126,6 @@ class Upgrade:
|
||||
|
||||
command = "virtualenv --system-site-packages /usr/local/CyberCP"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
|
||||
except OSError, msg:
|
||||
Upgrade.stdOut(str(msg) + " [setupVirtualEnv]")
|
||||
os._exit(0)
|
||||
@@ -308,7 +306,65 @@ WantedBy=multi-user.target"""
|
||||
vers.build = latest['build']
|
||||
vers.save()
|
||||
|
||||
@staticmethod
|
||||
def applyLoginSystemMigrations():
|
||||
try:
|
||||
|
||||
cwd = os.getcwd()
|
||||
os.chdir('/usr/local/CyberCP')
|
||||
|
||||
try:
|
||||
##
|
||||
command = "python manage.py makemigrations loginSystem"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
command = "python manage.py migrate loginSystem"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
from loginSystem.models import Administrator, ACL
|
||||
|
||||
adminACL = ACL(name='admin', adminStatus=1)
|
||||
adminACL.save()
|
||||
|
||||
## Reseller ACL
|
||||
|
||||
resellerACL = ACL(name='reseller',
|
||||
createNewUser=1,
|
||||
deleteUser=1,
|
||||
createWebsite=1,
|
||||
resellerCenter=1,
|
||||
modifyWebsite=1,
|
||||
suspendWebsite=1,
|
||||
deleteWebsite=1,
|
||||
createPackage=1,
|
||||
deletePackage=1,
|
||||
modifyPackage=1,
|
||||
createNameServer=1,
|
||||
restoreBackup=1,
|
||||
)
|
||||
resellerACL.save()
|
||||
|
||||
## User ACL
|
||||
|
||||
userACL = ACL(name='user')
|
||||
userACL.save()
|
||||
|
||||
allUsers = Administrator.objects.all()
|
||||
|
||||
for items in allUsers:
|
||||
|
||||
if items.userName == 'admin':
|
||||
items.acl = adminACL
|
||||
else:
|
||||
items.acl = userACL
|
||||
|
||||
os.chdir(cwd)
|
||||
|
||||
except OSError, msg:
|
||||
Upgrade.stdOut(str(msg) + " [applyLoginSystemMigrations]")
|
||||
os._exit(0)
|
||||
|
||||
@staticmethod
|
||||
def upgrade():
|
||||
@@ -316,16 +372,19 @@ WantedBy=multi-user.target"""
|
||||
os.chdir("/usr/local")
|
||||
|
||||
|
||||
|
||||
## Current Version
|
||||
|
||||
Version = version.objects.get(pk=1)
|
||||
|
||||
if Version.currentVersion == '1.7' and Version.build == 0:
|
||||
Upgrade.stdOut('You can not upgrade to v1.7.1 via automatic upgrade.')
|
||||
os._exit(0)
|
||||
|
||||
##
|
||||
|
||||
versionNumbring = Upgrade.downloadLink()
|
||||
|
||||
|
||||
if os.path.exists('/usr/local/CyberPanel.' + versionNumbring):
|
||||
os.remove('/usr/local/CyberPanel.' + versionNumbring)
|
||||
|
||||
@@ -366,24 +425,6 @@ WantedBy=multi-user.target"""
|
||||
|
||||
Upgrade.stdOut("Settings file backed up.")
|
||||
|
||||
## Remove Core Files
|
||||
|
||||
count = 1
|
||||
while (1):
|
||||
command = "rm -rf /usr/local/CyberCP"
|
||||
res = subprocess.call(shlex.split(command))
|
||||
|
||||
if res == 1:
|
||||
count = count + 1
|
||||
Upgrade.stdOut(
|
||||
"Trying to remove old version, trying again, try number: " + str(count))
|
||||
if count == 3:
|
||||
Upgrade.stdOut("Failed to remove old version! [upgrade]")
|
||||
os._exit(0)
|
||||
else:
|
||||
Upgrade.stdOut("Old version successfully removed!")
|
||||
break
|
||||
|
||||
## Extract Latest files
|
||||
|
||||
count = 1
|
||||
@@ -525,6 +566,10 @@ WantedBy=multi-user.target"""
|
||||
subprocess.call(shlex.split(command))
|
||||
|
||||
|
||||
#if Version.currentVersion == '1.7' and Version.build == 0:
|
||||
# Upgrade.applyLoginSystemMigrations()
|
||||
|
||||
|
||||
## Upgrade OpenLiteSpeed
|
||||
|
||||
Upgrade.upgradeOpenLiteSpeed()
|
||||
|
||||
@@ -622,6 +622,20 @@ def submitACLModifications(request):
|
||||
|
||||
acl.save()
|
||||
|
||||
if int(data['adminStatus']) == 1:
|
||||
allUsers = acl.administrator_set.all()
|
||||
|
||||
for items in allUsers:
|
||||
items.type = 1
|
||||
items.save()
|
||||
else:
|
||||
allUsers = acl.administrator_set.all()
|
||||
|
||||
for items in allUsers:
|
||||
items.type = 3
|
||||
items.save()
|
||||
|
||||
|
||||
finalResponse = { 'status': 1}
|
||||
else:
|
||||
finalResponse = ACLManager.loadErrorJson()
|
||||
|
||||
Reference in New Issue
Block a user