summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Kang <kai.kang@windriver.com>2023-07-28 14:30:08 +0800
committerArmin Kuster <akuster808@gmail.com>2023-08-06 11:31:18 -0400
commit782251aa8fe387b2545c8e7e20a1a90c26300883 (patch)
treeb01f822c867722b396a51e3657495af9034648c6
parent21bb5627e0949d7ea72ad7be7add21eafbb5319b (diff)
downloadmeta-security-782251aa8fe387b2545c8e7e20a1a90c26300883.tar.gz
sssd: 2.7.4 -> 2.9.1
Update sssd from 2.7.4 to 2.9.1. * backport patch to fix interpreter of script sss_analyze * add runtime dependency python3-systemd when systemd is enabled * update FILES Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch318
-rw-r--r--dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.9.1.bb (renamed from dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.7.4.bb)8
2 files changed, 323 insertions, 3 deletions
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch b/dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch
new file mode 100644
index 0000000..6880405
--- /dev/null
+++ b/dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch
@@ -0,0 +1,318 @@
1Backport patch to fix interpreter of sss_analyze.
2
3Upstream-Status: Backport [https://github.com/SSSD/sssd/commit/ed3726c]
4
5Signed-off-by: Kai Kang <kai.kang@windriver.com>
6
7From ed3726c37fe07aab788404bfa2f9003db15f4210 Mon Sep 17 00:00:00 2001
8From: roy214 <abroy@redhat.com>
9Date: Tue, 25 Apr 2023 20:01:24 +0530
10Subject: [PATCH] sssctl: add error analyzer
11MIME-Version: 1.0
12Content-Type: text/plain; charset=UTF-8
13Content-Transfer-Encoding: 8bit
14
15Also removing unused variable and import.
16
17Reviewed-by: Justin Stephenson <jstephen@redhat.com>
18Reviewed-by: Tomáš Halman <thalman@redhat.com>
19---
20 src/tools/analyzer/Makefile.am | 2 +
21 src/tools/analyzer/modules/error.py | 61 +++++++++++++++++++++++++++
22 src/tools/analyzer/modules/request.py | 54 +++++-------------------
23 src/tools/analyzer/sss_analyze | 2 +-
24 src/tools/analyzer/sss_analyze.py | 3 ++
25 src/tools/analyzer/util.py | 44 +++++++++++++++++++
26 6 files changed, 121 insertions(+), 45 deletions(-)
27 create mode 100644 src/tools/analyzer/modules/error.py
28 create mode 100644 src/tools/analyzer/util.py
29
30diff --git a/src/tools/analyzer/Makefile.am b/src/tools/analyzer/Makefile.am
31index b40043d043..7692af8528 100644
32--- a/src/tools/analyzer/Makefile.am
33+++ b/src/tools/analyzer/Makefile.am
34@@ -13,10 +13,12 @@ dist_pkgpython_DATA = \
35 source_reader.py \
36 parser.py \
37 sss_analyze.py \
38+ util.py \
39 $(NULL)
40
41 modulesdir = $(pkgpythondir)/modules
42 dist_modules_DATA = \
43 modules/__init__.py \
44 modules/request.py \
45+ modules/error.py \
46 $(NULL)
47diff --git a/src/tools/analyzer/modules/error.py b/src/tools/analyzer/modules/error.py
48new file mode 100644
49index 0000000000..71173670c5
50--- /dev/null
51+++ b/src/tools/analyzer/modules/error.py
52@@ -0,0 +1,61 @@
53+from sssd import util
54+from sssd.parser import SubparsersAction
55+from sssd import sss_analyze
56+
57+class ErrorAnalyzer:
58+ """
59+ An error analyzer module, list if there is any error reported by sssd_be
60+ """
61+ module_parser = None
62+ print_opts = []
63+
64+ def print_module_help(self, args):
65+ """
66+ Print the module parser help output
67+
68+ Args:
69+ args (Namespace): argparse parsed arguments
70+ """
71+ self.module_parser.print_help()
72+
73+ def setup_args(self, parser_grp, cli):
74+ """
75+ Setup module parser, subcommands, and options
76+
77+ Args:
78+ parser_grp (argparse.Action): Parser group to nest
79+ module and subcommands under
80+ """
81+ desc = "Analyze error check module"
82+ self.module_parser = parser_grp.add_parser('error',
83+ description=desc,
84+ help='Error checker')
85+
86+ subparser = self.module_parser.add_subparsers(title=None,
87+ dest='subparser',
88+ action=SubparsersAction,
89+ metavar='COMMANDS')
90+
91+ subcmd_grp = subparser.add_parser_group('Operation Modes')
92+ cli.add_subcommand(subcmd_grp, 'list', 'Print error messages found in backend',
93+ self.print_error, self.print_opts)
94+
95+ self.module_parser.set_defaults(func=self.print_module_help)
96+
97+ return self.module_parser
98+
99+ def print_error(self, args):
100+ err = 0
101+ utl = util.Utils()
102+ source = utl.load(args)
103+ component = source.Component.BE
104+ source.set_component(component, False)
105+ patterns = ['sdap_async_sys_connect request failed', 'terminated by own WATCHDOG',
106+ 'ldap_sasl_interactive_bind_s failed', 'Communication with KDC timed out', 'SSSD is offline', 'Backend is offline',
107+ 'tsig verify failure', 'ldap_install_tls failed', 's2n exop request failed']
108+ for line in utl.matched_line(source, patterns):
109+ err +=1
110+ print(line)
111+ if err > 0:
112+ print("For possible solutions please refer to https://sssd.io/troubleshooting/errors.html")
113+ return
114diff --git a/src/tools/analyzer/modules/request.py b/src/tools/analyzer/modules/request.py
115index d661dddb84..e4d5f060c7 100644
116--- a/src/tools/analyzer/modules/request.py
117+++ b/src/tools/analyzer/modules/request.py
118@@ -1,6 +1,6 @@
119 import re
120 import logging
121-
122+from sssd import util
123 from sssd.parser import SubparsersAction
124 from sssd.parser import Option
125
126@@ -38,7 +38,6 @@ def print_module_help(self, args):
127 def setup_args(self, parser_grp, cli):
128 """
129 Setup module parser, subcommands, and options
130-
131 Args:
132 parser_grp (argparse.Action): Parser group to nest
133 module and subcommands under
134@@ -63,42 +62,6 @@ def setup_args(self, parser_grp, cli):
135
136 return self.module_parser
137
138- def load(self, args):
139- """
140- Load the appropriate source reader.
141-
142- Args:
143- args (Namespace): argparse parsed arguments
144-
145- Returns:
146- Instantiated source object
147- """
148- if args.source == "journald":
149- from sssd.source_journald import Journald
150- source = Journald()
151- else:
152- from sssd.source_files import Files
153- source = Files(args.logdir)
154- return source
155-
156- def matched_line(self, source, patterns):
157- """
158- Yield lines which match any number of patterns (OR) in
159- provided patterns list.
160-
161- Args:
162- source (Reader): source Reader object
163- Yields:
164- lines matching the provided pattern(s)
165- """
166- for line in source:
167- for pattern in patterns:
168- re_obj = re.compile(pattern)
169- if re_obj.search(line):
170- if line.startswith(' * '):
171- continue
172- yield line
173-
174 def get_linked_ids(self, source, pattern, regex):
175 """
176 Retrieve list of associated REQ_TRACE ids. Filter
177@@ -114,8 +77,9 @@ def get_linked_ids(self, source, pattern, regex):
178 Returns:
179 List of linked ids discovered
180 """
181+ utl = util.Utils()
182 linked_ids = []
183- for match in self.matched_line(source, pattern):
184+ for match in utl.matched_line(source, pattern):
185 id_re = re.compile(regex)
186 match = id_re.search(match)
187 if match:
188@@ -250,7 +214,8 @@ def list_requests(self, args):
189 Args:
190 args (Namespace): populated argparse namespace
191 """
192- source = self.load(args)
193+ utl = util.Utils()
194+ source = utl.load(args)
195 component = source.Component.NSS
196 resp = "nss"
197 # Log messages matching the following regex patterns contain
198@@ -266,7 +231,7 @@ def list_requests(self, args):
199 if args.verbose:
200 self.print_formatted_verbose(source)
201 else:
202- for line in self.matched_line(source, patterns):
203+ for line in utl.matched_line(source, patterns):
204 if type(source).__name__ == 'Journald':
205 print(line)
206 else:
207@@ -279,7 +244,8 @@ def track_request(self, args):
208 Args:
209 args (Namespace): populated argparse namespace
210 """
211- source = self.load(args)
212+ utl = util.Utils()
213+ source = utl.load(args)
214 cid = args.cid
215 resp_results = False
216 be_results = False
217@@ -294,7 +260,7 @@ def track_request(self, args):
218 logger.info(f"******** Checking {resp} responder for Client ID"
219 f" {cid} *******")
220 source.set_component(component, args.child)
221- for match in self.matched_line(source, pattern):
222+ for match in utl.matched_line(source, pattern):
223 resp_results = self.consume_line(match, source, args.merge)
224
225 logger.info(f"********* Checking Backend for Client ID {cid} ********")
226@@ -307,7 +273,7 @@ def track_request(self, args):
227 pattern.clear()
228 [pattern.append(f'\\{id}') for id in be_ids]
229
230- for match in self.matched_line(source, pattern):
231+ for match in utl.matched_line(source, pattern):
232 be_results = self.consume_line(match, source, args.merge)
233
234 if args.merge:
235diff --git a/src/tools/analyzer/sss_analyze b/src/tools/analyzer/sss_analyze
236index 3f1beaf38b..6d4b5b30c6 100755
237--- a/src/tools/analyzer/sss_analyze
238+++ b/src/tools/analyzer/sss_analyze
239@@ -1,4 +1,4 @@
240-#!/usr/bin/env python
241+#!/usr/bin/env python3
242
243 from sssd import sss_analyze
244
245diff --git a/src/tools/analyzer/sss_analyze.py b/src/tools/analyzer/sss_analyze.py
246index 18b998f380..dafc84fc03 100644
247--- a/src/tools/analyzer/sss_analyze.py
248+++ b/src/tools/analyzer/sss_analyze.py
249@@ -1,6 +1,7 @@
250 import argparse
251
252 from sssd.modules import request
253+from sssd.modules import error
254 from sssd.parser import SubparsersAction
255
256
257@@ -55,9 +56,11 @@ def load_modules(self, parser, parser_grp):
258 """
259 # Currently only the 'request' module exists
260 req = request.RequestAnalyzer()
261+ err = error.ErrorAnalyzer()
262 cli = Analyzer()
263
264 req.setup_args(parser_grp, cli)
265+ err.setup_args(parser_grp, cli)
266
267 def setup_args(self):
268 """
269diff --git a/src/tools/analyzer/util.py b/src/tools/analyzer/util.py
270new file mode 100644
271index 0000000000..2a8d153a71
272--- /dev/null
273+++ b/src/tools/analyzer/util.py
274@@ -0,0 +1,44 @@
275+import re
276+import logging
277+
278+from sssd.source_files import Files
279+from sssd.source_journald import Journald
280+
281+logger = logging.getLogger()
282+
283+
284+class Utils:
285+
286+ def load(self, args):
287+ """
288+ Load the appropriate source reader.
289+
290+ Args:
291+ args (Namespace): argparse parsed arguments
292+
293+ Returns:
294+ Instantiated source object
295+ """
296+ if args.source == "journald":
297+ source = Journald()
298+ else:
299+ source = Files(args.logdir)
300+ return source
301+
302+ def matched_line(self, source, patterns):
303+ """
304+ Yield lines which match any number of patterns (OR) in
305+ provided patterns list.
306+
307+ Args:
308+ source (Reader): source Reader object
309+ Yields:
310+ lines matching the provided pattern(s)
311+ """
312+ for line in source:
313+ for pattern in patterns:
314+ re_obj = re.compile(pattern)
315+ if re_obj.search(line):
316+ if line.startswith(' * '):
317+ continue
318+ yield line
diff --git a/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.7.4.bb b/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.9.1.bb
index 78d29c3..9fa9d3b 100644
--- a/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.7.4.bb
+++ b/dynamic-layers/networking-layer/recipes-security/sssd/sssd_2.9.1.bb
@@ -16,7 +16,7 @@ DEPENDS:append:libc-musl = " musl-nscd"
16DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'nss', '', \ 16DEPENDS += "${@bb.utils.contains('PACKAGECONFIG', 'nss', '', \
17 bb.utils.contains('PACKAGECONFIG', 'crypto', '', 'nss', d), d)}" 17 bb.utils.contains('PACKAGECONFIG', 'crypto', '', 'nss', d), d)}"
18 18
19SRC_URI = "https://github.com/SSSD/sssd/releases/download/${PV}/sssd-${PV}.tar.gz \ 19SRC_URI = "https://github.com/SSSD/sssd/releases/download/${PV}/${BP}.tar.gz \
20 file://sssd.conf \ 20 file://sssd.conf \
21 file://volatiles.99_sssd \ 21 file://volatiles.99_sssd \
22 file://no_gen.patch \ 22 file://no_gen.patch \
@@ -24,9 +24,10 @@ SRC_URI = "https://github.com/SSSD/sssd/releases/download/${PV}/sssd-${PV}.tar.g
24 file://drop_ntpdate_chk.patch \ 24 file://drop_ntpdate_chk.patch \
25 file://fix-ldblibdir.patch \ 25 file://fix-ldblibdir.patch \
26 file://musl_fixup.patch \ 26 file://musl_fixup.patch \
27 file://0001-sssctl-add-error-analyzer.patch \
27 " 28 "
28 29
29SRC_URI[sha256sum] = "10ef90c63fdbfda905145077679035bd5ad16b24daad13160de8d0ff82ea9950" 30SRC_URI[sha256sum] = "97703d38159994a869aad1c852de4582c76f189cf044f51e15ba26e1e4b75298"
30 31
31UPSTREAM_CHECK_URI = "https://github.com/SSSD/${BPN}/releases" 32UPSTREAM_CHECK_URI = "https://github.com/SSSD/${BPN}/releases"
32 33
@@ -58,7 +59,7 @@ PACKAGECONFIG[samba] = "--with-samba, --with-samba=no, samba"
58PACKAGECONFIG[selinux] = "--with-selinux, --with-selinux=no --with-semanage=no, libselinux" 59PACKAGECONFIG[selinux] = "--with-selinux, --with-selinux=no --with-semanage=no, libselinux"
59PACKAGECONFIG[ssh] = "--with-ssh, --with-ssh=no, " 60PACKAGECONFIG[ssh] = "--with-ssh, --with-ssh=no, "
60PACKAGECONFIG[sudo] = "--with-sudo, --with-sudo=no, " 61PACKAGECONFIG[sudo] = "--with-sudo, --with-sudo=no, "
61PACKAGECONFIG[systemd] = "--with-initscript=systemd,--with-initscript=sysv" 62PACKAGECONFIG[systemd] = "--with-initscript=systemd,--with-initscript=sysv,,python3-systemd"
62 63
63EXTRA_OECONF += " \ 64EXTRA_OECONF += " \
64 --disable-cifs-idmap-plugin \ 65 --disable-cifs-idmap-plugin \
@@ -146,6 +147,7 @@ ALLOW_EMPTY:libsss-sudo = "1"
146 147
147FILES:${PN} += "${base_libdir}/security/pam_sss*.so \ 148FILES:${PN} += "${base_libdir}/security/pam_sss*.so \
148 ${nonarch_libdir}/tmpfiles.d \ 149 ${nonarch_libdir}/tmpfiles.d \
150 ${datadir}/dbus-1/system.d/*.conf \
149 ${datadir}/dbus-1/system-services/*.service \ 151 ${datadir}/dbus-1/system-services/*.service \
150 ${libdir}/krb5/* \ 152 ${libdir}/krb5/* \
151 ${libdir}/ldb/* \ 153 ${libdir}/ldb/* \