gufw/gui-ufw-13.10.2-fix_ufw_path_in_backend.patch
Silvan Calarco 54f082f415 update to 20.04.1
renamed from gui-ufw [release 20.04.1-1mamba;Thu Sep 10 2020]
2024-01-05 23:35:10 +01:00

119 lines
5.0 KiB
Diff

diff -Nru gui-ufw-13.10.2.orig/gufw/backend.py gui-ufw-13.10.2/gufw/backend.py
--- gui-ufw-13.10.2.orig/gufw/backend.py 2013-07-30 15:47:48.000000000 +0200
+++ gui-ufw-13.10.2/gufw/backend.py 2013-08-13 15:22:12.434622370 +0200
@@ -20,7 +20,7 @@
class Backend():
def get_status(self):
- ufw_status = commands.getstatusoutput('LANGUAGE=C ufw status')
+ ufw_status = commands.getstatusoutput('LANGUAGE=C /usr/sbin/ufw status')
if 'Status: active' in ufw_status[1]:
return True
else:
@@ -60,47 +60,47 @@
def set_status(self, status):
if status:
- cmd = 'ufw --force enable'
+ cmd = '/usr/sbin/ufw --force enable'
else:
- cmd = 'ufw disable'
+ cmd = '/usr/sbin/ufw disable'
commands.getstatusoutput(cmd)
def set_policy(self, policy, value):
if policy == 'incoming':
if value == 'allow':
- cmd = 'ufw default allow incoming'
+ cmd = '/usr/sbin/ufw default allow incoming'
elif value == 'deny':
- cmd = 'ufw default deny incoming'
+ cmd = '/usr/sbin/ufw default deny incoming'
elif value == 'reject':
- cmd = 'ufw default reject incoming'
+ cmd = '/usr/sbin/ufw default reject incoming'
elif policy == 'outgoing':
if value == 'allow':
- cmd = 'ufw default allow outgoing'
+ cmd = '/usr/sbin/ufw default allow outgoing'
elif value == 'deny':
- cmd = 'ufw default deny outgoing'
+ cmd = '/usr/sbin/ufw default deny outgoing'
elif value == 'reject':
- cmd = 'ufw default reject outgoing'
+ cmd = '/usr/sbin/ufw default reject outgoing'
commands.getstatusoutput(cmd)
def set_ufw_logging(self, logging):
if logging == 'off':
- cmd = 'ufw logging off'
+ cmd = '/usr/sbin/ufw logging off'
elif logging == 'low':
- cmd = 'ufw logging low'
+ cmd = '/usr/sbin/ufw logging low'
elif logging == 'medium':
- cmd = 'ufw logging medium'
+ cmd = '/usr/sbin/ufw logging medium'
elif logging == 'high':
- cmd = 'ufw logging high'
+ cmd = '/usr/sbin/ufw logging high'
elif logging == 'full':
- cmd = 'ufw logging full'
+ cmd = '/usr/sbin/ufw logging full'
commands.getstatusoutput(cmd)
def reset_fw(self):
- cmd = 'ufw --force reset'
+ cmd = '/usr/sbin/ufw --force reset'
commands.getstatusoutput(cmd)
def get_config_value(self, attribute):
@@ -260,7 +260,7 @@
return cmd[1]
def get_rules(self):
- rules = commands.getstatusoutput('LANGUAGE=C ufw status numbered')
+ rules = commands.getstatusoutput('LANGUAGE=C /usr/sbin/ufw status numbered')
lines = rules[1].split('\n')
return_rules = []
@@ -297,14 +297,14 @@
# ufw [insert NUM] allow|deny|reject|limit [in|out] [log|log-all] PORT[/protocol]
# ufw &insert &policy &direction &logging &toPort/&proto
if to_port and not iface and not from_ip and not from_port and not to_ip:
- rule = 'ufw %s %s %s %s %s' % (insert, policy, direction, logging, to_port)
+ rule = '/usr/sbin/ufw %s %s %s %s %s' % (insert, policy, direction, logging, to_port)
if proto:
rule = '/'.join([rule, proto])
# Advanced rule
# ufw [insert NUM] allow|deny|reject|limit [in|out on INTERFACE] [log|log-all] [proto protocol] [from ADDRESS [port PORT]] [to ADDRESS [port PORT]]
# ufw &insert &policy &direction &iface &logging &proto &fromIP &fromPort &toIP &toPort
else:
- rule = 'ufw %s %s %s %s %s %s %s %s %s %s' % (insert, policy, direction, iface, logging, proto_aux, from_ip, from_port, to_ip, to_port)
+ rule = '/usr/sbin/ufw %s %s %s %s %s %s %s %s %s %s' % (insert, policy, direction, iface, logging, proto_aux, from_ip, from_port, to_ip, to_port)
rule = ' '.join(rule.split()) # Condense
cmd = commands.getstatusoutput(rule)
@@ -316,7 +316,7 @@
return result # cmd | ufw result
def delete_rule(self, num):
- delete_rule = 'ufw --force delete &number'.replace('&number', num)
+ delete_rule = '/usr/sbin/ufw --force delete &number'.replace('&number', num)
cmd = commands.getstatusoutput(delete_rule)
result = []
@@ -328,7 +328,7 @@
def get_listening_report(self):
return_report = []
actual_protocol = 'None'
- ufw_report = commands.getstatusoutput('LANGUAGE=C ufw show listening')
+ ufw_report = commands.getstatusoutput('LANGUAGE=C /usr/sbin/ufw show listening')
report_lines = ufw_report[1].replace('\n [','%')
report_lines = report_lines.split('\n')