From cee3f26e86be16aaf86375c55bfece77d5f96cc4 Mon Sep 17 00:00:00 2001 From: Renbo Date: Wed, 17 Jul 2024 18:10:34 +0800 Subject: [PATCH 1/2] update to libreswan-4.12-2.4.src.rpm Signed-off-by: Renbo --- 0001-libreswan-anolis-rebrand-to-anolis.patch | 87 ------------------ ...an-4.12-ikev1-compute-keymat-default.patch | 92 +++++++++++++++++++ libreswan.spec | 14 +-- 3 files changed, 97 insertions(+), 96 deletions(-) delete mode 100644 0001-libreswan-anolis-rebrand-to-anolis.patch create mode 100644 libreswan-4.12-ikev1-compute-keymat-default.patch diff --git a/0001-libreswan-anolis-rebrand-to-anolis.patch b/0001-libreswan-anolis-rebrand-to-anolis.patch deleted file mode 100644 index d8c4d71..0000000 --- a/0001-libreswan-anolis-rebrand-to-anolis.patch +++ /dev/null @@ -1,87 +0,0 @@ -From c0ae1f9070d386036a793d3e8eac7a787e7017a0 Mon Sep 17 00:00:00 2001 -From: "yangxiaoxuan@openanolis.org" -Date: Mon, 21 Jun 2021 22:48:03 +0800 -Subject: [PATCH] libreswan anolis rebrand to anolis - ---- - Makefile | 2 +- - mk/defaults/linux.mk | 2 +- - programs/barf/barf.in | 2 +- - testing/guestbin/docker-transmogrify | 8 +++++--- - 4 files changed, 8 insertions(+), 6 deletions(-) - -diff --git a/Makefile b/Makefile -index db230d4..bafddc2 100644 ---- a/Makefile -+++ b/Makefile -@@ -27,7 +27,7 @@ include ${LIBRESWANSRCDIR}/Makefile.inc - MAIN_RPM_VERSION = $(shell make showversion | sed "s/-.*//") - MAIN_RPM_PREVER = $(shell make showversion | sed -e "s/^.[^-]*-\([^-]*\)-\(.*\)/rc\1_\2/" -e "s/-/_/g") - MAIN_RPM_PREFIX = libreswan-$(MAIN_RPM_VERSION)$(MAIN_RPM_PREVER) --MAIN_RPM_RHEL_PKG = $(shell rpm -qf /etc/redhat-release) -+MAIN_RPM_RHEL_PKG = $(shell rpm -qf /etc/anolis-release) - MAIN_RPM_RHEL_VERSION = $(shell echo $(MAIN_RPM_RHEL_PKG) | sed "s/.*-release-\(.\).*/\1/") - MAIN_RPM_SPECFILE = $(shell if [ -f /etc/fedora-release ]; then echo packaging/fedora/libreswan.spec; elif [ -n "$(MAIN_RPM_RHEL_VERSION)" ]; then echo packaging/rhel/$(MAIN_RPM_RHEL_VERSION)/libreswan.spec; else echo "unknown distro, cannot find spec file to use in packaging directory"; fi) - RHEL_LIKE= $(shell cat /etc/os-release | grep ID_LIKE | sed -e "s/ID_LIKE=//" -e 's/"//g' -e "s/ .*//") -diff --git a/mk/defaults/linux.mk b/mk/defaults/linux.mk -index c286a7d..56a3e20 100644 ---- a/mk/defaults/linux.mk -+++ b/mk/defaults/linux.mk -@@ -131,7 +131,7 @@ ifndef INITSYSTEM - ifndef INITSYSTEM - ifneq ($(and $(wildcard /lib/systemd/systemd),$(wildcard /run/systemd)),) - INITSYSTEM=systemd -- else ifneq ($(and $(wildcard /sbin/start),$(wildcard /etc/redhat-release)),) -+ else ifneq ($(and $(wildcard /sbin/start),$(wildcard /etc/anolis-release)),) - # override for rhel/centos to use sysvinit - INITSYSTEM=sysvinit - else ifneq ($(wildcard /sbin/start),) -diff --git a/programs/barf/barf.in b/programs/barf/barf.in -index e76c62f..7a7a61a 100755 ---- a/programs/barf/barf.in -+++ b/programs/barf/barf.in -@@ -248,7 +248,7 @@ if [ -r /proc/config_built_with ]; then - cat /proc/config_built_with - fi - _________________________ distro-release --for distro in /etc/redhat-release /etc/debian-release /etc/SuSE-release /etc/mandrake-release /etc/mandriva-release /etc/gentoo-release -+for distro in /etc/redhat-release /etc/anolis-release /etc/debian-release /etc/SuSE-release /etc/mandrake-release /etc/mandriva-release /etc/gentoo-release - do - if [ -f ${distro} ]; then - cat ${distro} -diff --git a/testing/guestbin/docker-transmogrify b/testing/guestbin/docker-transmogrify -index 0afa1f1..4dc7539 100755 ---- a/testing/guestbin/docker-transmogrify -+++ b/testing/guestbin/docker-transmogrify -@@ -34,7 +34,9 @@ macs['sunset'] = "12:00:00:ab:cd:01" - # conflicts with north - #macs['japan'] = "12:00:00:ab:cd:02" - --if os.path.isfile("/etc/redhat-release"): -+if os.path.isfile("/etc/anolis-release"): -+ GUESTOS = "anolis" -+elif os.path.isfile("/etc/redhat-release"): - GUESTOS = "redhat" - elif os.path.isfile("/etc/debian_version"): - GUESTOS = "debian" -@@ -136,7 +138,7 @@ else: - if os.path.isfile(hostname_file): - shutil.copyfile(hostname_file, "/etc/hostname") - --if GUESTOS == "redhat": -+if GUESTOS == "anolis": - - # these files are needed for systemd-networkd too - fnames = glob.glob("/testing/baseconfigs/all/etc/sysconfig/*") -@@ -216,7 +218,7 @@ for dbfile in glob.glob("/etc/ipsec.d/*.db"): - os.chmod(dbfile, 0o600) - - # SElinux fixup --if GUESTOS == "redhat": -+if GUESTOS == "anolis": - output += "\n" + subprocess.getoutput("restorecon -R /etc/") - - # selinux does not like our /testing include files --- -2.18.4 - diff --git a/libreswan-4.12-ikev1-compute-keymat-default.patch b/libreswan-4.12-ikev1-compute-keymat-default.patch new file mode 100644 index 0000000..7f283f0 --- /dev/null +++ b/libreswan-4.12-ikev1-compute-keymat-default.patch @@ -0,0 +1,92 @@ +From 5101913b1e623121a9222f11eefa18f0a2708b00 Mon Sep 17 00:00:00 2001 +From: Andrew Cagney +Date: Wed, 27 Mar 2024 10:43:19 -0400 +Subject: [PATCH] ikev1: in compute_proto_keymat() only allow explicitly + handled ESP algorithms + +--- + programs/pluto/ikev1_quick.c | 41 ++++++++++++++---------------------- + 1 file changed, 16 insertions(+), 25 deletions(-) + +diff --git a/programs/pluto/ikev1_quick.c b/programs/pluto/ikev1_quick.c +index 81c522c148..22c346afb4 100644 +--- a/programs/pluto/ikev1_quick.c ++++ b/programs/pluto/ikev1_quick.c +@@ -203,7 +203,7 @@ static bool emit_subnet_id(enum perspective perspective, + * RFC 2409 "IKE" section 5.5 + * specifies how this is to be done. + */ +-static void compute_proto_keymat(struct state *st, ++static bool compute_proto_keymat(struct state *st, + uint8_t protoid, + struct ipsec_proto_info *pi, + const char *satypename) +@@ -297,27 +297,13 @@ static void compute_proto_keymat(struct state *st, + } + break; + +- case ESP_CAST: +- case ESP_TWOFISH: +- case ESP_SERPENT: +- /* ESP_SEED is for IKEv1 only and not supported. Its number in IKEv2 has been re-used */ +- bad_case(pi->attrs.transattrs.ta_ikev1_encrypt); +- + default: +- /* bytes */ +- needed_len = encrypt_max_key_bit_length(pi->attrs.transattrs.ta_encrypt) / BITS_PER_BYTE; +- if (needed_len > 0) { +- /* XXX: check key_len coupling with kernel.c's */ +- if (pi->attrs.transattrs.enckeylen) { +- needed_len = +- pi->attrs.transattrs.enckeylen +- / BITS_PER_BYTE; +- dbg("compute_proto_keymat: key_len=%d from peer", +- (int)needed_len); +- } +- break; +- } +- bad_case(pi->attrs.transattrs.ta_ikev1_encrypt); ++ { ++ enum_buf eb; ++ llog(RC_LOG, st->st_logger, "rejecting request for keymat for %s", ++ str_enum(&esp_transformid_names, protoid, &eb)); ++ return false; ++ } + } + dbg("compute_proto_keymat: needed_len (after ESP enc)=%d", (int)needed_len); + needed_len += pi->attrs.transattrs.ta_integ->integ_keymat_size; +@@ -359,14 +345,17 @@ static void compute_proto_keymat(struct state *st, + DBG_dump_hunk(" inbound:", pi->inbound.keymat); + DBG_dump_hunk(" outbound:", pi->outbound.keymat); + } ++ ++ return true; + } + +-static void compute_keymats(struct state *st) ++static bool compute_keymats(struct state *st) + { + if (st->st_ah.present) +- compute_proto_keymat(st, PROTO_IPSEC_AH, &st->st_ah, "AH"); ++ return compute_proto_keymat(st, PROTO_IPSEC_AH, &st->st_ah, "AH"); + if (st->st_esp.present) +- compute_proto_keymat(st, PROTO_IPSEC_ESP, &st->st_esp, "ESP"); ++ return compute_proto_keymat(st, PROTO_IPSEC_ESP, &st->st_esp, "ESP"); ++ return false; + } + + /* +@@ -1460,7 +1449,9 @@ static stf_status quick_inI1_outR1_continue12_tail(struct state *st, struct msg_ + fixup_v1_HASH(st, &hash_fixup, st->st_v1_msgid.id, rbody.cur); + + /* Derive new keying material */ +- compute_keymats(st); ++ if (!compute_keymats(st)) { ++ return STF_FATAL; ++ } + + /* Tell the kernel to establish the new inbound SA + * (unless the commit bit is set -- which we don't support). +-- +2.45.0 + diff --git a/libreswan.spec b/libreswan.spec index 61d794b..d0ff40a 100644 --- a/libreswan.spec +++ b/libreswan.spec @@ -1,4 +1,3 @@ -%define anolis_release .0.2 %global _hardened_build 1 # These are rpm macros and are 0 or 1 %global with_efence 0 @@ -38,7 +37,7 @@ Name: libreswan Summary: IPsec implementation with IKEv1 and IKEv2 keying protocols # version is generated in the release script Version: 4.12 -Release: %{?prever:0.}2%{?prever:.%{prever}}%{anolis_release}%{?dist}.3 +Release: %{?prever:0.}2%{?prever:.%{prever}}%{?dist}.4 License: GPLv2 Url: https://libreswan.org/ @@ -55,10 +54,7 @@ Patch3: libreswan-4.1-maintain-obsolete-keywords.patch Patch6: libreswan-4.3-1934186-config.patch Patch7: libreswan-4.9-2176248-authby-rsasig.patch Patch8: libreswan-4.12-ikev2-auth-delete-state.patch - -#Add by Anolis -Patch1000: 0001-libreswan-anolis-rebrand-to-anolis.patch -#End +Patch9: libreswan-4.12-ikev1-compute-keymat-default.patch BuildRequires: audit-libs-devel BuildRequires: bison @@ -119,7 +115,7 @@ Libreswan is based on Openswan-2.6.38 which in turn is based on FreeS/WAN-2.04 %patch6 -p1 %patch7 -p1 %patch8 -p1 -%patch1000 -p1 +%patch9 -p1 # linking to freebl is not needed sed -i "s/-lfreebl //" mk/config.mk @@ -223,8 +219,8 @@ certutil -N -d sql:$tmpdir --empty-password %attr(0644,root,root) %doc %{_mandir}/*/* %changelog -* Fri Jun 28 2024 yangxiaoxuan - 4.12-2.0.2.3 -- Rebrand to anolis +* Thu Jun 6 2024 Daiki Ueno - 4.12-2.4 +- Fix CVE-2024-3652 (RHEL-32482) * Wed Apr 17 2024 Daiki Ueno - 4.12-2.3 - Bump release to ensure el8 package is greater than el8_* packages -- Gitee From 1fb1763ba980ee3b690c7a03db1ba4d14576662e Mon Sep 17 00:00:00 2001 From: "yangxiaoxuan@openanolis.org" Date: Mon, 21 Jun 2021 23:08:28 +0800 Subject: [PATCH 2/2] rebrand: rebrand to anolis Signed-off-by: yangxiaoxuan@openanolis.org Signed-off-by: hongwei-qin --- 0001-libreswan-anolis-rebrand-to-anolis.patch | 87 +++++++++++++++++++ libreswan.spec | 11 ++- 2 files changed, 97 insertions(+), 1 deletion(-) create mode 100644 0001-libreswan-anolis-rebrand-to-anolis.patch diff --git a/0001-libreswan-anolis-rebrand-to-anolis.patch b/0001-libreswan-anolis-rebrand-to-anolis.patch new file mode 100644 index 0000000..d8c4d71 --- /dev/null +++ b/0001-libreswan-anolis-rebrand-to-anolis.patch @@ -0,0 +1,87 @@ +From c0ae1f9070d386036a793d3e8eac7a787e7017a0 Mon Sep 17 00:00:00 2001 +From: "yangxiaoxuan@openanolis.org" +Date: Mon, 21 Jun 2021 22:48:03 +0800 +Subject: [PATCH] libreswan anolis rebrand to anolis + +--- + Makefile | 2 +- + mk/defaults/linux.mk | 2 +- + programs/barf/barf.in | 2 +- + testing/guestbin/docker-transmogrify | 8 +++++--- + 4 files changed, 8 insertions(+), 6 deletions(-) + +diff --git a/Makefile b/Makefile +index db230d4..bafddc2 100644 +--- a/Makefile ++++ b/Makefile +@@ -27,7 +27,7 @@ include ${LIBRESWANSRCDIR}/Makefile.inc + MAIN_RPM_VERSION = $(shell make showversion | sed "s/-.*//") + MAIN_RPM_PREVER = $(shell make showversion | sed -e "s/^.[^-]*-\([^-]*\)-\(.*\)/rc\1_\2/" -e "s/-/_/g") + MAIN_RPM_PREFIX = libreswan-$(MAIN_RPM_VERSION)$(MAIN_RPM_PREVER) +-MAIN_RPM_RHEL_PKG = $(shell rpm -qf /etc/redhat-release) ++MAIN_RPM_RHEL_PKG = $(shell rpm -qf /etc/anolis-release) + MAIN_RPM_RHEL_VERSION = $(shell echo $(MAIN_RPM_RHEL_PKG) | sed "s/.*-release-\(.\).*/\1/") + MAIN_RPM_SPECFILE = $(shell if [ -f /etc/fedora-release ]; then echo packaging/fedora/libreswan.spec; elif [ -n "$(MAIN_RPM_RHEL_VERSION)" ]; then echo packaging/rhel/$(MAIN_RPM_RHEL_VERSION)/libreswan.spec; else echo "unknown distro, cannot find spec file to use in packaging directory"; fi) + RHEL_LIKE= $(shell cat /etc/os-release | grep ID_LIKE | sed -e "s/ID_LIKE=//" -e 's/"//g' -e "s/ .*//") +diff --git a/mk/defaults/linux.mk b/mk/defaults/linux.mk +index c286a7d..56a3e20 100644 +--- a/mk/defaults/linux.mk ++++ b/mk/defaults/linux.mk +@@ -131,7 +131,7 @@ ifndef INITSYSTEM + ifndef INITSYSTEM + ifneq ($(and $(wildcard /lib/systemd/systemd),$(wildcard /run/systemd)),) + INITSYSTEM=systemd +- else ifneq ($(and $(wildcard /sbin/start),$(wildcard /etc/redhat-release)),) ++ else ifneq ($(and $(wildcard /sbin/start),$(wildcard /etc/anolis-release)),) + # override for rhel/centos to use sysvinit + INITSYSTEM=sysvinit + else ifneq ($(wildcard /sbin/start),) +diff --git a/programs/barf/barf.in b/programs/barf/barf.in +index e76c62f..7a7a61a 100755 +--- a/programs/barf/barf.in ++++ b/programs/barf/barf.in +@@ -248,7 +248,7 @@ if [ -r /proc/config_built_with ]; then + cat /proc/config_built_with + fi + _________________________ distro-release +-for distro in /etc/redhat-release /etc/debian-release /etc/SuSE-release /etc/mandrake-release /etc/mandriva-release /etc/gentoo-release ++for distro in /etc/redhat-release /etc/anolis-release /etc/debian-release /etc/SuSE-release /etc/mandrake-release /etc/mandriva-release /etc/gentoo-release + do + if [ -f ${distro} ]; then + cat ${distro} +diff --git a/testing/guestbin/docker-transmogrify b/testing/guestbin/docker-transmogrify +index 0afa1f1..4dc7539 100755 +--- a/testing/guestbin/docker-transmogrify ++++ b/testing/guestbin/docker-transmogrify +@@ -34,7 +34,9 @@ macs['sunset'] = "12:00:00:ab:cd:01" + # conflicts with north + #macs['japan'] = "12:00:00:ab:cd:02" + +-if os.path.isfile("/etc/redhat-release"): ++if os.path.isfile("/etc/anolis-release"): ++ GUESTOS = "anolis" ++elif os.path.isfile("/etc/redhat-release"): + GUESTOS = "redhat" + elif os.path.isfile("/etc/debian_version"): + GUESTOS = "debian" +@@ -136,7 +138,7 @@ else: + if os.path.isfile(hostname_file): + shutil.copyfile(hostname_file, "/etc/hostname") + +-if GUESTOS == "redhat": ++if GUESTOS == "anolis": + + # these files are needed for systemd-networkd too + fnames = glob.glob("/testing/baseconfigs/all/etc/sysconfig/*") +@@ -216,7 +218,7 @@ for dbfile in glob.glob("/etc/ipsec.d/*.db"): + os.chmod(dbfile, 0o600) + + # SElinux fixup +-if GUESTOS == "redhat": ++if GUESTOS == "anolis": + output += "\n" + subprocess.getoutput("restorecon -R /etc/") + + # selinux does not like our /testing include files +-- +2.18.4 + diff --git a/libreswan.spec b/libreswan.spec index d0ff40a..28829ff 100644 --- a/libreswan.spec +++ b/libreswan.spec @@ -1,3 +1,4 @@ +%define anolis_release .0.2 %global _hardened_build 1 # These are rpm macros and are 0 or 1 %global with_efence 0 @@ -37,7 +38,7 @@ Name: libreswan Summary: IPsec implementation with IKEv1 and IKEv2 keying protocols # version is generated in the release script Version: 4.12 -Release: %{?prever:0.}2%{?prever:.%{prever}}%{?dist}.4 +Release: %{?prever:0.}2%{?prever:.%{prever}}%{anolis_release}%{?dist}.4 License: GPLv2 Url: https://libreswan.org/ @@ -56,6 +57,10 @@ Patch7: libreswan-4.9-2176248-authby-rsasig.patch Patch8: libreswan-4.12-ikev2-auth-delete-state.patch Patch9: libreswan-4.12-ikev1-compute-keymat-default.patch +#Add by Anolis +Patch1000: 0001-libreswan-anolis-rebrand-to-anolis.patch +#End + BuildRequires: audit-libs-devel BuildRequires: bison BuildRequires: curl-devel @@ -116,6 +121,7 @@ Libreswan is based on Openswan-2.6.38 which in turn is based on FreeS/WAN-2.04 %patch7 -p1 %patch8 -p1 %patch9 -p1 +%patch1000 -p1 # linking to freebl is not needed sed -i "s/-lfreebl //" mk/config.mk @@ -219,6 +225,9 @@ certutil -N -d sql:$tmpdir --empty-password %attr(0644,root,root) %doc %{_mandir}/*/* %changelog +* Fri Jun 28 2024 yangxiaoxuan - 4.12-2.0.2.4 +- Rebrand to anolis + * Thu Jun 6 2024 Daiki Ueno - 4.12-2.4 - Fix CVE-2024-3652 (RHEL-32482) -- Gitee