Merge branch 'stable' into v2.1.1

This commit is contained in:
Usman Nasir
2021-04-17 16:23:00 +05:00
3 changed files with 21 additions and 4 deletions

View File

@@ -759,16 +759,17 @@ $cfg['Servers'][$i]['LogoutURL'] = 'phpmyadminsignin.php?logout';
if self.distro == centos:
command = 'yum install --enablerepo=gf-plus -y postfix3 postfix3-ldap postfix3-mysql postfix3-pcre'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
elif self.distro == cent8:
command = 'dnf --nogpg install -y https://mirror.ghettoforge.org/distributions/gf/el/8/gf/x86_64/gf-release-8-11.gf.el8.noarch.rpm'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
command = 'dnf install --enablerepo=gf-plus postfix3 postfix3-mysql -y'
preFlightsChecks.call(command, self.distro, command, command, 1, 1, os.EX_OSERR)
else:
command = 'apt-get -y debconf-utils'
command = 'apt-get -y install debconf-utils'
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
file_name = self.cwd + '/pf.unattend.text'
pf = open(file_name, 'w')
@@ -1336,6 +1337,7 @@ imap_folder_list_limit = 0
preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR)
FirewallUtilities.addRule("tcp", "8090")
FirewallUtilities.addRule("tcp", "7080")
FirewallUtilities.addRule("tcp", "80")
FirewallUtilities.addRule("tcp", "443")
FirewallUtilities.addRule("tcp", "21")

View File

@@ -7,6 +7,18 @@ import smtplib
class CyberCPLogFileWriter:
fileName = "/home/cyberpanel/error-logs.txt"
@staticmethod
def AddFromHeader(sender, message):
try:
import re
if not re.search('^From: ', message, re.MULTILINE):
message = 'From: {}\n{}'.format(sender, message)
return message
except BaseException as msg:
CyberCPLogFileWriter.writeToFile(str(msg) + ' [AddFromHeader]')
@staticmethod
def SendEmail(sender, receivers, message, subject=None, type=None):
try:
@@ -29,9 +41,12 @@ class CyberCPLogFileWriter:
if subject != None:
message = 'Subject: {}\n\n{}'.format(subject, message)
message = CyberCPLogFileWriter.AddFromHeader(sender, message)
smtpServer.sendmail(smtpUserName, receivers, message)
else:
smtpObj = smtplib.SMTP('localhost')
message = CyberCPLogFileWriter.AddFromHeader(sender, message)
smtpObj.sendmail(sender, receivers, message)
except BaseException as msg:
CyberCPLogFileWriter.writeToFile(str(msg))
@@ -107,4 +122,4 @@ Subject: %s
statusFile.writelines(mesg + '\n')
statusFile.close()
except BaseException as msg:
CyberCPLogFileWriter.writeToFile(str(msg) + ' [statusWriter]')
CyberCPLogFileWriter.writeToFile(str(msg) + ' [statusWriter]')

View File

@@ -91,7 +91,7 @@ class CSF(multi.Thread):
for items in data:
if items.find('TCP_IN') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines(
'TCP_IN = "20,21,22,25,53,80,110,995,143,443,465,587,993,995,1025,8090,40110:40210"\n')
'TCP_IN = "20,21,22,25,53,80,110,995,143,443,465,587,993,995,1025,7080,8090,40110:40210"\n')
elif items.find('TCP_OUT') > -1 and items.find('=') > -1 and (items[0] != '#'):
writeToConf.writelines(
'TCP_OUT = "20,21,22,25,43,53,80,110,113,443,587,993,995,8090,40110:40210"\n')