Skip to contentSkip to conversation

ufw: bump version to 0.36 and add services

PATCH New Khem Raj 1 participant 1 message May 3, 2021

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 ufw: bump version to 0.36 and add services

From: Silcet <[email protected]>

This commit brings the version of ufw up to 0.36 since version 0.33 had some problems:
* The setup.py calls sed to replace some variables in the source code with the correct paths. However, this is done using a hardcoded path and conflicts with distutils
* The python shebang was not properly corrected in setup.py, leading to a script that only run if there is a python symlink to python2 or python3

The first issue is addressed by the bump in version, while the second one is fixed in patch 0003 of the recipe.

Also, the new version provides examples for systemd service and sysvinit scripts to autostart ufw. These are added into the recipe now.

---
 .../ufw/ufw/0001-optimize-boot.patch          |  37 ++++--
 ...option-to-specify-iptables-location.patch} |  41 +++---
 .../ufw/ufw/0002-lp1044361.patch              | 118 ------------------
 .../ufw/ufw/0003-fix-typeerror-on-error.patch |  20 ---
 .../0003-only-make-one-reference-to-env.patch |  73 +++++++++++
 .../ufw/ufw/0004-lp1039729.patch              |  40 ------
 .../ufw/ufw/0005-lp1191197.patch              |  32 -----
 ...fix-dynamic-update-of-python-shebang.patch |  57 ---------
 ...setup-only-make-one-reference-to-env.patch |  77 ------------
 .../ufw/{ufw_0.33.bb => ufw_0.36.bb}          |  34 +++--
 10 files changed, 140 insertions(+), 389 deletions(-)
 rename meta-networking/recipes-connectivity/ufw/ufw/{setup-add-an-option-to-specify-iptables-location.patch => 0002-add-an-option-to-specify-iptables-location.patch} (87%)
 delete mode 100644 meta-networking/recipes-connectivity/ufw/ufw/0002-lp1044361.patch
 delete mode 100644 meta-networking/recipes-connectivity/ufw/ufw/0003-fix-typeerror-on-error.patch
 create mode 100644 meta-networking/recipes-connectivity/ufw/ufw/0003-only-make-one-reference-to-env.patch
 delete mode 100644 meta-networking/recipes-connectivity/ufw/ufw/0004-lp1039729.patch
 delete mode 100644 meta-networking/recipes-connectivity/ufw/ufw/0005-lp1191197.patch
 delete mode 100644 meta-networking/recipes-connectivity/ufw/ufw/fix-dynamic-update-of-python-shebang.patch
 delete mode 100644 meta-networking/recipes-connectivity/ufw/ufw/setup-only-make-one-reference-to-env.patch
 rename meta-networking/recipes-connectivity/ufw/{ufw_0.33.bb => ufw_0.36.bb} (65%)
meta-networking/recipes-connectivity/ufw/ufw/0001-optimize-boot.patch +25 -12
index a1e56b7cac..28068bba11 100644
@@ -1,18 +1,31 @@
-Author: Jamie Strandboge <[email protected]>
-Description: to improve boot speed when disabled, don't source all of
- ufw-init-functions (which also sources in other files).
+From 92fcdbc1a57086e4decc1597217c0739dc16342a Mon Sep 17 00:00:00 2001
+From: Silcet <[email protected]>
+Date: Tue, 27 Apr 2021 05:34:59 +0000
+Subject: [PATCH] Author: Jamie Strandboge <[email protected]>
+Description:
+to improve boot speed when disabled, don't source all of  ufw-init-functions
+(which also sources in other files).
 
 Upstream-Status: Inappropriate [ not author ]
 
 Signed-off-by: Joe MacDonald <[email protected]>
 
