mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
dkim fix for subdomains
This commit is contained in:
@@ -15,6 +15,8 @@ from plogical.backupManager import BackupManager
|
||||
import userManagment.views as um
|
||||
from packages.packagesManager import PackagesManager
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from firewall.firewallManager import FirewallManager
|
||||
from serverLogs.views import getLogsFromFile
|
||||
|
||||
class CloudManager:
|
||||
def __init__(self, data=None, admin = None):
|
||||
@@ -674,3 +676,59 @@ class CloudManager:
|
||||
return HttpResponse(json_data)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def getSSHConfigs(self):
|
||||
try:
|
||||
fm = FirewallManager()
|
||||
return fm.getSSHConfigs(self.admin.pk, self.data)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def saveSSHConfigs(self):
|
||||
try:
|
||||
fm = FirewallManager()
|
||||
return fm.saveSSHConfigs(self.admin.pk, self.data)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def deleteSSHKey(self):
|
||||
try:
|
||||
fm = FirewallManager()
|
||||
return fm.deleteSSHKey(self.admin.pk, self.data)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def addSSHKey(self):
|
||||
try:
|
||||
fm = FirewallManager()
|
||||
return fm.addSSHKey(self.admin.pk, self.data)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def getCurrentRules(self):
|
||||
try:
|
||||
fm = FirewallManager()
|
||||
return fm.getCurrentRules(self.admin.pk)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def addRule(self):
|
||||
try:
|
||||
fm = FirewallManager()
|
||||
return fm.addRule(self.admin.pk, self.data)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def deleteRule(self):
|
||||
try:
|
||||
fm = FirewallManager()
|
||||
return fm.deleteRule(self.admin.pk, self.data)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
def getLogsFromFile(self, request):
|
||||
try:
|
||||
request.session['userID'] = self.admin.pk
|
||||
return getLogsFromFile(request)
|
||||
except BaseException, msg:
|
||||
return self.ajaxPre(0, str(msg))
|
||||
|
||||
@@ -23,7 +23,6 @@ def router(request):
|
||||
else:
|
||||
return cm.verifyLogin(request)[1]
|
||||
|
||||
|
||||
if controller == 'verifyLogin':
|
||||
return cm.verifyLogin(request)[1]
|
||||
elif controller == 'fetchWebsites':
|
||||
@@ -144,6 +143,22 @@ def router(request):
|
||||
return cm.submitApplicationInstall(request)
|
||||
elif controller == 'obtainServer':
|
||||
return cm.obtainServer(request)
|
||||
elif controller == 'getSSHConfigs':
|
||||
return cm.getSSHConfigs()
|
||||
elif controller == 'saveSSHConfigs':
|
||||
return cm.saveSSHConfigs()
|
||||
elif controller == 'deleteSSHKey':
|
||||
return cm.deleteSSHKey()
|
||||
elif controller == 'addSSHKey':
|
||||
return cm.addSSHKey()
|
||||
elif controller == 'getCurrentRules':
|
||||
return cm.getCurrentRules()
|
||||
elif controller == 'addRule':
|
||||
return cm.addRule()
|
||||
elif controller == 'deleteRule':
|
||||
return cm.deleteRule()
|
||||
elif controller == 'getLogsFromFile':
|
||||
return cm.getLogsFromFile(request)
|
||||
|
||||
except BaseException, msg:
|
||||
cm = CloudManager(None)
|
||||
|
||||
@@ -69,7 +69,8 @@ class FirewallManager:
|
||||
checker = 0
|
||||
|
||||
for items in rules:
|
||||
dic = {'id': items.id,
|
||||
dic = {
|
||||
'id': items.id,
|
||||
'name': items.name,
|
||||
'proto': items.proto,
|
||||
'port': items.port,
|
||||
@@ -83,11 +84,11 @@ class FirewallManager:
|
||||
json_data = json_data + ',' + json.dumps(dic)
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
final_json = json.dumps({'status': 1, 'fetchStatus': 1, 'error_message': "None", "data": json_data})
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -111,12 +112,12 @@ class FirewallManager:
|
||||
newFWRule = FirewallRules(name=ruleName, proto=ruleProtocol, port=rulePort, ipAddress=ruleIP)
|
||||
newFWRule.save()
|
||||
|
||||
final_dic = {'add_status': 1, 'error_message': "None"}
|
||||
final_dic = {'status': 1, 'add_status': 1, 'error_message': "None"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'add_status': 0, 'error_message': str(msg)}
|
||||
final_dic = {'status': 0, 'add_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -141,12 +142,12 @@ class FirewallManager:
|
||||
delRule = FirewallRules.objects.get(id=ruleID)
|
||||
delRule.delete()
|
||||
|
||||
final_dic = {'delete_status': 1, 'error_message': "None"}
|
||||
final_dic = {'status': 1, 'delete_status': 1, 'error_message': "None"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'delete_status': 0, 'error_message': str(msg)}
|
||||
final_dic = {'status': 0, 'delete_status': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -325,7 +326,7 @@ class FirewallManager:
|
||||
|
||||
res = subprocess.call(cmd)
|
||||
|
||||
final_dic = {'permitRootLogin': permitRootLogin, 'sshPort': sshPort}
|
||||
final_dic = {'status': 1, 'permitRootLogin': permitRootLogin, 'sshPort': sshPort}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
@@ -406,7 +407,7 @@ class FirewallManager:
|
||||
|
||||
try:
|
||||
updateFW = FirewallRules.objects.get(name="SSHCustom")
|
||||
FirewallUtilities.deleteRule("tcp", updateFW.port)
|
||||
FirewallUtilities.deleteRule("tcp", updateFW.port, "0.0.0.0/0")
|
||||
updateFW.port = sshPort
|
||||
updateFW.save()
|
||||
except:
|
||||
@@ -467,12 +468,12 @@ class FirewallManager:
|
||||
|
||||
##
|
||||
|
||||
final_dic = {'saveStatus': 1}
|
||||
final_dic = {'status': 1, 'saveStatus': 1}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'saveStatus': 0, 'error_message': str(msg)}
|
||||
final_dic = {'status': 0 ,'saveStatus': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -522,12 +523,12 @@ class FirewallManager:
|
||||
|
||||
##
|
||||
|
||||
final_dic = {'delete_status': 1}
|
||||
final_dic = {'status': 1, 'delete_status': 1}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'delete_status': 0, 'error_mssage': str(msg)}
|
||||
final_dic = {'status': 0, 'delete_status': 0, 'error_mssage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
@@ -584,13 +585,12 @@ class FirewallManager:
|
||||
|
||||
##
|
||||
|
||||
|
||||
final_dic = {'add_status': 1}
|
||||
final_dic = {'status': 1, 'add_status': 1}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'add_status': 0, 'error_mssage': str(msg)}
|
||||
final_dic = {'status': 0, 'add_status': 0, 'error_mssage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
@@ -16,16 +16,10 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.rulesDetails = false;
|
||||
|
||||
|
||||
|
||||
firewallStatus();
|
||||
|
||||
|
||||
populateCurrentRecords();
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.addRule = function () {
|
||||
|
||||
$scope.rulesLoading = false;
|
||||
@@ -45,7 +39,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
var rulePort = $scope.rulePort;
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
ruleName: ruleName,
|
||||
ruleProtocol: ruleProtocol,
|
||||
@@ -80,7 +73,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -97,6 +89,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -112,8 +105,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function populateCurrentRecords() {
|
||||
|
||||
$scope.rulesLoading = false;
|
||||
@@ -123,9 +114,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/getCurrentRules";
|
||||
|
||||
var data = {
|
||||
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -134,25 +123,20 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if(response.data.fetchStatus == 1){
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
$scope.rules = JSON.parse(response.data.data);
|
||||
$scope.rulesLoading = true;
|
||||
|
||||
}
|
||||
else {
|
||||
$scope.rulesLoading = true;
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
@@ -160,13 +144,8 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.deleteRule = function (id, proto, port, ruleIP) {
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.rulesLoading = false;
|
||||
|
||||
url = "/firewall/deleteRule";
|
||||
@@ -175,7 +154,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
id: id,
|
||||
proto: proto,
|
||||
port: port,
|
||||
ruleIP:ruleIP,
|
||||
ruleIP: ruleIP
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -185,14 +164,13 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if(response.data.delete_status == 1){
|
||||
if (response.data.delete_status === 1) {
|
||||
|
||||
|
||||
populateCurrentRecords();
|
||||
@@ -205,7 +183,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -224,6 +201,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -235,7 +213,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -256,8 +233,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/reloadFirewall";
|
||||
|
||||
var data = {
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -266,7 +242,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -285,7 +260,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -303,6 +277,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -333,8 +308,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/startFirewall";
|
||||
|
||||
var data = {
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -343,7 +317,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -366,7 +339,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
firewallStatus();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -384,6 +356,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -415,8 +388,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/stopFirewall";
|
||||
|
||||
var data = {
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -425,7 +397,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -448,7 +419,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
firewallStatus();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -466,6 +436,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -486,12 +457,9 @@ app.controller('firewallController', function($scope,$http) {
|
||||
function firewallStatus() {
|
||||
|
||||
|
||||
|
||||
url = "/firewall/firewallStatus";
|
||||
|
||||
var data = {
|
||||
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -500,7 +468,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -526,6 +493,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -536,10 +504,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
/* Java script code to ADD Firewall Rules */
|
||||
@@ -596,7 +560,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -620,12 +583,13 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
$scope.saveChanges = function () {
|
||||
|
||||
@@ -639,7 +603,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
var data = {
|
||||
type: "1",
|
||||
sshPort: $scope.sshPort,
|
||||
rootLogin:rootLogin,
|
||||
rootLogin: rootLogin
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -649,7 +613,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -672,6 +635,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotSave = true;
|
||||
$scope.detailsSaved = true;
|
||||
@@ -687,7 +651,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
url = "/firewall/getSSHConfigs";
|
||||
|
||||
var data = {
|
||||
type:"2",
|
||||
type: "2"
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -697,20 +661,18 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.status == 1){
|
||||
if (response.data.status === 1) {
|
||||
$scope.records = JSON.parse(response.data.data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -733,7 +695,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -750,6 +711,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.secureSSHLoading = true;
|
||||
@@ -777,7 +739,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -802,6 +763,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.secureSSHLoading = true;
|
||||
$scope.saveKeyBtn = false;
|
||||
@@ -832,7 +794,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
$scope.installationFailed = true;
|
||||
|
||||
|
||||
|
||||
$scope.installModSec = function () {
|
||||
|
||||
$scope.modSecNotifyBox = true;
|
||||
@@ -854,7 +815,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -886,6 +846,7 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -920,7 +881,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -956,12 +916,15 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
} else {
|
||||
$scope.modSecSuccessfullyInstalled = false;
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
$timeout(function () {
|
||||
$window.location.reload();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -1019,7 +982,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1051,6 +1013,7 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
}
|
||||
@@ -1092,7 +1055,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1117,6 +1079,7 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.failedToSave = true;
|
||||
$scope.successfullySaved = false;
|
||||
@@ -1171,6 +1134,7 @@ app.controller('modSecRules', function($scope, $http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
}
|
||||
@@ -1219,6 +1183,7 @@ app.controller('modSecRules', function($scope, $http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
$scope.rulesSaved = true;
|
||||
@@ -1307,7 +1272,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1350,6 +1314,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
}
|
||||
@@ -1409,6 +1374,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
|
||||
@@ -1447,7 +1413,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1472,6 +1437,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
$scope.installationQuote = true;
|
||||
@@ -1488,7 +1454,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
$scope.modsecLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/firewall/enableDisableRuleFile";
|
||||
|
||||
var data = {
|
||||
@@ -1538,6 +1503,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
|
||||
@@ -1552,7 +1518,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -1572,7 +1537,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
$scope.installationFailed = true;
|
||||
|
||||
|
||||
|
||||
$scope.installCSF = function () {
|
||||
|
||||
$scope.modSecNotifyBox = true;
|
||||
@@ -1594,7 +1558,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1626,6 +1589,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -1659,7 +1623,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1695,12 +1658,15 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
} else {
|
||||
$scope.modSecSuccessfullyInstalled = false;
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
$timeout(function () {
|
||||
$window.location.reload();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -1753,7 +1719,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1770,7 +1735,9 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
$timeout(function () {
|
||||
$window.location.reload();
|
||||
}, 3000);
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -1783,6 +1750,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
new PNotify({
|
||||
@@ -1839,7 +1807,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
//
|
||||
|
||||
|
||||
|
||||
$scope.fetchSettings = function () {
|
||||
|
||||
$scope.csfLoading = false;
|
||||
@@ -1859,7 +1826,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1897,6 +1863,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
@@ -1916,7 +1883,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
$scope.csfLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/firewall/changeStatus";
|
||||
|
||||
|
||||
@@ -1932,7 +1898,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1958,6 +1923,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
@@ -1987,7 +1953,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
url = "/firewall/modifyPorts";
|
||||
|
||||
|
||||
@@ -2003,7 +1968,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -2029,6 +1993,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
@@ -2054,7 +2019,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
url = "/firewall/modifyIPs";
|
||||
|
||||
|
||||
@@ -2070,7 +2034,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -2096,6 +2059,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
|
||||
@@ -2390,14 +2390,16 @@ class preFlightsChecks:
|
||||
def removeUfw(self):
|
||||
try:
|
||||
preFlightsChecks.stdOut("Checking to see if ufw firewall is installed (will be removed)", 1)
|
||||
status = subprocess.check_output(shlex.split('ufw status'), stderr=subprocess.STDOUT)
|
||||
status = subprocess.check_output(shlex.split('ufw status'))
|
||||
preFlightsChecks.stdOut("ufw current status: " + status + "...will be removed")
|
||||
except subprocess.CalledProcessError as err:
|
||||
except BaseException, msg:
|
||||
preFlightsChecks.stdOut("Expected access to ufw not available, do not need to remove it", 1)
|
||||
return True
|
||||
|
||||
try:
|
||||
preFlightsChecks.call('apt-get -y remove ufw', self.distro, '[remove_ufw]', 'Remove ufw firewall ' +
|
||||
'(using firewalld)', 1, 1, os.EX_OSERR)
|
||||
'(using firewalld)', 1, 0, os.EX_OSERR)
|
||||
except:
|
||||
pass
|
||||
return True
|
||||
|
||||
def installFirewalld(self):
|
||||
@@ -3514,9 +3516,29 @@ def main():
|
||||
logging.InstallLog.writeToFile("Starting CyberPanel installation..")
|
||||
preFlightsChecks.stdOut("Starting CyberPanel installation..")
|
||||
|
||||
if args.ent == None:
|
||||
ent = 0
|
||||
preFlightsChecks.stdOut("OpenLiteSpeed web server will be installed.")
|
||||
else:
|
||||
if args.ent == 'ols':
|
||||
ent = 0
|
||||
preFlightsChecks.stdOut("OpenLiteSpeed web server will be installed.")
|
||||
else:
|
||||
preFlightsChecks.stdOut("LiteSpeed Enterprise web server will be installed.")
|
||||
ent = 1
|
||||
if args.serial != None:
|
||||
serial = args.serial
|
||||
preFlightsChecks.stdOut("LiteSpeed Enterprise Serial detected: " + serial)
|
||||
else:
|
||||
preFlightsChecks.stdOut("Installation failed, please specify LiteSpeed Enterprise key using --serial")
|
||||
os._exit(0)
|
||||
|
||||
## Writing public IP
|
||||
|
||||
try:
|
||||
os.mkdir("/etc/cyberpanel")
|
||||
except:
|
||||
pass
|
||||
|
||||
machineIP = open("/etc/cyberpanel/machineIP", "w")
|
||||
machineIP.writelines(args.publicip)
|
||||
@@ -3537,20 +3559,6 @@ def main():
|
||||
mysql = args.mysql
|
||||
preFlightsChecks.stdOut("Dobule MySQL instance version will be installed.")
|
||||
|
||||
if args.ent == None:
|
||||
ent = 0
|
||||
else:
|
||||
if args.ent == 'ols':
|
||||
ent = 0
|
||||
else:
|
||||
ent = 1
|
||||
if args.serial != None:
|
||||
serial = args.serial
|
||||
preFlightsChecks.stdOut("LiteSpeed Enterprise Serial detected: " + serial)
|
||||
else:
|
||||
preFlightsChecks.stdOut("Installation failed, please specify LiteSpeed Enterprise key using --serial")
|
||||
os._exit(0)
|
||||
|
||||
checks.checkPythonVersion()
|
||||
checks.setup_account_cyberpanel()
|
||||
if distro == centos:
|
||||
|
||||
@@ -67,6 +67,21 @@ class InstallCyberPanel:
|
||||
try:
|
||||
count = 0
|
||||
while (1):
|
||||
try:
|
||||
|
||||
command = 'groupadd nobody'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
command = 'usermod -a -G nobody nobody'
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd)
|
||||
except:
|
||||
pass
|
||||
|
||||
command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.3-ent-x86_64-linux.tar.gz'
|
||||
cmd = shlex.split(command)
|
||||
@@ -1301,7 +1316,7 @@ class InstallCyberPanel:
|
||||
|
||||
|
||||
|
||||
def Main(cwd, mysql, distro, ent):
|
||||
def Main(cwd, mysql, distro, ent, serial = None):
|
||||
|
||||
InstallCyberPanel.mysqlPassword = randomPassword.generate_pass()
|
||||
InstallCyberPanel.mysql_Root_password = randomPassword.generate_pass()
|
||||
@@ -1321,7 +1336,7 @@ def Main(cwd, mysql, distro, ent):
|
||||
else:
|
||||
InstallCyberPanel.mysqlPassword = InstallCyberPanel.mysql_Root_password
|
||||
|
||||
installer = InstallCyberPanel("/usr/local/lsws/",cwd, distro, ent)
|
||||
installer = InstallCyberPanel("/usr/local/lsws/",cwd, distro, ent, serial)
|
||||
|
||||
installer.installLiteSpeed()
|
||||
if ent == 0:
|
||||
|
||||
@@ -21,6 +21,8 @@ from dns.models import Records as dnsRecords
|
||||
from mailServer.models import Forwardings
|
||||
from plogical.acl import ACLManager
|
||||
import os
|
||||
from plogical.dnsUtilities import DNS
|
||||
from loginSystem.models import Administrator
|
||||
|
||||
class MailServerManager:
|
||||
|
||||
@@ -428,9 +430,16 @@ class MailServerManager:
|
||||
execPath = execPath + " generateKeys --domain " + domainName
|
||||
output = subprocess.check_output(shlex.split(execPath))
|
||||
|
||||
if output.find("1,None") > -1:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
DNS.dnsTemplate(domainName, admin)
|
||||
|
||||
zone = dnsDomains.objects.get(name=domainName)
|
||||
if output.find("1,None") > -1:
|
||||
import tldextract
|
||||
|
||||
extractDomain = tldextract.extract(domainName)
|
||||
topLevelDomain = extractDomain.domain + '.' + extractDomain.suffix
|
||||
|
||||
zone = dnsDomains.objects.get(name=topLevelDomain)
|
||||
zone.save()
|
||||
|
||||
path = "/etc/opendkim/keys/" + domainName + "/default.txt"
|
||||
@@ -439,6 +448,8 @@ class MailServerManager:
|
||||
leftIndex = output.index('(') + 2
|
||||
rightIndex = output.rindex(')') - 1
|
||||
|
||||
DNS.createDKIMRecords(domainName)
|
||||
|
||||
record = dnsRecords(domainOwner=zone,
|
||||
domain_id=zone.id,
|
||||
name="default._domainkey." + domainName,
|
||||
|
||||
@@ -146,8 +146,8 @@ class mailUtilities:
|
||||
|
||||
import tldextract
|
||||
|
||||
extractDomain = tldextract.extract(virtualHostName)
|
||||
virtualHostName = extractDomain.domain + '.' + extractDomain.suffix
|
||||
#extractDomain = tldextract.extract(virtualHostName)
|
||||
#virtualHostName = extractDomain.domain + '.' + extractDomain.suffix
|
||||
|
||||
if os.path.exists("/etc/opendkim/keys/" + virtualHostName):
|
||||
return 1, "None"
|
||||
|
||||
@@ -134,20 +134,25 @@ def getLogsFromFile(request):
|
||||
fileName = "/var/log/messages"
|
||||
elif type == "modSec":
|
||||
fileName = "/usr/local/lsws/logs/auditmodsec.log"
|
||||
elif type == "cyberpanel":
|
||||
fileName = "/home/cyberpanel/error-logs.txt"
|
||||
|
||||
try:
|
||||
command = "sudo tail -50 " + fileName
|
||||
|
||||
fewLinesOfLogFile = subprocess.check_output(shlex.split(command))
|
||||
|
||||
status = {"logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||
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, msg:
|
||||
status = {"logstatus":0,"error":"Could not fetch data from log file, please see CyberCP main log file through command line."}
|
||||
status = {"status": 0, "logstatus":0,"error":"Could not fetch data from log file, please see CyberCP main log file through command line."}
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[getLogsFromFile]")
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
def clearLogFile(request):
|
||||
try:
|
||||
|
||||
@@ -16,16 +16,10 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.rulesDetails = false;
|
||||
|
||||
|
||||
|
||||
firewallStatus();
|
||||
|
||||
|
||||
populateCurrentRecords();
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.addRule = function () {
|
||||
|
||||
$scope.rulesLoading = false;
|
||||
@@ -45,7 +39,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
var rulePort = $scope.rulePort;
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
ruleName: ruleName,
|
||||
ruleProtocol: ruleProtocol,
|
||||
@@ -80,7 +73,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -97,6 +89,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -112,8 +105,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
function populateCurrentRecords() {
|
||||
|
||||
$scope.rulesLoading = false;
|
||||
@@ -123,9 +114,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/getCurrentRules";
|
||||
|
||||
var data = {
|
||||
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -134,25 +123,20 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if(response.data.fetchStatus == 1){
|
||||
|
||||
if (response.data.fetchStatus === 1) {
|
||||
$scope.rules = JSON.parse(response.data.data);
|
||||
$scope.rulesLoading = true;
|
||||
|
||||
}
|
||||
else {
|
||||
$scope.rulesLoading = true;
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
@@ -160,13 +144,8 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.deleteRule = function (id, proto, port, ruleIP) {
|
||||
|
||||
|
||||
|
||||
|
||||
$scope.rulesLoading = false;
|
||||
|
||||
url = "/firewall/deleteRule";
|
||||
@@ -175,7 +154,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
id: id,
|
||||
proto: proto,
|
||||
port: port,
|
||||
ruleIP:ruleIP,
|
||||
ruleIP: ruleIP
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -185,14 +164,13 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
|
||||
if(response.data.delete_status == 1){
|
||||
if (response.data.delete_status === 1) {
|
||||
|
||||
|
||||
populateCurrentRecords();
|
||||
@@ -205,7 +183,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -224,6 +201,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -235,7 +213,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -256,8 +233,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/reloadFirewall";
|
||||
|
||||
var data = {
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -266,7 +242,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -285,7 +260,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
$scope.couldNotConnect = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -303,6 +277,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -333,8 +308,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/startFirewall";
|
||||
|
||||
var data = {
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -343,7 +317,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -366,7 +339,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
firewallStatus();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -384,6 +356,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -415,8 +388,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
url = "/firewall/stopFirewall";
|
||||
|
||||
var data = {
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -425,7 +397,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -448,7 +419,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
firewallStatus();
|
||||
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -466,6 +436,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.rulesLoading = true;
|
||||
@@ -486,12 +457,9 @@ app.controller('firewallController', function($scope,$http) {
|
||||
function firewallStatus() {
|
||||
|
||||
|
||||
|
||||
url = "/firewall/firewallStatus";
|
||||
|
||||
var data = {
|
||||
|
||||
};
|
||||
var data = {};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
@@ -500,7 +468,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -526,6 +493,7 @@ app.controller('firewallController', function($scope,$http) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.couldNotConnect = false;
|
||||
@@ -536,10 +504,6 @@ app.controller('firewallController', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
/* Java script code to ADD Firewall Rules */
|
||||
@@ -596,7 +560,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -620,12 +583,13 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
$scope.saveChanges = function () {
|
||||
|
||||
@@ -639,7 +603,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
var data = {
|
||||
type: "1",
|
||||
sshPort: $scope.sshPort,
|
||||
rootLogin:rootLogin,
|
||||
rootLogin: rootLogin
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -649,7 +613,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -672,6 +635,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotSave = true;
|
||||
$scope.detailsSaved = true;
|
||||
@@ -687,7 +651,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
url = "/firewall/getSSHConfigs";
|
||||
|
||||
var data = {
|
||||
type:"2",
|
||||
type: "2"
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -697,20 +661,18 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
|
||||
if(response.data.status == 1){
|
||||
if (response.data.status === 1) {
|
||||
$scope.records = JSON.parse(response.data.data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -733,7 +695,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -750,6 +711,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.secureSSHLoading = true;
|
||||
@@ -777,7 +739,6 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -802,6 +763,7 @@ app.controller('secureSSHCTRL', function($scope,$http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.secureSSHLoading = true;
|
||||
$scope.saveKeyBtn = false;
|
||||
@@ -832,7 +794,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
$scope.installationFailed = true;
|
||||
|
||||
|
||||
|
||||
$scope.installModSec = function () {
|
||||
|
||||
$scope.modSecNotifyBox = true;
|
||||
@@ -854,7 +815,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -886,6 +846,7 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -920,7 +881,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -956,12 +916,15 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
} else {
|
||||
$scope.modSecSuccessfullyInstalled = false;
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
$timeout(function () {
|
||||
$window.location.reload();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -1019,7 +982,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1051,6 +1013,7 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
}
|
||||
@@ -1092,7 +1055,6 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1117,6 +1079,7 @@ app.controller('modSec', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.failedToSave = true;
|
||||
$scope.successfullySaved = false;
|
||||
@@ -1171,6 +1134,7 @@ app.controller('modSecRules', function($scope, $http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
}
|
||||
@@ -1219,6 +1183,7 @@ app.controller('modSecRules', function($scope, $http) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
$scope.rulesSaved = true;
|
||||
@@ -1307,7 +1272,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1350,6 +1314,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
}
|
||||
@@ -1409,6 +1374,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
|
||||
@@ -1447,7 +1413,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1472,6 +1437,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
$scope.installationQuote = true;
|
||||
@@ -1488,7 +1454,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
$scope.modsecLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/firewall/enableDisableRuleFile";
|
||||
|
||||
var data = {
|
||||
@@ -1538,6 +1503,7 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.modsecLoading = true;
|
||||
|
||||
@@ -1552,7 +1518,6 @@ app.controller('modSecRulesPack', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
|
||||
@@ -1572,7 +1537,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
$scope.installationFailed = true;
|
||||
|
||||
|
||||
|
||||
$scope.installCSF = function () {
|
||||
|
||||
$scope.modSecNotifyBox = true;
|
||||
@@ -1594,7 +1558,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1626,6 +1589,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -1659,7 +1623,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1695,12 +1658,15 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
} else {
|
||||
$scope.modSecSuccessfullyInstalled = false;
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
$timeout(function () {
|
||||
$window.location.reload();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
$scope.modSecNotifyBox = false;
|
||||
@@ -1753,7 +1719,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1770,7 +1735,9 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
type: 'success'
|
||||
});
|
||||
|
||||
$timeout(function() { $window.location.reload(); }, 3000);
|
||||
$timeout(function () {
|
||||
$window.location.reload();
|
||||
}, 3000);
|
||||
|
||||
}
|
||||
else {
|
||||
@@ -1783,6 +1750,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
|
||||
new PNotify({
|
||||
@@ -1839,7 +1807,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
//
|
||||
|
||||
|
||||
|
||||
$scope.fetchSettings = function () {
|
||||
|
||||
$scope.csfLoading = false;
|
||||
@@ -1859,7 +1826,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1897,6 +1863,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
@@ -1916,7 +1883,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
$scope.csfLoading = false;
|
||||
|
||||
|
||||
|
||||
url = "/firewall/changeStatus";
|
||||
|
||||
|
||||
@@ -1932,7 +1898,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -1958,6 +1923,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
@@ -1987,7 +1953,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
url = "/firewall/modifyPorts";
|
||||
|
||||
|
||||
@@ -2003,7 +1968,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -2029,6 +1993,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
@@ -2054,7 +2019,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
url = "/firewall/modifyIPs";
|
||||
|
||||
|
||||
@@ -2070,7 +2034,6 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
};
|
||||
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
@@ -2096,6 +2059,7 @@ app.controller('csf', function($scope, $http, $timeout, $window) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.csfLoading = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user