SpamAssassin bug fix for ubuntu

This commit is contained in:
usmannasir
2019-01-12 17:52:45 +05:00
parent f9bfccee60
commit a3933ad5dd
6 changed files with 417 additions and 337 deletions

View File

@@ -57,24 +57,24 @@ class InstallCyberPanel:
except: except:
pass pass
command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.3.4-ent-x86_64-linux.tar.gz' command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz'
install.preFlightsChecks.call(command, self.distro, '[installLiteSpeed]', install.preFlightsChecks.call(command, self.distro, '[installLiteSpeed]',
'Install LiteSpeed Webserver Enterprise.', 'Install LiteSpeed Webserver Enterprise.',
1, 1, os.EX_OSERR) 1, 1, os.EX_OSERR)
command = 'tar zxf lsws-5.3.4-ent-x86_64-linux.tar.gz' command = 'tar zxf lsws-5.3.5-ent-x86_64-linux.tar.gz'
install.preFlightsChecks.call(command, self.distro, '[installLiteSpeed]', install.preFlightsChecks.call(command, self.distro, '[installLiteSpeed]',
'Install LiteSpeed Webserver Enterprise.', 'Install LiteSpeed Webserver Enterprise.',
1, 1, os.EX_OSERR) 1, 1, os.EX_OSERR)
writeSerial = open('lsws-5.3.4/serial.no', 'w') writeSerial = open('lsws-5.3.5/serial.no', 'w')
writeSerial.writelines(self.serial) writeSerial.writelines(self.serial)
writeSerial.close() writeSerial.close()
shutil.copy('litespeed/install.sh', 'lsws-5.3.4/') shutil.copy('litespeed/install.sh', 'lsws-5.3.5/')
shutil.copy('litespeed/functions.sh', 'lsws-5.3.4/') shutil.copy('litespeed/functions.sh', 'lsws-5.3.5/')
os.chdir('lsws-5.3.4') os.chdir('lsws-5.3.5')
command = 'chmod +x install.sh' command = 'chmod +x install.sh'
install.preFlightsChecks.call(command, self.distro, '[installLiteSpeed]', install.preFlightsChecks.call(command, self.distro, '[installLiteSpeed]',

View File

@@ -25,6 +25,7 @@ import requests
from processUtilities import ProcessUtilities from processUtilities import ProcessUtilities
from serverStatus.serverStatusUtil import ServerStatusUtil from serverStatus.serverStatusUtil import ServerStatusUtil
import threading as multi import threading as multi
from mailUtilities import mailUtilities
# Use default socket to connect # Use default socket to connect
@@ -64,6 +65,9 @@ class ContainerManager(multi.Thread):
if ACLManager.currentContextPermission(currentACL, 'createContainer') == 0: if ACLManager.currentContextPermission(currentACL, 'createContainer') == 0:
return ACLManager.loadError() return ACLManager.loadError()
mailUtilities.checkHome()
statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w') statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
@@ -92,12 +96,14 @@ class ContainerManager(multi.Thread):
command = 'sudo systemctl start docker' command = 'sudo systemctl start docker'
ServerStatusUtil.executioner(command, statusFile) ServerStatusUtil.executioner(command, statusFile)
cm = ContainerManager(self.name, 'restartGunicorn')
cm.start()
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
"Docker successfully installed.[200]\n", 1) "Docker successfully installed.[200]\n", 1)
time.sleep(2)
cm = ContainerManager(self.name, 'restartGunicorn')
cm.start()
except BaseException, msg: except BaseException, msg:
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1) logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, str(msg) + ' [404].', 1)

View File

@@ -426,6 +426,21 @@ milter_default_action = accept
def configureSpamAssassin(): def configureSpamAssassin():
try: try:
if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu:
confFile = "/etc/mail/spamassassin/local.cf"
confData = open(confFile).readlines()
conf = open(confFile, 'w')
for items in confData:
if items.find('report_safe') > -1 or items.find('rewrite_header') > -1 or items.find('required_score') > -1 or items.find('required_hits') > -1:
conf.write(items.strip('#').strip(' '))
else:
conf.write(items)
conf.close()
command = "groupadd spamd" command = "groupadd spamd"
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))

View File

@@ -547,7 +547,7 @@ class virtualHostUtilities:
writeFile.close() writeFile.close()
p = Process(target=mailUtilities.restartServices, args=('restart',)) p = Process(target=mailUtilities.restartServices, args=())
p.start() p.start()
print "1,None" print "1,None"

