Skip to content

Commit db866f2

Browse files
committed
bug fix: firewalld
1 parent 1a95b0d commit db866f2

File tree

2 files changed

+17
-23
lines changed

2 files changed

+17
-23
lines changed

plogical/firewallUtilities.py

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,20 @@ def addRule(proto,port,ipAddress):
4545
ruleProtocol = 'port protocol="' + proto + '"'
4646
rulePort = 'port="' + port + '"'
4747

48-
command = "sudo firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
48+
command = "firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
4949

50-
if not FirewallUtilities.doCommand(command):
51-
return 0
50+
ProcessUtilities.executioner(command)
5251

5352
ruleFamily = 'rule family="ipv6"'
5453
sourceAddress = ''
5554

56-
command = "sudo firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
55+
command = "firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
5756

58-
if not FirewallUtilities.doCommand(command):
59-
return 0
57+
ProcessUtilities.executioner(command)
6058

61-
command = 'sudo firewall-cmd --reload'
59+
command = 'firewall-cmd --reload'
6260

63-
if not FirewallUtilities.doCommand(command):
64-
return 0
61+
ProcessUtilities.executioner(command)
6562

6663
return 1
6764

@@ -72,23 +69,20 @@ def deleteRule(proto, port, ipAddress):
7269
ruleProtocol = 'port protocol="' + proto + '"'
7370
rulePort = 'port="' + port + '"'
7471

75-
command = "sudo firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
72+
command = "firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
7673

77-
if ProcessUtilities.executioner(command) == 0:
78-
return 0
74+
ProcessUtilities.executioner(command)
7975

8076
ruleFamily = 'rule family="ipv6"'
8177
sourceAddress = ''
8278

83-
command = "sudo firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
79+
command = "firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
8480

85-
if ProcessUtilities.executioner(command) == 0:
86-
return 0
81+
ProcessUtilities.executioner(command)
8782

88-
command = 'sudo firewall-cmd --reload'
83+
command = 'firewall-cmd --reload'
8984

90-
if ProcessUtilities.executioner(command) == 0:
91-
return 0
85+
ProcessUtilities.executioner(command)
9286

9387
return 1
9488

@@ -97,7 +91,7 @@ def saveSSHConfigs(type, sshPort, rootLogin):
9791
try:
9892
if type == "1":
9993

100-
command = 'sudo semanage port -a -t ssh_port_t -p tcp ' + sshPort
94+
command = 'semanage port -a -t ssh_port_t -p tcp ' + sshPort
10195
ProcessUtilities.normalExecutioner(command)
10296

10397
FirewallUtilities.addRule('tcp', sshPort, "0.0.0.0/0")
@@ -127,7 +121,7 @@ def saveSSHConfigs(type, sshPort, rootLogin):
127121
writeToFile.writelines(items)
128122
writeToFile.close()
129123

130-
command = 'sudo systemctl restart sshd'
124+
command = 'systemctl restart sshd'
131125
ProcessUtilities.normalExecutioner(command)
132126

133127
print("1,None")

static/CLManager/CLManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ app.controller('installCageFS', function ($scope, $http, $timeout, $window) {
5050
};
5151

5252
function getRequestStatus() {
53-
$scope.cyberPanelLoading = false;
53+
$scope.installDockerStatus = false;
5454

5555
url = "/serverstatus/switchTOLSWSStatus";
5656

@@ -72,7 +72,7 @@ app.controller('installCageFS', function ($scope, $http, $timeout, $window) {
7272
$timeout(getRequestStatus, 1000);
7373
} else {
7474
// Notifications
75-
$scope.cyberPanelLoading = true;
75+
$scope.installDockerStatus = true;
7676
$timeout.cancel();
7777
$scope.requestData = response.data.requestStatus;
7878
if (response.data.installed === 1) {
@@ -85,7 +85,7 @@ app.controller('installCageFS', function ($scope, $http, $timeout, $window) {
8585
}
8686

8787
function cantLoadInitialDatas(response) {
88-
$scope.cyberPanelLoading = true;
88+
$scope.installDockerStatus = true;
8989
new PNotify({
9090
title: 'Operation Failed!',
9191
text: 'Could not connect to server, please refresh this page',

0 commit comments

Comments
 (0)