diff options
| author | Yi Zhao <yi.zhao@eng.windriver.com> | 2025-03-27 21:23:26 +0800 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2025-04-13 14:07:57 -0400 |
| commit | 0d6aa528cf91701cfc368dc3013d9bba84d2d831 (patch) | |
| tree | a6e9887dd33fabd582481bf2cfa1ea95939fe52a /dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch | |
| parent | b7b2d12c4f0e037894f2c8a46d3a254b5dc1b032 (diff) | |
| download | meta-security-0d6aa528cf91701cfc368dc3013d9bba84d2d831.tar.gz | |
sssd: upgrade 2.9.2 -> 2.10.2
ChangeLog:
https://github.com/SSSD/sssd/releases/tag/2.10.2
* Drop backport patches.
* Update sssd.conf and volatile files.
* Drop PACKAGECONFIG[infopipe] as it has been removed upstream.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch')
| -rw-r--r-- | dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch | 318 |
1 files changed, 0 insertions, 318 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 deleted file mode 100644 index 6880405..0000000 --- a/dynamic-layers/networking-layer/recipes-security/sssd/files/0001-sssctl-add-error-analyzer.patch +++ /dev/null | |||
| @@ -1,318 +0,0 @@ | |||
| 1 | Backport patch to fix interpreter of sss_analyze. | ||
| 2 | |||
| 3 | Upstream-Status: Backport [https://github.com/SSSD/sssd/commit/ed3726c] | ||
| 4 | |||
| 5 | Signed-off-by: Kai Kang <kai.kang@windriver.com> | ||
| 6 | |||
| 7 | From ed3726c37fe07aab788404bfa2f9003db15f4210 Mon Sep 17 00:00:00 2001 | ||
| 8 | From: roy214 <abroy@redhat.com> | ||
| 9 | Date: Tue, 25 Apr 2023 20:01:24 +0530 | ||
| 10 | Subject: [PATCH] sssctl: add error analyzer | ||
| 11 | MIME-Version: 1.0 | ||
| 12 | Content-Type: text/plain; charset=UTF-8 | ||
| 13 | Content-Transfer-Encoding: 8bit | ||
| 14 | |||
| 15 | Also removing unused variable and import. | ||
| 16 | |||
| 17 | Reviewed-by: Justin Stephenson <jstephen@redhat.com> | ||
| 18 | Reviewed-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 | |||
| 30 | diff --git a/src/tools/analyzer/Makefile.am b/src/tools/analyzer/Makefile.am | ||
| 31 | index 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) | ||
| 47 | diff --git a/src/tools/analyzer/modules/error.py b/src/tools/analyzer/modules/error.py | ||
| 48 | new file mode 100644 | ||
| 49 | index 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 | ||
| 114 | diff --git a/src/tools/analyzer/modules/request.py b/src/tools/analyzer/modules/request.py | ||
| 115 | index 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: | ||
| 235 | diff --git a/src/tools/analyzer/sss_analyze b/src/tools/analyzer/sss_analyze | ||
| 236 | index 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 | |||
| 245 | diff --git a/src/tools/analyzer/sss_analyze.py b/src/tools/analyzer/sss_analyze.py | ||
| 246 | index 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 | """ | ||
| 269 | diff --git a/src/tools/analyzer/util.py b/src/tools/analyzer/util.py | ||
| 270 | new file mode 100644 | ||
| 271 | index 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 | ||