View File

@@ -57,22 +57,22 @@ class ServerStatusUtil:
except: except:
pass pass
command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.3-ent-x86_64-linux.tar.gz' command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.3.5-ent-x86_64-linux.tar.gz'
if ServerStatusUtil.executioner(command, statusFile) == 0: if ServerStatusUtil.executioner(command, statusFile) == 0:
return 0 return 0
command = 'tar zxf lsws-5.3-ent-x86_64-linux.tar.gz' command = 'tar zxf lsws-5.3.5-ent-x86_64-linux.tar.gz'
if ServerStatusUtil.executioner(command, statusFile) == 0: if ServerStatusUtil.executioner(command, statusFile) == 0:
return 0 return 0
writeSerial = open('lsws-5.3/serial.no', 'w') writeSerial = open('lsws-5.3.5/serial.no', 'w')
writeSerial.writelines(licenseKey) writeSerial.writelines(licenseKey)
writeSerial.close() writeSerial.close()
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', 'lsws-5.3/') shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', 'lsws-5.3.5/')
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', 'lsws-5.3/') shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', 'lsws-5.3.5/')
os.chdir('lsws-5.3') os.chdir('lsws-5.3.5')
command = 'chmod +x install.sh' command = 'chmod +x install.sh'
if ServerStatusUtil.executioner(command, statusFile) == 0: if ServerStatusUtil.executioner(command, statusFile) == 0:

View File

