diff --git a/README.md b/README.md index fe730c7..d225628 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # gufw +A graphical user interface for UFW. + diff --git a/gufw-10.04.4-su.patch b/gufw-10.04.4-su.patch new file mode 100644 index 0000000..56700a0 --- /dev/null +++ b/gufw-10.04.4-su.patch @@ -0,0 +1,21 @@ +diff -Nru gui-ufw-10.04.4.orig/Alacarte_menu/gufw.desktop gui-ufw-10.04.4/Alacarte_menu/gufw.desktop +--- gui-ufw-10.04.4.orig/Alacarte_menu/gufw.desktop 2010-04-11 09:53:33.000000000 +0200 ++++ gui-ufw-10.04.4/Alacarte_menu/gufw.desktop 2010-07-08 20:48:09.000000000 +0200 +@@ -2,7 +2,7 @@ + Version=1.0 + Type=Application + Terminal=false +-Exec=su-to-root -X -c /usr/share/gufw/gufw.py ++Exec=kdesu -c /usr/share/gufw/gufw.py + Name=Firewall configuration + Name[zh_CN]=防火墙配置 + Name[uk]=Налаштування фаєрволу +diff -Nru gui-ufw-10.04.4.orig/global_command/gufw gui-ufw-10.04.4/global_command/gufw +--- gui-ufw-10.04.4.orig/global_command/gufw 2010-04-11 09:53:33.000000000 +0200 ++++ gui-ufw-10.04.4/global_command/gufw 2010-07-08 20:42:29.000000000 +0200 +@@ -1,4 +1,3 @@ + #!/bin/bash + # This script starts Gufw from the console +-su-to-root -X -c /usr/share/gufw/gufw.py +- ++su -c /usr/share/gufw/gufw.py diff --git a/gufw.spec b/gufw.spec new file mode 100644 index 0000000..f4d7abb --- /dev/null +++ b/gufw.spec @@ -0,0 +1,107 @@ +%define majver %(echo %version | cut -d. -f1-2) +Name: gufw +Version: 20.04.1 +Release: 1mamba +Summary: A graphical user interface for UFW +Group: System/Libraries/Python +Vendor: openmamba +Distribution: openmamba +Packager: Ercole 'ercolinux' Carpanetto +URL: https://github.com/costales/gufw +Source: https://github.com/costales/gufw.git/%{version}/gufw-%{version}.tar.bz2 +Patch: gufw-10.04.4-su.patch +Patch1: gui-ufw-13.10.2-fix_ufw_path_in_backend.patch +License: GPL +## AUTOBUILDREQ-BEGIN +BuildRequires: libpython3-devel +## AUTOBUILDREQ-END +BuildRequires: python-distutils-extra-py3 +Provides: firewallgui +Requires: python3 >= %python3_version +Requires: ufw +Requires: pygobject-py3 +Requires: python-netifaces-py3 +Requires: dconf +Provides: gui-ufw +Obsoletes: gui-ufw +BuildRoot: %{_tmppath}/%{name}-%{version}-root + +%description +A graphical user interface for UFW. + +%prep +%setup -q +#%patch1 -p1 + +%build +%{__python3} setup.py build + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%{__python3} setup.py install \ + -O1 --skip-build \ + --root="%{buildroot}" \ + --install-lib=%{_datadir}/gufw + +#%find_lang gufw +install -D -m0644 build/share/applications/gufw.desktop %{buildroot}%{_datadir}/applications/gufw.desktop +install -D -m0644 data/icons/48x48/apps/gufw.png %{buildroot}%{_datadir}/pixmaps/gufw.png +install -D -m0644 data/icons/scalable/apps/gufw.svg %{buildroot}%{_datadir}/pixmaps/gufw.svg + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%files +#-f gufw.lang +%defattr(-,root,root) +%dir %{_sysconfdir}/gufw +%dir %{_sysconfdir}/gufw/app_profiles +%{_sysconfdir}/gufw/app_profiles/* +%{_bindir}/gufw +%{_bindir}/gufw-pkexec +%{_datadir}/polkit-1/actions/com.ubuntu.pkexec.gufw.policy +%{_datadir}/applications/gufw.desktop +%{_docdir}/gufw/* +%dir %{_datadir}/gufw +%{_datadir}/gufw/gufw-*-py3*.egg-info +%dir %{_datadir}/gufw/gufw +%{_datadir}/gufw/gufw/* +%dir %{_datadir}/gufw/media +%{_datadir}/gufw/media/* +%dir %{_datadir}/gufw/ui +%{_datadir}/gufw/ui/* +%{_datadir}/pixmaps/gufw.png +%{_datadir}/pixmaps/gufw.svg +%{_mandir}/man8/gufw.8* + +%changelog +* Thu Sep 10 2020 Silvan Calarco 20.04.1-1mamba +- update to 20.04.1 +- renamed from gui-ufw + +* Mon Jun 30 2014 Silvan Calarco 13.10.2-2mamba +- require python-netifaces and dconf + +* Mon Aug 05 2013 Automatic Build System 13.10.2-1mamba +- update to 13.10.2 + +* Sat May 25 2013 Silvan Calarco 13.04.0-2mamba +- python 2.7 mass rebuild + +* Sun Jan 27 2013 Automatic Build System 13.04.0-1mamba +- update to 13.04.0 + +* Tue Jul 31 2012 Silvan Calarco 12.04.1-2mamba +- added a patch to call /usr/sbin/ufw will full path or gufw_daemon called by dbus won't find it + +* Sun Jul 29 2012 Silvan Calarco 12.04.1-1mamba +- update to 12.04.1 + +* Tue Nov 01 2011 Silvan Calarco 11.10.2-1mamba +- update to 11.10.2 + +* Fri Mar 18 2011 Ercole 'ercolinux' Carpanetto ufw_10.10.0-1mamba +- update to 10.10.0 + +* Wed Jul 07 2010 Ercole 'ercolinux' Carpanetto ufw_10.04.4-1mamba +- package created by autospec diff --git a/gui-ufw-13.10.2-fix_ufw_path_in_backend.patch b/gui-ufw-13.10.2-fix_ufw_path_in_backend.patch new file mode 100644 index 0000000..88e5322 --- /dev/null +++ b/gui-ufw-13.10.2-fix_ufw_path_in_backend.patch @@ -0,0 +1,118 @@ +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') +