Firewall: Add Rules by IP, Bug Fixes: SSL, Error Logs, Remote Transfer

This commit is contained in:
usmannasir
2017-11-02 02:09:47 +05:00
parent 897a8504c2
commit e366876b9b
31 changed files with 1353 additions and 1131 deletions

View File

@@ -19,8 +19,14 @@ class FirewallUtilities:
cmd = shlex.split(command)
res = subprocess.call(cmd)
ipAddress = "0.0.0.0/0"
command = 'firewall-cmd --add-port=' + port +'/' + proto +' --permanent'
ruleFamily = 'rule family="ipv4"'
sourceAddress = 'source address="' + ipAddress + '"'
ruleProtocol = 'port protocol="' + proto + '"'
rulePort = 'port="' + port + '"'
command = "firewall-cmd --permanent --zone=public --add-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
cmd = shlex.split(command)
@@ -49,8 +55,14 @@ class FirewallUtilities:
cmd = shlex.split(command)
res = subprocess.call(cmd)
ipAddress = "0.0.0.0/0"
command = 'firewall-cmd --remove-port=' + port + '/' + proto +' --permanent'
ruleFamily = 'rule family="ipv4"'
sourceAddress = 'source address="' + ipAddress + '"'
ruleProtocol = 'port protocol="' + proto + '"'
rulePort = 'port="' + port + '"'
command = "firewall-cmd --permanent --zone=public --remove-rich-rule='" + ruleFamily + " " + sourceAddress + " " + ruleProtocol + " " + rulePort + " " + "accept'"
cmd = shlex.split(command)