mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 13:56:01 +01:00
rspamdfix
This commit is contained in:
@@ -1133,6 +1133,9 @@ app.controller('Rspamd', function ($scope, $http, $timeout, $window) {
|
|||||||
$('#log_clean').change(function () {
|
$('#log_clean').change(function () {
|
||||||
log_clean = $(this).prop('checked');
|
log_clean = $(this).prop('checked');
|
||||||
});
|
});
|
||||||
|
$('#clamav_Debug').change(function () {
|
||||||
|
clamav_Debug = $(this).prop('checked');
|
||||||
|
});
|
||||||
|
|
||||||
fetchRspamdSettings();
|
fetchRspamdSettings();
|
||||||
|
|
||||||
@@ -1180,6 +1183,11 @@ app.controller('Rspamd', function ($scope, $http, $timeout, $window) {
|
|||||||
} else if (response.data.log_clean === false) {
|
} else if (response.data.log_clean === false) {
|
||||||
$('#log_clean').bootstrapToggle('off');
|
$('#log_clean').bootstrapToggle('off');
|
||||||
}
|
}
|
||||||
|
if (response.data.clamav_Debug === true) {
|
||||||
|
$('#clamav_Debug').bootstrapToggle('on');
|
||||||
|
} else if (response.data.clamav_Debug === false) {
|
||||||
|
$('#clamav_Debug').bootstrapToggle('off');
|
||||||
|
}
|
||||||
|
|
||||||
$scope.max_size = response.data.max_Size;
|
$scope.max_size = response.data.max_Size;
|
||||||
$scope.server = response.data.Server;
|
$scope.server = response.data.Server;
|
||||||
@@ -1189,6 +1197,9 @@ app.controller('Rspamd', function ($scope, $http, $timeout, $window) {
|
|||||||
$scope.non_smtpd_milters = response.data.non_smtpd_milters;
|
$scope.non_smtpd_milters = response.data.non_smtpd_milters;
|
||||||
$scope.read_servers = response.data.read_servers;
|
$scope.read_servers = response.data.read_servers;
|
||||||
$scope.write_servers = response.data.write_servers;
|
$scope.write_servers = response.data.write_servers;
|
||||||
|
$scope.LogFile = response.data.LogFile;
|
||||||
|
$scope.TCPAddr = response.data.TCPAddr;
|
||||||
|
$scope.TCPSocket = response.data.TCPSocket;
|
||||||
// $scope.required_score = response.data.required_score;
|
// $scope.required_score = response.data.required_score;
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@@ -1521,6 +1532,138 @@ app.controller('Rspamd', function ($scope, $http, $timeout, $window) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///ClamAV config
|
||||||
|
|
||||||
|
$scope.CLamAVLoading = true;
|
||||||
|
$scope.ClamAVfailedToSave = true;
|
||||||
|
$scope.ClamAVsuccessfullySaved = true;
|
||||||
|
$scope.ClamAVcouldNotConnect = true;
|
||||||
|
|
||||||
|
$scope.saveclamavConfigurations = function () {
|
||||||
|
$scope.CLamAVLoading = false;
|
||||||
|
url = "/emailPremium/saveclamavConfigurations";
|
||||||
|
var data = {
|
||||||
|
LogFile: $scope.LogFile,
|
||||||
|
TCPAddr: $scope.TCPAddr,
|
||||||
|
TCPSocket: $scope.TCPSocket,
|
||||||
|
clamav_Debug: clamav_Debug
|
||||||
|
};
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
|
if (response.data.saveStatus === 1) {
|
||||||
|
|
||||||
|
$scope.CLamAVfailedToSave = true;
|
||||||
|
$scope.CLamAVsuccessfullySaved = false;
|
||||||
|
$scope.CLamAVLoading = true;
|
||||||
|
$scope.CLamAVcouldNotConnect = true;
|
||||||
|
|
||||||
|
location.reload();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$scope.errorMessage = response.data.error_message;
|
||||||
|
|
||||||
|
$scope.CLamAVfailedToSave = false;
|
||||||
|
$scope.CLamAVsuccessfullySaved = true;
|
||||||
|
$scope.CLamAVLoading = true;
|
||||||
|
$scope.CLamAVcouldNotConnect = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.CLamAVfailedToSave = true;
|
||||||
|
$scope.CLamAVsuccessfullySaved = true;
|
||||||
|
$scope.CLamAVLoading = true;
|
||||||
|
$scope.CLamAVcouldNotConnect = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.FetchRspamdLog = function () {
|
||||||
|
url = "/emailPremium/FetchRspamdLog";
|
||||||
|
var data = {
|
||||||
|
|
||||||
|
};
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
console.log(response.data)
|
||||||
|
$scope.RspamdlogsData = response.data.logsdata;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
console.log( response.data.error_message)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
console.log(response)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$scope.RestartRspamd = function () {
|
||||||
|
|
||||||
|
$scope.RspamdLoading = false;
|
||||||
|
url = "/emailPremium/RestartRspamd";
|
||||||
|
var data = {
|
||||||
|
|
||||||
|
};
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.RspamdLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
|
console.log(response.data)
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'SUccessfully Restarted.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.RspamdLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Error',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//// Email Debugger
|
//// Email Debugger
|
||||||
|
|||||||
@@ -10,30 +10,38 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "Rspamd Configurations!" %} - <a target="_blank"
|
<h2>{% trans "Rspamd Configurations!" %} -
|
||||||
href="http://go.cyberpanel.net/SpamAssassin"
|
|
||||||
style="height: 23px;line-height: 21px;"
|
|
||||||
class="btn btn-border btn-alt border-red btn-link font-red"
|
|
||||||
title=""><span>{% trans "Rspamd Docs" %}</span></a>
|
|
||||||
</h2>
|
</h2>
|
||||||
<p>{% trans "On this page you can configure RSPAMD settings." %}</p>
|
<p>{% trans "On this page you can configure RSPAMD settings." %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-controller="Rspamd" class="example-box-wrapper">
|
<div ng-controller="Rspamd" class="example-box-wrapper">
|
||||||
<div class="panel panel-body">
|
<div class="panel panel-body">
|
||||||
<div style="width: 100%; margin: 0 auto">
|
<div class="col-lg-12" style="float: left">
|
||||||
<div class="col-lg-10" style="float: left">
|
|
||||||
<h3 class="content-box-header">
|
<h3 class="content-box-header">
|
||||||
{% trans "Rspamd" %} <img ng-hide="RspamdLoading" src="/static/images/loading.gif">
|
{% trans "Rspamd" %} <img ng-hide="RspamdLoading" src="/static/images/loading.gif">
|
||||||
|
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="width: 100%; margin: 0 auto">
|
||||||
|
|
||||||
|
<div ng-hide="uninstallbutton" class="col-lg-3" style="float: left">
|
||||||
|
<button type="button" data-toggle="modal" data-target="#ViewRspamdlog" ng-click="FetchRspamdLog()"
|
||||||
|
class="btn btn-primaryb btn-lg btn-block">{% trans "View Rsmapd Log" %}</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div ng-hide="uninstallbutton" class="col-lg-2" style="float: left">
|
<div ng-hide="uninstallbutton" class="col-lg-2" style="float: left">
|
||||||
|
|
||||||
<button type="button" data-toggle="modal" data-target="#UninstallRspamdmodal"
|
<button type="button" data-toggle="modal" data-target="#UninstallRspamdmodal"
|
||||||
class="btn btn-danger btn-lg btn-block">{% trans "uninstall." %}</button>
|
class="btn btn-danger btn-lg btn-block">{% trans "uninstall." %}</button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div ng-hide="uninstallbutton" class="col-lg-2" style="float: left">
|
||||||
|
|
||||||
|
<button type="button" ng-click="RestartRspamd()"
|
||||||
|
class="btn btn-gray btn-lg btn-block">{% trans "Restart" %}</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#-------------------------------un install process----------------------------------#}
|
{#-------------------------------un install process----------------------------------#}
|
||||||
@@ -247,6 +255,78 @@
|
|||||||
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-----------------------------------------ClamAv 2--------------------------->
|
||||||
|
<div style="padding: 2%" class="col-md-12">
|
||||||
|
<h3 class="content-box-header">
|
||||||
|
{% trans "ClamAV Configuration" %}
|
||||||
|
<img ng-hide="CLamAVLoading"
|
||||||
|
src="/static/images/loading.gif">
|
||||||
|
</h3>
|
||||||
|
<form action="/" id="createPackages" class="form-horizontal bordered-row">
|
||||||
|
<div ng-hide="phpDetailsBox" class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">TCPSocket</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" class="form-control" ng-model="TCPSocket"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div ng-hide="phpDetailsBox" class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">TCPAddr</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" class="form-control" ng-model="TCPAddr"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div ng-hide="phpDetailsBox" class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">Debug</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="checkbox" id="clamav_Debug" data-toggle="toggle">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div ng-hide="phpDetailsBox" class="form-group">
|
||||||
|
<label class="col-sm-4 control-label">Log Path</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" class="form-control" ng-model="LogFile"
|
||||||
|
required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"></label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button" ng-click="saveclamavConfigurations()"
|
||||||
|
class="btn btn-primary btn-lg btn-block">{% trans "Save changes." %}</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"></label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
|
||||||
|
<div ng-hide="ClamAVfailedToSave" class="alert alert-danger">
|
||||||
|
<p>{% trans "Failed to save ClamAV configurations. Error message: " %}
|
||||||
|
{$ errorMessage $}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-hide="ClamAVsuccessfullySaved" class="alert alert-success">
|
||||||
|
<p>{% trans "ClamAV configurations successfully saved." %}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-hide="ClamAVcouldNotConnect" class="alert alert-danger">
|
||||||
|
<p>{% trans "Could not connect. Please refresh this page." %} </p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-----------------------------------------postfix--------------------------->
|
<!-----------------------------------------postfix--------------------------->
|
||||||
<div style="padding: 2%" class="col-md-12">
|
<div style="padding: 2%" class="col-md-12">
|
||||||
<h3 class="content-box-header">
|
<h3 class="content-box-header">
|
||||||
@@ -396,6 +476,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!------------------Rspamd View Log -------->
|
||||||
|
<div id="ViewRspamdlog" ng-model="ViewRspamdlog" class="modal fade " role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
|
||||||
|
<!-- Modal content-->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">{% trans "Uninstall Rspamd" %}
|
||||||
|
</h4>
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<textarea ng-model="RspamdlogsData" class="form-control" rows="30">{{ Rspamdlogs }}</textarea>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-primary" data-dismiss="modal" >yes
|
||||||
|
</button>
|
||||||
|
<button type="button"
|
||||||
|
class="btn btn-default" data-dismiss="modal">
|
||||||
|
Close
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -52,9 +52,11 @@ urlpatterns = [
|
|||||||
url(r'^saveRspamdConfigurations$', views.saveRspamdConfigurations, name='saveRspamdConfigurations'),
|
url(r'^saveRspamdConfigurations$', views.saveRspamdConfigurations, name='saveRspamdConfigurations'),
|
||||||
url(r'^savepostfixConfigurations$', views.savepostfixConfigurations, name='savepostfixConfigurations'),
|
url(r'^savepostfixConfigurations$', views.savepostfixConfigurations, name='savepostfixConfigurations'),
|
||||||
url(r'^saveRedisConfigurations$', views.saveRedisConfigurations, name='saveRedisConfigurations'),
|
url(r'^saveRedisConfigurations$', views.saveRedisConfigurations, name='saveRedisConfigurations'),
|
||||||
url(r'^saveRedisConfigurations$', views.saveRedisConfigurations, name='saveRedisConfigurations'),
|
url(r'^saveclamavConfigurations$', views.saveclamavConfigurations, name='saveclamavConfigurations'),
|
||||||
url(r'^unistallRspamd$', views.unistallRspamd, name='unistallRspamd'),
|
url(r'^unistallRspamd$', views.unistallRspamd, name='unistallRspamd'),
|
||||||
url(r'^uninstallStatusRspamd$', views.uninstallStatusRspamd, name='uninstallStatusRspamd'),
|
url(r'^uninstallStatusRspamd$', views.uninstallStatusRspamd, name='uninstallStatusRspamd'),
|
||||||
|
url(r'^FetchRspamdLog$', views.FetchRspamdLog, name='FetchRspamdLog'),
|
||||||
|
url(r'^RestartRspamd$', views.RestartRspamd, name='RestartRspamd'),
|
||||||
|
|
||||||
url(r'^EmailDebugger$', views.EmailDebugger, name='EmailDebugger'),
|
url(r'^EmailDebugger$', views.EmailDebugger, name='EmailDebugger'),
|
||||||
|
|
||||||
|
|||||||
@@ -1487,6 +1487,39 @@ def fetchRspamdSettings(request):
|
|||||||
read_servers = j[1]
|
read_servers = j[1]
|
||||||
# logging.CyberCPLogFileWriter.writeToFile(str(read_servers) + "read_servers")
|
# logging.CyberCPLogFileWriter.writeToFile(str(read_servers) + "read_servers")
|
||||||
|
|
||||||
|
#ClamAV configs
|
||||||
|
|
||||||
|
clamav_Debug = True
|
||||||
|
LogFile = ''
|
||||||
|
TCPAddr = ''
|
||||||
|
TCPSocket = ''
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
|
||||||
|
pass
|
||||||
|
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
|
||||||
|
clamavconfpath = "/etc/clamav/clamd.conf"
|
||||||
|
command = "sudo cat " + clamavconfpath
|
||||||
|
data = ProcessUtilities.outputExecutioner(command).splitlines()
|
||||||
|
for items in data:
|
||||||
|
if items.find('TCPSocket') > -1:
|
||||||
|
tempData = items.split(' ')
|
||||||
|
TCPSocket = tempData[1]
|
||||||
|
if items.find('TCPAddr') > -1:
|
||||||
|
tempData = items.split(' ')
|
||||||
|
TCPAddr = tempData[1]
|
||||||
|
if items.find('LogFile') > -1:
|
||||||
|
tempData = items.split(' ')
|
||||||
|
LogFile = tempData[1]
|
||||||
|
if items.find('Debug') > -1:
|
||||||
|
if items.find('Debug true') < 0:
|
||||||
|
clamav_Debug = False
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
clamav_Debug = True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
final_dic = {'fetchStatus': 1,
|
final_dic = {'fetchStatus': 1,
|
||||||
'installed': 1,
|
'installed': 1,
|
||||||
'enabled': enabled,
|
'enabled': enabled,
|
||||||
@@ -1499,7 +1532,12 @@ def fetchRspamdSettings(request):
|
|||||||
'smtpd_milters': smtpd_milters,
|
'smtpd_milters': smtpd_milters,
|
||||||
'non_smtpd_milters': non_smtpd_milters,
|
'non_smtpd_milters': non_smtpd_milters,
|
||||||
'read_servers': read_servers,
|
'read_servers': read_servers,
|
||||||
'write_servers': write_servers
|
'write_servers': write_servers,
|
||||||
|
'clamav_Debug': clamav_Debug,
|
||||||
|
'LogFile': LogFile,
|
||||||
|
'TCPAddr': TCPAddr,
|
||||||
|
'TCPSocket': TCPSocket,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1624,6 +1662,44 @@ def saveRedisConfigurations(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def saveclamavConfigurations(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if currentACL['admin'] == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson('saveStatus', 0)
|
||||||
|
|
||||||
|
try:
|
||||||
|
if request.method == 'POST':
|
||||||
|
data = json.loads(request.body)
|
||||||
|
tempfilepath = "/home/cyberpanel/saveclamavConfigurations"
|
||||||
|
json_object = json.dumps(data, indent=4)
|
||||||
|
writeDataToFile = open(tempfilepath, "w")
|
||||||
|
writeDataToFile.write(json_object)
|
||||||
|
writeDataToFile.close()
|
||||||
|
|
||||||
|
# status, msg = mailUtilities.changeRspamdConfig(request.body)
|
||||||
|
execPath = "/usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/plogical/mailUtilities.py"
|
||||||
|
execPath = execPath + " changeclamavConfig"
|
||||||
|
output = ProcessUtilities.outputExecutioner(execPath)
|
||||||
|
|
||||||
|
data_ret = {'saveStatus': 1, 'error_message': 'None'}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
data_ret = {'saveStatus': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(data_ret)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
def unistallRspamd(request):
|
def unistallRspamd(request):
|
||||||
try:
|
try:
|
||||||
logging.CyberCPLogFileWriter.writeToFile("unistallRspamd...1")
|
logging.CyberCPLogFileWriter.writeToFile("unistallRspamd...1")
|
||||||
@@ -1716,6 +1792,62 @@ def uninstallStatusRspamd(request):
|
|||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
def FetchRspamdLog(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if currentACL['admin'] == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson()
|
||||||
|
|
||||||
|
fileName = "/var/log/rspamd/rspamd.log"
|
||||||
|
try:
|
||||||
|
command = "sudo tail -100 " + fileName
|
||||||
|
fewLinesOfLogFile = ProcessUtilities.outputExecutioner(command)
|
||||||
|
status = {"status": 1, "logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||||
|
final_json = json.dumps(status)
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
except:
|
||||||
|
status = {"status": 1, "logstatus": 1, "logsdata": 'Emtpy File.'}
|
||||||
|
final_json = json.dumps(status)
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
except KeyError:
|
||||||
|
final_dic = {'abort': 1, 'installed': 0,
|
||||||
|
'error_message': "Not Logged In, please refresh the page or login again."}
|
||||||
|
final_json = json.dumps(final_dic)
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
|
def RestartRspamd(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if currentACL['admin'] == 1:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
return ACLManager.loadErrorJson()
|
||||||
|
try:
|
||||||
|
command = "systemctl restart rspamd"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
command = "systemctl restart clamav-daemon"
|
||||||
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
|
dic = {'status': 1, 'error_message': 'None',}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
except BaseException as msg:
|
||||||
|
dic = {'status': 0, 'error_message': str(msg)}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
except KeyError:
|
||||||
|
dic = {'status': 0, 'error_message': str("Not Logged In, please refresh the page or login again.")}
|
||||||
|
json_data = json.dumps(dic)
|
||||||
|
return HttpResponse(json_data)
|
||||||
|
|
||||||
|
|
||||||
##Email Debugger
|
##Email Debugger
|
||||||
|
|
||||||
def EmailDebugger(request):
|
def EmailDebugger(request):
|
||||||
|
|||||||
@@ -759,8 +759,8 @@ fileManager.controller('fileManagerCtrl', function ($scope, $http, FileUploader,
|
|||||||
$scope.getFileContents = function () {
|
$scope.getFileContents = function () {
|
||||||
|
|
||||||
|
|
||||||
console.log("selectedfile"+ allFilesAndFolders)
|
// console.log("selectedfile"+ allFilesAndFolders)
|
||||||
console.log("currentpath"+ $scope.currentRPath)
|
// console.log("currentpath"+ $scope.currentRPath)
|
||||||
var completePathForFile = $scope.currentRPath + "/" + allFilesAndFolders[0];
|
var completePathForFile = $scope.currentRPath + "/" + allFilesAndFolders[0];
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -679,7 +679,6 @@ FixStaleSocket true
|
|||||||
LocalSocketMode 666
|
LocalSocketMode 666
|
||||||
ScanMail true
|
ScanMail true
|
||||||
ScanArchive true
|
ScanArchive true
|
||||||
Debug false
|
|
||||||
#LogFile /var/log/clamd.scan/clamav.log
|
#LogFile /var/log/clamd.scan/clamav.log
|
||||||
"""
|
"""
|
||||||
writeToFile = open('/etc/clamd.d/scan.conf', 'w')
|
writeToFile = open('/etc/clamd.d/scan.conf', 'w')
|
||||||
@@ -975,6 +974,57 @@ LogFile /var/log/clamav/clamav.log
|
|||||||
str((msg) + " [changeRedisxConfig]")
|
str((msg) + " [changeRedisxConfig]")
|
||||||
print(0, str(msg))
|
print(0, str(msg))
|
||||||
return [0, str(msg) + " [changeRedisxConfig]"]
|
return [0, str(msg) + " [changeRedisxConfig]"]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def changeclamavConfig(install, changeclamavConfig):
|
||||||
|
try:
|
||||||
|
tempfilepath = "/home/cyberpanel/saveclamavConfigurations"
|
||||||
|
file = open(tempfilepath, "r")
|
||||||
|
jsondata1 = file.read()
|
||||||
|
jsondata = json.loads(jsondata1)
|
||||||
|
file.close()
|
||||||
|
LogFile= jsondata['LogFile']
|
||||||
|
TCPAddr= jsondata['TCPAddr']
|
||||||
|
TCPSocket= jsondata['TCPSocket']
|
||||||
|
clamav_Debug= jsondata['clamav_Debug']
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
|
||||||
|
pass
|
||||||
|
elif ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu or ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu20:
|
||||||
|
clamavconfpath = "/etc/clamav/clamd.conf"
|
||||||
|
f = open(clamavconfpath, "r")
|
||||||
|
dataa = f.read()
|
||||||
|
f.close()
|
||||||
|
data = dataa.splitlines()
|
||||||
|
|
||||||
|
writeDataToFile = open(clamavconfpath, "w")
|
||||||
|
for i in data:
|
||||||
|
if i.find('TCPSocket') > -1:
|
||||||
|
newitem = 'TCPSocket %s' % TCPSocket
|
||||||
|
writeDataToFile.writelines(newitem + '\n')
|
||||||
|
elif i.find('TCPAddr') > -1:
|
||||||
|
newitem = 'TCPAddr %s' % TCPAddr
|
||||||
|
writeDataToFile.writelines(newitem + '\n')
|
||||||
|
elif i.find('LogFile') > -1:
|
||||||
|
newitem = 'LogFile %s' % LogFile
|
||||||
|
writeDataToFile.writelines(newitem + '\n')
|
||||||
|
elif i.find('Debug =') > -1:
|
||||||
|
if clamav_Debug == True:
|
||||||
|
newitem = 'Debug true'
|
||||||
|
writeDataToFile.writelines(newitem + '\n')
|
||||||
|
elif clamav_Debug == False:
|
||||||
|
newitem = 'Debug false'
|
||||||
|
writeDataToFile.writelines(newitem + '\n')
|
||||||
|
else:
|
||||||
|
writeDataToFile.writelines(i + '\n')
|
||||||
|
|
||||||
|
|
||||||
|
return 1, 'None'
|
||||||
|
except BaseException as msg:
|
||||||
|
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[changeclamavConfig]")
|
||||||
|
str((msg) + " [changeclamavConfig]")
|
||||||
|
print(0, str(msg))
|
||||||
|
return [0, str(msg) + " [changeclamavConfig]"]
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def installMailScanner(install, SpamAssassin):
|
def installMailScanner(install, SpamAssassin):
|
||||||
try:
|
try:
|
||||||
@@ -2162,6 +2212,8 @@ def main():
|
|||||||
mailUtilities.changePostfixConfig("install", "changePostfixConfig")
|
mailUtilities.changePostfixConfig("install", "changePostfixConfig")
|
||||||
elif args.function == 'changeRedisxConfig':
|
elif args.function == 'changeRedisxConfig':
|
||||||
mailUtilities.changeRedisxConfig("install", "changeRedisxConfig")
|
mailUtilities.changeRedisxConfig("install", "changeRedisxConfig")
|
||||||
|
elif args.function == 'changeclamavConfig':
|
||||||
|
mailUtilities.changeclamavConfig("install", "changeclamavConfig")
|
||||||
elif args.function == 'AfterEffects':
|
elif args.function == 'AfterEffects':
|
||||||
mailUtilities.AfterEffects(args.domain)
|
mailUtilities.AfterEffects(args.domain)
|
||||||
elif args.function == "ResetEmailConfigurations":
|
elif args.function == "ResetEmailConfigurations":
|
||||||
|
|||||||
Reference in New Issue
Block a user