Skip to content

Commit a288a88

Browse files
committed
security fix: CP-24: Manage Website – Domain Alias (Delete)
1 parent 9a47edc commit a288a88

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

plogical/acl.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from loginSystem.models import Administrator, ACL
88
from django.shortcuts import HttpResponse
99
from packages.models import Package
10-
from websiteFunctions.models import Websites, ChildDomains
10+
from websiteFunctions.models import Websites, ChildDomains, aliasDomains
1111
import json
1212
from subprocess import call, CalledProcessError
1313
from shlex import split
@@ -43,6 +43,16 @@ class ACLManager:
4343
'"dkimManager": 1, "createFTPAccount": 1, "deleteFTPAccount": 1, "listFTPAccounts": 1, "createBackup": 1,' \
4444
' "restoreBackup": 0, "addDeleteDestinations": 0, "scheduleBackups": 0, "remoteBackups": 0, "googleDriveBackups": 1, "manageSSL": 1, ' \
4545
'"hostnameSSL": 0, "mailServerSSL": 0 }'
46+
@staticmethod
47+
def AliasDomainCheck(currentACL, aliasDomain, master):
48+
aliasOBJ = aliasDomains.objects.get(aliasDomain=aliasDomain)
49+
masterOBJ = Websites.objects.get(domain=master)
50+
if currentACL['admin'] == 1:
51+
return 1
52+
elif aliasOBJ.master == masterOBJ:
53+
return 1
54+
else:
55+
return 0
4656

4757
@staticmethod
4858
def CheckPackageOwnership(package, admin, currentACL):

websiteFunctions/website.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,11 @@ def issueAliasSSL(self, userID=None, data=None):
16741674
else:
16751675
return ACLManager.loadErrorJson('sslStatus', 0)
16761676

1677+
if ACLManager.AliasDomainCheck(currentACL, aliasDomain, self.domain) == 1:
1678+
pass
1679+
else:
1680+
return ACLManager.loadErrorJson('sslStatus', 0)
1681+
16771682
sslpath = "/home/" + self.domain + "/public_html"
16781683

16791684
## Create Configurations
@@ -1711,6 +1716,11 @@ def delateAlias(self, userID=None, data=None):
17111716
else:
17121717
return ACLManager.loadErrorJson('deleteAlias', 0)
17131718

1719+
if ACLManager.AliasDomainCheck(currentACL, aliasDomain, self.domain) == 1:
1720+
pass
1721+
else:
1722+
return ACLManager.loadErrorJson('deleteAlias', 0)
1723+
17141724
## Create Configurations
17151725

17161726
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/virtualHostUtilities.py"

0 commit comments

Comments
 (0)