@@ -1,8 +1,18 @@
app.controller('installDocker', function($scope,$http) {
app.controller('installDocker', function ($scope, $http, $timeout, $window) {
$scope.installDockerStatus = true; $scope.installDockerStatus = true;
$scope.installBoxGen = true;
$scope.dockerInstallBTN = false;
$scope.installDocker = function () { $scope.installDocker = function () {
$scope.installDockerStatus = false; $scope.installDockerStatus = false;
$scope.installBoxGen = true;
$scope.dockerInstallBTN = true;
url = "/docker/installDocker"; url = "/docker/installDocker";
var data = {}; var data = {};
var config = { var config = {
headers: { headers: {
@@ -10,42 +20,91 @@ app.controller('installDocker', function($scope,$http) {
} }
}; };
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) { function ListInitialDatas(response) {
if (response.data.installDockerStatus === 1) $scope.cyberPanelLoading = true;
{ if (response.data.status === 1) {
new PNotify({ $scope.installBoxGen = false;
title: 'Docker installed', getRequestStatus();
text: 'Reloading...',
type: 'success'
});
location.reload();
} }
else { else {
new PNotify({ new PNotify({
title: 'Failed to complete request', title: 'Operation Failed!',
text: response.data.error, text: response.data.error_message,
type: 'error' type: 'error'
}); });
} }
$scope.installDockerStatus = true;
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.installDockerStatus = true; $scope.cyberPanelLoading = true;
new PNotify({ new PNotify({
title: 'Failed to complete request', title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error' type: 'error'
}); });
} }
};
function getRequestStatus() {
$scope.cyberPanelLoading = false;
url = "/serverstatus/switchTOLSWSStatus";
var data = {};
var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) {
if (response.data.abort === 0) {
$scope.requestData = response.data.requestStatus;
$timeout(getRequestStatus, 1000);
}
else {
// Notifications
$scope.cyberPanelLoading = true;
$timeout.cancel();
$scope.requestData = response.data.requestStatus;
if (response.data.installed === 1) {
$timeout(function () {
$window.location.reload();
}, 3000);
}
}
}
function cantLoadInitialDatas(response) {
$scope.cyberPanelLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
} }
}); });
/* Java script code for docker management */ /* Java script code for docker management */
var delayTimer = null; var delayTimer = null;
app.controller('dockerImages', function($scope,$http) { app.controller('dockerImages', function ($scope) {
$scope.tagList = []; $scope.tagList = [];
$scope.imageTag = {}; $scope.imageTag = {};
}); });
@@ -119,8 +178,7 @@ app.controller('runContainer', function($scope,$http) {
function ListInitialDatas(response) { function ListInitialDatas(response) {
if (response.data.createContainerStatus === 1) if (response.data.createContainerStatus === 1) {
{
$scope.currentStatus = "Successful. Redirecting..."; $scope.currentStatus = "Successful. Redirecting...";
window.location.href = "/docker/view/" + $scope.name window.location.href = "/docker/view/" + $scope.name
} }
@@ -138,8 +196,8 @@ app.controller('runContainer', function($scope,$http) {
} }
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$scope.containerCreationLoading = true; $scope.containerCreationLoading = true;
@@ -175,7 +233,7 @@ app.controller('listContainers', function($scope,$http) {
$scope.assignContainer = function (name) { $scope.assignContainer = function (name) {
$("#assign").modal("show"); $("#assign").modal("show");
$scope.assignActive = name; $scope.assignActive = name;
} };
$scope.submitAssignContainer = function () { $scope.submitAssignContainer = function () {
url = "/docker/assignContainer"; url = "/docker/assignContainer";
@@ -199,8 +257,7 @@ app.controller('listContainers', function($scope,$http) {
}); });
window.location.href = '/docker/listContainers'; window.location.href = '/docker/listContainers';
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -209,6 +266,7 @@ app.controller('listContainers', function($scope,$http) {
} }
$("#assign").modal("hide"); $("#assign").modal("hide");
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
console.log("not good"); console.log("not good");
new PNotify({ new PNotify({
@@ -217,7 +275,7 @@ app.controller('listContainers', function($scope,$http) {
}); });
$("#assign").modal("hide"); $("#assign").modal("hide");
} }
} };
$scope.delContainer = function (name, unlisted=false) { $scope.delContainer = function (name, unlisted=false) {
(new PNotify({ (new PNotify({
@@ -296,18 +354,19 @@ app.controller('listContainers', function($scope,$http) {
} }
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
}) })
} }
else else {
{
$("#listFail").fadeIn(); $("#listFail").fadeIn();
$scope.errorMessage = response.data.error_message; $scope.errorMessage = response.data.error_message;
} }
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
@@ -345,8 +404,7 @@ app.controller('listContainers', function($scope,$http) {
if (response.data.containerLogStatus === 1) { if (response.data.containerLogStatus === 1) {
$scope.logs = response.data.containerLog; $scope.logs = response.data.containerLog;
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -355,6 +413,7 @@ app.controller('listContainers', function($scope,$http) {
} }
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -386,13 +445,13 @@ app.controller('listContainers', function($scope,$http) {
console.log($scope.ContainerList); console.log($scope.ContainerList);
$("#listFail").hide(); $("#listFail").hide();
} }
else else {
{
$("#listFail").fadeIn(); $("#listFail").fadeIn();
$scope.errorMessage = response.data.error_message; $scope.errorMessage = response.data.error_message;
} }
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
console.log("not good"); console.log("not good");
} }
@@ -421,20 +480,19 @@ app.controller('listContainers', function($scope,$http) {
$scope.ContainerList = finalData; $scope.ContainerList = finalData;
$("#listFail").hide(); $("#listFail").hide();
} }
else else {
{
$("#listFail").fadeIn(); $("#listFail").fadeIn();
$scope.errorMessage = response.data.error_message; $scope.errorMessage = response.data.error_message;
console.log(response.data); console.log(response.data);
} }
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
console.log("not good"); console.log("not good");
} }
}; };
}); });
@@ -483,8 +541,7 @@ app.controller('viewContainer', function($scope,$http) {
}); });
location.reload(); location.reload();
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -494,6 +551,7 @@ app.controller('viewContainer', function($scope,$http) {
} }
$('#infoLoading').hide(); $('#infoLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
PNotify.error({ PNotify.error({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -529,8 +587,7 @@ app.controller('viewContainer', function($scope,$http) {
$scope.topHead = response.data.processes.Titles; $scope.topHead = response.data.processes.Titles;
$scope.topProcesses = response.data.processes.Processes; $scope.topProcesses = response.data.processes.Processes;
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -540,6 +597,7 @@ app.controller('viewContainer', function($scope,$http) {
} }
$scope.loadingTop = false; $scope.loadingTop = false;
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
PNotify.error({ PNotify.error({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -587,8 +645,7 @@ app.controller('viewContainer', function($scope,$http) {
}); });
window.location.href = '/docker/listContainers'; window.location.href = '/docker/listContainers';
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -597,6 +654,7 @@ app.controller('viewContainer', function($scope,$http) {
} }
$('#actionLoading').hide(); $('#actionLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
PNotify.error({ PNotify.error({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -622,8 +680,7 @@ app.controller('viewContainer', function($scope,$http) {
console.log(response.data.status); console.log(response.data.status);
$scope.status = response.data.status; $scope.status = response.data.status;
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -632,6 +689,7 @@ app.controller('viewContainer', function($scope,$http) {
} }
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
PNotify.error({ PNotify.error({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -678,8 +736,7 @@ app.controller('viewContainer', function($scope,$http) {
}); });
} }
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -690,6 +747,7 @@ app.controller('viewContainer', function($scope,$http) {
$('#containerSettingLoading').hide(); $('#containerSettingLoading').hide();
$scope.savingSettings = false; $scope.savingSettings = false;
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -735,8 +793,7 @@ app.controller('viewContainer', function($scope,$http) {
$scope.status = response.data.status; $scope.status = response.data.status;
$scope.refreshStatus() $scope.refreshStatus()
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -746,6 +803,7 @@ app.controller('viewContainer', function($scope,$http) {
} }
$('#actionLoading').hide(); $('#actionLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
PNotify.error({ PNotify.error({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -778,12 +836,12 @@ app.controller('viewContainer', function($scope,$http) {
if (response.data.containerLogStatus === 1) { if (response.data.containerLogStatus === 1) {
$scope.logs = response.data.containerLog; $scope.logs = response.data.containerLog;
} }
else else {
{
$scope.logs = response.data.error_message; $scope.logs = response.data.error_message;
} }
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
console.log("not good"); console.log("not good");
$scope.logs = "Error loading log"; $scope.logs = "Error loading log";
@@ -801,8 +859,7 @@ app.controller('manageImages', function($scope,$http) {
$scope.pullImage = function (image, tag) { $scope.pullImage = function (image, tag) {
function ListInitialDatas(response) { function ListInitialDatas(response) {
if (response.data.installImageStatus === 1) if (response.data.installImageStatus === 1) {
{
new PNotify({ new PNotify({
title: 'Image pulled successfully', title: 'Image pulled successfully',
text: 'Reloading...', text: 'Reloading...',
@@ -821,6 +878,7 @@ app.controller('manageImages', function($scope,$http) {
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$('#imageLoading').hide(); $('#imageLoading').hide();
new PNotify({ new PNotify({
@@ -828,6 +886,7 @@ app.controller('manageImages', function($scope,$http) {
type: 'error' type: 'error'
}); });
} }
if (image && tag) { if (image && tag) {
$('#imageLoading').show(); $('#imageLoading').show();
@@ -880,8 +939,7 @@ app.controller('manageImages', function($scope,$http) {
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
function ListInitialDatas(response) { function ListInitialDatas(response) {
if (response.data.searchImageStatus === 1) if (response.data.searchImageStatus === 1) {
{
$scope.images = response.data.matches; $scope.images = response.data.matches;
console.log($scope.images) console.log($scope.images)
} }
@@ -896,6 +954,7 @@ app.controller('manageImages', function($scope,$http) {
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
function cantLoadInitialDatas(response) { function cantLoadInitialDatas(response) {
$('#imageLoading').hide(); $('#imageLoading').hide();
new PNotify({ new PNotify({
@@ -932,8 +991,7 @@ app.controller('manageImages', function($scope,$http) {
$scope.tagList[image].push("Load more"); $scope.tagList[image].push("Load more");
} }
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -942,6 +1000,7 @@ app.controller('manageImages', function($scope,$http) {
} }
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -1012,8 +1071,7 @@ app.controller('manageImages', function($scope,$http) {
$('#history').modal('show'); $('#history').modal('show');
$scope.historyList = response.data.history; $scope.historyList = response.data.history;
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -1022,6 +1080,7 @@ app.controller('manageImages', function($scope,$http) {
} }
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
@@ -1082,8 +1141,7 @@ app.controller('manageImages', function($scope,$http) {
}); });
window.location.href = "/docker/manageImages"; window.location.href = "/docker/manageImages";
} }
else else {
{
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',
text: response.data.error_message, text: response.data.error_message,
@@ -1092,6 +1150,7 @@ app.controller('manageImages', function($scope,$http) {
} }
$('#imageLoading').hide(); $('#imageLoading').hide();
} }
function cantLoadInitialData(response) { function cantLoadInitialData(response) {
new PNotify({ new PNotify({
title: 'Unable to complete request', title: 'Unable to complete request',