Accepting request 1137764 from home:mwilck:branches:network:utilities

Fixed the changelog, and while at it, modified the package to use
a git-centric workflow rather than patches in the spec file.
Git repo is https://github.com/openSUSE/ktls-utils, I've added
hreinecke and wagi as maintainers.

- Update to version 0.9+4.g01b3018 (jsc#PED-7559)
  * _service: move to openSUSE git repository
- Patches now in git, remove them from spec file:
  * del 0001-netlink-de-constify-nla_policy
  * del 0001-tlshd-Allow-for-compilation-with-older-libnl-librari.patch
  * del 0002-tlshd-Check-for-gnutls_get_system_config_file.patch
  * del 0003-tlshd-add-delay-configuration-parameter.patch

Wed 16 Aug 2023 08:21:59 PM CEST - Hannes Reinecke <hare@suse.de>

OBS-URL: https://build.opensuse.org/request/show/1137764
OBS-URL: https://build.opensuse.org/package/show/network:utilities/ktls-utils?expand=0&rev=3
This commit is contained in:
Hannes Reinecke 2024-01-10 11:47:39 +00:00 committed by Git OBS Bridge
parent 7130db003f
commit c837b6b97e
12 changed files with 28 additions and 269 deletions

2
.gitattributes vendored
View File

@ -21,5 +21,3 @@
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
## Specific LFS patterns
ktls-utils-0.9.tar filter=lfs diff=lfs merge=lfs -text

View File

@ -1,52 +0,0 @@
From c3a79bffbf559f508892b7e4cbdc3a8b8fff0911 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 16 Aug 2023 13:02:36 +0200
Subject: [PATCH 1/3] tlshd: Allow for compilation with older libnl libraries
Prior to version 3.5 libnl3 is missing the 'const' specified for
nla_policy, causing a compilation error.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
src/tlshd/netlink.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/tlshd/netlink.c b/src/tlshd/netlink.c
index 792046f..22d929d 100644
--- a/src/tlshd/netlink.c
+++ b/src/tlshd/netlink.c
@@ -43,6 +43,7 @@
#include <netlink/msg.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/ctrl.h>
+#include <netlink/version.h>
#include <glib.h>
@@ -84,7 +85,11 @@ static void tlshd_genl_sock_close(struct nl_sock *nls)
nl_socket_free(nls);
}
+#if LIBNL_VER_NUM >= LIBNL_VER(3,5)
static const struct nla_policy
+#else
+static struct nla_policy
+#endif
tlshd_accept_nl_policy[HANDSHAKE_A_ACCEPT_MAX + 1] = {
[HANDSHAKE_A_ACCEPT_SOCKFD] = { .type = NLA_U32, },
[HANDSHAKE_A_ACCEPT_HANDLER_CLASS] = { .type = NLA_U32, },
@@ -190,7 +195,11 @@ static void tlshd_parse_peer_identity(struct tlshd_handshake_parms *parms,
parms->peerids[0] = nla_get_u32(head);
}
+#if LIBNL_VER_NUM >= LIBNL_VER(3,5)
static const struct nla_policy
+#else
+static struct nla_policy
+#endif
tlshd_x509_nl_policy[HANDSHAKE_A_X509_MAX + 1] = {
[HANDSHAKE_A_X509_CERT] = { .type = NLA_U32, },
[HANDSHAKE_A_X509_PRIVKEY] = { .type = NLA_U32, },
--
2.35.3

View File

@ -1,42 +0,0 @@
From 52ac9ff05a5edb5ccda33ee186ba388553b258c4 Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton@kernel.org>
Date: Tue, 20 Jun 2023 13:20:14 -0400
Subject: [PATCH] tlshd: fix max config file size comparison
gcc throws a warning on 32-bit x86 because of signedness mismatch:
config.c:155:52: error: comparison of integer expressions of different signedness: '__off_t' {aka 'long int'} and 'unsigned int' [-Werror=sign-compare]
155 | if (statbuf.st_size < 0 || statbuf.st_size > UINT_MAX) {
| ^
st_size is a signed value (off_t), but UINT_MAX is unsigned.
Change it to compare against INT_MAX instead. This technically cuts the
max size of the config file in half to only 2GB, but I don't think we'll
miss it.
Cc: Steve Dickson <steved@redhat.com>
Reported-by: Petr Pisar <ppisar@redhat.com>
Link: https://bugzilla.redhat.com/show_bug.cgi?id=2182151
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
src/tlshd/config.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tlshd/config.c b/src/tlshd/config.c
index 87cc401..bdab98b 100644
--- a/src/tlshd/config.c
+++ b/src/tlshd/config.c
@@ -152,7 +152,7 @@ static bool tlshd_config_read_datum(const char *pathname, gnutls_datum_t *data,
tlshd_log_perror("stat");
goto out_close;
}
- if (statbuf.st_size < 0 || statbuf.st_size > UINT_MAX) {
+ if (statbuf.st_size < 0 || statbuf.st_size > INT_MAX) {
tlshd_log_error("Bad config file size: %lld", statbuf.st_size);
goto out_close;
}
--
2.35.3

View File

@ -1,64 +0,0 @@
From df6c41cf7b3e39496ebf0415d635f3fd4a3a4606 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 16 Aug 2023 08:05:34 +0200
Subject: [PATCH 2/3] tlshd: Check for gnutls_get_system_config_file()
Older gnutls releases might not have the function
gnutls_get_system_config_file(), so add a configuration check.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
configure.ac | 3 +++
src/tlshd/client.c | 5 ++++-
src/tlshd/server.c | 5 ++++-
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0c98271..83ab880 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,9 @@ AC_CHECK_LIB([gnutls], [gnutls_transport_is_ktls_enabled],
AC_CHECK_LIB([gnutls], [gnutls_protocol_set_enabled],
[AC_DEFINE([HAVE_GNUTLS_PROTOCOL_SET_ENABLED], [1],
[Define to 1 if you have the gnutls_protocol_set_enabled function.])])
+AC_CHECK_LIB([gnutls], [gnutls_get_system_config_file],
+ [AC_DEFINE([HAVE_GNUTLS_GET_SYSTEM_CONFIG_FILE], [1],
+ [Define to 1 if you have the gnutls_get_system_config_file function.])])
AC_SUBST([AM_CPPFLAGS])
AC_CONFIG_FILES([Makefile src/Makefile src/tlshd/Makefile systemd/Makefile])
diff --git a/src/tlshd/client.c b/src/tlshd/client.c
index 6a16263..1f8648f 100644
--- a/src/tlshd/client.c
+++ b/src/tlshd/client.c
@@ -392,7 +392,10 @@ void tlshd_clienthello_handshake(struct tlshd_handshake_parms *parms)
gnutls_global_set_log_function(tlshd_gnutls_log_func);
gnutls_global_set_audit_log_function(tlshd_gnutls_audit_func);
- tlshd_log_debug("System config file: %s", gnutls_get_system_config_file());
+#ifdef HAVE_GNUTLS_GET_SYSTEM_CONFIG_FILE
+ tlshd_log_debug("System config file: %s",
+ gnutls_get_system_config_file());
+#endif
switch (parms->auth_mode) {
case HANDSHAKE_AUTH_UNAUTH:
diff --git a/src/tlshd/server.c b/src/tlshd/server.c
index b969d57..f7be6ad 100644
--- a/src/tlshd/server.c
+++ b/src/tlshd/server.c
@@ -339,7 +339,10 @@ void tlshd_serverhello_handshake(struct tlshd_handshake_parms *parms)
gnutls_global_set_log_function(tlshd_gnutls_log_func);
gnutls_global_set_audit_log_function(tlshd_gnutls_audit_func);
- tlshd_log_debug("System config file: %s", gnutls_get_system_config_file());
+#ifdef HAVE_GNUTLS_GET_SYSTEM_CONFIG_FILE
+ tlshd_log_debug("System config file: %s",
+ gnutls_get_system_config_file());
+#endif
switch (parms->auth_mode) {
case HANDSHAKE_AUTH_X509:
--
2.35.3

View File

@ -1,87 +0,0 @@
From 9a5954891770c440797b25f6fecf6d72abd65b0a Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 16 Aug 2023 12:52:11 +0200
Subject: [PATCH 3/3] tlshd: add 'delay' configuration parameter
Add a 'delay' configuration parameter to delay the 'done' message
for exercising the timeout handling.
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
src/tlshd/config.c | 2 ++
src/tlshd/netlink.c | 8 ++++++++
src/tlshd/tlshd.conf.man | 6 ++++++
src/tlshd/tlshd.h | 1 +
4 files changed, 17 insertions(+)
diff --git a/src/tlshd/config.c b/src/tlshd/config.c
index bdab98b..4e59bb5 100644
--- a/src/tlshd/config.c
+++ b/src/tlshd/config.c
@@ -81,6 +81,8 @@ bool tlshd_config_init(const gchar *pathname)
"main", "tlsdebug", NULL);
nl_debug = g_key_file_get_integer(tlshd_configuration, "main",
"nl_debug", NULL);
+ tlshd_delay = g_key_file_get_integer(tlshd_configuration, "main",
+ "delay", NULL);
keyrings = g_key_file_get_string_list(tlshd_configuration, "main",
"keyrings", &length, NULL);
diff --git a/src/tlshd/netlink.c b/src/tlshd/netlink.c
index 22d929d..e4bc21f 100644
--- a/src/tlshd/netlink.c
+++ b/src/tlshd/netlink.c
@@ -50,6 +50,8 @@
#include "tlshd.h"
#include "netlink.h"
+int tlshd_delay;
+
static int tlshd_genl_sock_open(struct nl_sock **sock)
{
struct nl_sock *nls;
@@ -467,6 +469,12 @@ void tlshd_genl_done(struct tlshd_handshake_parms *parms)
goto out_free;
sendit:
+ if (tlshd_delay) {
+ /* delay to test timeout handling */
+ tlshd_log_debug("delay %d seconds", tlshd_delay);
+ sleep(tlshd_delay);
+ }
+
nl_socket_disable_auto_ack(nls);
err = nl_send_auto(nls, msg);
if (err < 0) {
diff --git a/src/tlshd/tlshd.conf.man b/src/tlshd/tlshd.conf.man
index 0292c89..7d27035 100644
--- a/src/tlshd/tlshd.conf.man
+++ b/src/tlshd/tlshd.conf.man
@@ -67,6 +67,12 @@ This option specifies an integer which indicates the debug message level
for netlink operations.
Zero, the quietest setting, is the default.
.TP
+.B delay
+This options specifies an integer which indicates the number of seconds
+by which the handshake completion should be delayed. This can be used
+to exercise the timeout handling for the TLS handshake.
+Zero disables any delay.
+.TP
.B keyrings
This option specifies a semicolon-separated list of auxiliary keyrings
that might contain handshake authentication tokens.
diff --git a/src/tlshd/tlshd.h b/src/tlshd/tlshd.h
index c4da3fd..2e2a9f1 100644
--- a/src/tlshd/tlshd.h
+++ b/src/tlshd/tlshd.h
@@ -22,6 +22,7 @@
extern int tlshd_debug;
extern int tlshd_tls_debug;
+extern int tlshd_delay;
extern int tlshd_stderr;
struct nl_sock;
--
2.35.3

View File

@ -2,11 +2,13 @@
<services>
<service name="obs_scm" mode="manual">
<param name="scm">git</param>
<param name="url">https://github.com/oracle/ktls-utils.git</param>
<param name="url">https://github.com/openSUSE/ktls-utils.git</param>
<param name="filename">ktls-utils</param>
<param name="versionformat">0.9</param>
<param name="revision">ktls-utils-0.9</param>
<param name="match-tag">ktls-utils-0.[0-9]</param>
<param name="versionformat">@PARENT_TAG@+@TAG_OFFSET@.g%h</param>
<param name="versionrewrite-pattern">ktls-utils-([0-9]\.[0-9]+)</param>
<param name="versionrewrite-replacement">\1</param>
<param name="revision">suse-0.9</param>
<param name="match-tag">ktls-utils-*</param>
<param name="changesgenerate">enable</param>
</service>
<service name="set_version" mode="manual"/>

View File

@ -1,4 +1,6 @@
<servicedata>
<service name="tar_scm">
<param name="url">https://github.com/oracle/ktls-utils.git</param>
<param name="changesrevision">198ff00ba28cb97cdab6e49a7422cce331fde198</param></service></servicedata>
<param name="changesrevision">198ff00ba28cb97cdab6e49a7422cce331fde198</param></service><service name="tar_scm">
<param name="url">https://github.com/openSUSE/ktls-utils.git</param>
<param name="changesrevision">01b3018189117e3aa495af2f1eec22fdce6b6be3</param></service></servicedata>

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bb38359c7168e6a58f6a7c02c213e02af5e60a0cb15c156d35229b8caf08c0a7
size 193035

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:df6884d27dec09b62dc5d0ca98a562ba4376ca9151255410e348e1a4e2ca0420
size 225280

View File

@ -1,5 +1,16 @@
-------------------------------------------------------------------
Wed 16 Aug 2023 01:21:59 PM CEST - Hannes Reinecke <hare@suse.de>
Tue Jan 9 16:12:57 UTC 2024 - Martin Wilck <mwilck@suse.com>
- Update to version 0.9+4.g01b3018 (jsc#PED-7559)
* _service: move to openSUSE git repository
- Patches now in git, remove them from spec file:
* del 0001-netlink-de-constify-nla_policy
* del 0001-tlshd-Allow-for-compilation-with-older-libnl-librari.patch
* del 0002-tlshd-Check-for-gnutls_get_system_config_file.patch
* del 0003-tlshd-add-delay-configuration-parameter.patch
-------------------------------------------------------------------
Wed 16 Aug 2023 08:21:59 PM CEST - Hannes Reinecke <hare@suse.de>
- Reshuffle patches to match upstream submission:
* Remove 0001-netlink-de-constify-nla_policy

View File

@ -1,4 +1,4 @@
name: ktls-utils
version: 0.9
mtime: 1684347082
commit: 198ff00ba28cb97cdab6e49a7422cce331fde198
version: 0.9+4.g01b3018
mtime: 1704814854
commit: 01b3018189117e3aa495af2f1eec22fdce6b6be3

View File

@ -20,17 +20,13 @@
%global _make_output_sync -Orecurse
Name: ktls-utils
Version: 0.9
Version: 0.9+4.g01b3018
Release: 0
Summary: Tools to Manage Multipathed Devices with the device-mapper
License: GPL-2.0-only AND GPL-3.0-or-later
Group: System/Base
URL: https://github.com/oracle/ktls-utils
Source: ktls-utils-%{version}.tar
Patch0: 0001-tlshd-fix-max-config-file-size-comparison.patch
Patch1: 0001-tlshd-Allow-for-compilation-with-older-libnl-librari.patch
Patch2: 0002-tlshd-Check-for-gnutls_get_system_config_file.patch
Patch3: 0003-tlshd-add-delay-configuration-parameter.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%{systemd_requires}
BuildRequires: autoconf
@ -40,7 +36,6 @@ BuildRequires: keyutils-devel
BuildRequires: glib2-devel
BuildRequires: libnl3-devel
BuildRequires: pkgconfig(systemd)
#BuildRequires: pkgconfig(mount)
PreReq: coreutils
PreReq: grep
@ -61,10 +56,6 @@ This package of software provides a TLS handshake user agent that listens for ke
%prep
%setup -q -n ktls-utils-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
./autogen.sh