-Index: ufw-0.31/src/ufw-init
-===================================================================
---- ufw-0.31.orig/src/ufw-init	2012-03-09 17:07:11.000000000 -0600
-+++ ufw-0.31/src/ufw-init	2012-03-17 09:37:51.000000000 -0500
-@@ -18,6 +18,12 @@
- #
- set -e
+The patch was imported from the OpenEmbedded git server
+(git://git.openembedded.org/openembedded) as of commit id
+2cc1bd9dd060f5002c2fde7aacba86fe230c12af.
+
+Signed-off-by: Silcet <[email protected]>
+---
+ src/ufw-init | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/ufw-init b/src/ufw-init
+index 3505a02..dde37f0 100755
+--- a/src/ufw-init
++++ b/src/ufw-init
+@@ -31,6 +31,12 @@ if [ "$1" = "--datadir" ] && [ -s "$2" ]; then
+ fi
+ export DATA_DIR="$datadir"
  
 +# Debian/Ubuntu: small boot speed improvement
 +. "#CONFIG_PREFIX#/ufw/ufw.conf"
@@ -20,6 +33,6 @@ Index: ufw-0.31/src/ufw-init
 +    exit 0
 +fi
 +
- if [ -s "#STATE_PREFIX#/ufw-init-functions" ]; then
-     . "#STATE_PREFIX#/ufw-init-functions"
+ if [ -s "${rootdir}#STATE_PREFIX#/ufw-init-functions" ]; then
+     . "${rootdir}#STATE_PREFIX#/ufw-init-functions"
  else
meta-networking/recipes-connectivity/ufw/ufw/0002-add-an-option-to-specify-iptables-location.patch renamed from meta-networking/recipes-connectivity/ufw/ufw/setup-add-an-option-to-specify-iptables-location.patch +21 -20

72 lines not on this page · raw message

meta-networking/recipes-connectivity/ufw/ufw/0002-lp1044361.patch deleted +0 -118

118 lines not on this page · raw message

meta-networking/recipes-connectivity/ufw/ufw/0003-fix-typeerror-on-error.patch deleted +0 -20
deleted file mode 100644
index b259fdf781..0000000000
@@ -1,20 +0,0 @@
-Origin: r797
-Description: src/backend_iptables.py: fix misplaced parenthesis
-
-Upstream-Status: Inappropriate [ not author ]
-
-Signed-off-by: Joe MacDonald <[email protected]>
-
-Index: ufw-0.33/src/backend_iptables.py
-===================================================================
---- ufw-0.33.orig/src/backend_iptables.py	2012-09-24 08:51:13.000000000 -0500
-+++ ufw-0.33/src/backend_iptables.py	2012-09-24 08:52:00.000000000 -0500
-@@ -1075,7 +1075,7 @@
-             exe = self.ip6tables
-         (rc, out) = cmd([exe] + args)
-         if rc != 0:
--            err_msg = _("Could not perform '%s'") % (args)
-+            err_msg = _("Could not perform '%s'" % (args))
-             if fail_ok:
-                 debug("FAILOK: " + err_msg)
-             else:
meta-networking/recipes-connectivity/ufw/ufw/0003-only-make-one-reference-to-env.patch new file +73 -0

73 lines not on this page · raw message

meta-networking/recipes-connectivity/ufw/ufw/0004-lp1039729.patch deleted +0 -40
deleted file mode 100644
index 695b265671..0000000000
@@ -1,40 +0,0 @@
-Origin: r803, r804
-Description: Don't call get_netfilter_capabilities() with ipv6 if ipv6 is
- disabled.
-Bug-Ubuntu: https://launchpad.net/ufw/bugs/1039729
-
-Upstream-Status: Inappropriate [ not author ]
-
-Signed-off-by: Joe MacDonald <[email protected]>
-
-Index: ufw-0.33/src/backend.py
-===================================================================
---- ufw-0.33.orig/src/backend.py	2012-12-04 09:21:57.000000000 -0600
-+++ ufw-0.33/src/backend.py	2012-12-04 09:22:40.000000000 -0600
-@@ -98,15 +98,17 @@
-             else:
-                 self.caps['limit']['4'] = False
- 
--            # v6
--            try:
--                nf_caps = ufw.util.get_netfilter_capabilities(self.ip6tables)
--            except OSError as e:
--                error("initcaps\n%s" % e)
--            if 'recent-set' in nf_caps and 'recent-update' in nf_caps:
--                self.caps['limit']['6'] = True
--            else:
--                self.caps['limit']['6'] = False
-+            # v6 (skip capabilities check for ipv6 if ipv6 is disabled in ufw
-+            # because the system may not have ipv6 support (LP: #1039729)
-+            if self.use_ipv6():
-+                try:
-+                    nf_caps = ufw.util.get_netfilter_capabilities(self.ip6tables)
-+                except OSError as e:
-+                    error("initcaps\n%s" % e)
-+                if 'recent-set' in nf_caps and 'recent-update' in nf_caps:
-+                    self.caps['limit']['6'] = True
-+                else:
-+                    self.caps['limit']['6'] = False
- 
-     def is_enabled(self):
-         '''Is firewall configured as enabled'''
meta-networking/recipes-connectivity/ufw/ufw/0005-lp1191197.patch deleted +0 -32
deleted file mode 100644
index b760d3fd33..0000000000
@@ -1,32 +0,0 @@
-Origin: r816
-Description: add check for -m rt --rt-type 0
-Bug-Ubuntu: https://launchpad.net/bugs/1191197
-Forwarded: yes
-
-Upstream-Status: Inappropriate [ not author ]
-
-Signed-off-by: Joe MacDonald <[email protected]>
-
-Index: ufw-0.33/tests/check-requirements
-===================================================================
---- ufw-0.33.orig/tests/check-requirements	2012-08-17 16:12:49.000000000 -0500
-+++ ufw-0.33/tests/check-requirements	2013-06-15 07:47:00.000000000 -0500
-@@ -3,7 +3,7 @@
- # check-requirements: verify all the required iptables functionality is
- # available
- #
--# Copyright 2008-2012 Canonical Ltd.
-+# Copyright 2008-2013 Canonical Ltd.
- #
- #    This program is free software: you can redistribute it and/or modify
- #    it under the terms of the GNU General Public License version 3,
-@@ -218,6 +218,9 @@
-             echo -n "icmpv6 with hl ($j): "
-             runcmd $exe -A $c -p icmpv6 --icmpv6-type $j -m hl --hl-eq 255 -j ACCEPT
-         done
-+
-+        echo -n "ipv6 rt: "
-+        runcmd $exe -A $c -m rt --rt-type 0 -j ACCEPT
-     fi
- 
-     echo ""
meta-networking/recipes-connectivity/ufw/ufw/fix-dynamic-update-of-python-shebang.patch deleted +0 -57

57 lines not on this page · raw message

meta-networking/recipes-connectivity/ufw/ufw/setup-only-make-one-reference-to-env.patch deleted +0 -77

77 lines not on this page · raw message

meta-networking/recipes-connectivity/ufw/ufw_0.36.bb renamed from meta-networking/recipes-connectivity/ufw/ufw_0.33.bb +21 -13
similarity index 65%
rename from meta-networking/recipes-connectivity/ufw/ufw_0.33.bb
rename to meta-networking/recipes-connectivity/ufw/ufw_0.36.bb
index ee366aa665..8e35dc01ed 100644
@@ -1,3 +1,4 @@
+
 SUMMARY = "Uncomplicated Firewall"
 DESCRIPTION = "UFW stands for Uncomplicated Firewall, and is program for \
 managing a netfilter firewall. It provides a command line interface and aims \
@@ -7,24 +8,18 @@ SECTION = "net"
 LICENSE = "GPLv3"
 LIC_FILES_CHKSUM = "file://COPYING;md5=f27defe1e96c2e1ecd4e0c9be8967949"
 
-SRC_URI = " \
-           https://launchpad.net/ufw/0.33/0.33/+download/ufw-0.33.tar.gz \
-           file://setup-add-an-option-to-specify-iptables-location.patch \
-           file://setup-only-make-one-reference-to-env.patch \
+SRC_URI = "https://launchpad.net/ufw/0.36/0.36/+download/ufw-0.36.tar.gz \
            file://0001-optimize-boot.patch \
-           file://0002-lp1044361.patch \
-           file://0003-fix-typeerror-on-error.patch \
-           file://0004-lp1039729.patch \
-           file://0005-lp1191197.patch \
-           file://fix-dynamic-update-of-python-shebang.patch \
-"
+           file://0002-add-an-option-to-specify-iptables-location.patch \
+           file://0003-only-make-one-reference-to-env.patch \
+           "
 
 UPSTREAM_CHECK_URI = "https://launchpad.net/ufw"
 
-SRC_URI[md5sum] = "3747b453d76709e5a99da209fc0bb5f5"
-SRC_URI[sha256sum] = "5f85a8084ad3539b547bec097286948233188c971f498890316dec170bdd1da8"
+SRC_URI[md5sum] = "6d8ab1506da21ae003f4628f93d05781"
+SRC_URI[sha256sum] = "754b22ae5edff0273460ac9f57509c3938187e0cf4fb9692c6a02833fff33cfc"
 
-inherit setuptools3 features_check
+inherit setuptools3 features_check systemd update-rc.d
 
 RDEPENDS_${PN} = " \
                   iptables \
@@ -44,6 +39,19 @@ RRECOMMENDS_${PN} = " \
                      kernel-module-nf-recent \
 "
 
+do_install_append() {
+    install -d ${D}${systemd_unitdir}/system/
+    install -m 0644 ${S}/doc/systemd.example ${D}${systemd_unitdir}/system/ufw.service
+
+    install -d ${D}${sysconfdir}/init.d/
+    install -m 0755 ${S}/doc/initscript.example ${D}${sysconfdir}/init.d/ufw
+}
+
+SYSTEMD_SERVICE_${PN} = "ufw.service"
+
+INITSCRIPT_NAME = "ufw"
+INITSCRIPT_PARAMS = "defaults"
+
 # Certain items are explicitly put under /lib, not base_libdir when installed.
 #
 FILES_${PN} += " \
Signature · 1 line
2.31.1