ipa-diagnose 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. ipa_diagnose-0.1.0/LICENSE +190 -0
  2. ipa_diagnose-0.1.0/PKG-INFO +295 -0
  3. ipa_diagnose-0.1.0/README.md +258 -0
  4. ipa_diagnose-0.1.0/pyproject.toml +64 -0
  5. ipa_diagnose-0.1.0/setup.cfg +4 -0
  6. ipa_diagnose-0.1.0/src/ipa_diagnose/__init__.py +10 -0
  7. ipa_diagnose-0.1.0/src/ipa_diagnose/__main__.py +6 -0
  8. ipa_diagnose-0.1.0/src/ipa_diagnose/ai/__init__.py +19 -0
  9. ipa_diagnose-0.1.0/src/ipa_diagnose/ai/anthropic_provider.py +67 -0
  10. ipa_diagnose-0.1.0/src/ipa_diagnose/ai/bedrock_provider.py +100 -0
  11. ipa_diagnose-0.1.0/src/ipa_diagnose/ai/openai_provider.py +76 -0
  12. ipa_diagnose-0.1.0/src/ipa_diagnose/ai/prompt.py +98 -0
  13. ipa_diagnose-0.1.0/src/ipa_diagnose/ai/provider.py +101 -0
  14. ipa_diagnose-0.1.0/src/ipa_diagnose/cli.py +190 -0
  15. ipa_diagnose-0.1.0/src/ipa_diagnose/config.py +69 -0
  16. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/__init__.py +29 -0
  17. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/correlate.py +167 -0
  18. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/model.py +191 -0
  19. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/packs/__init__.py +3 -0
  20. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/packs/base.py +67 -0
  21. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/packs/certificates.py +731 -0
  22. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/packs/directory_server.py +718 -0
  23. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/packs/dns.py +700 -0
  24. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/packs/kerberos.py +517 -0
  25. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/packs/replication.py +683 -0
  26. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/registry.py +34 -0
  27. ipa_diagnose-0.1.0/src/ipa_diagnose/engine/run.py +16 -0
  28. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/__init__.py +17 -0
  29. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collect.py +145 -0
  30. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/__init__.py +3 -0
  31. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/base.py +54 -0
  32. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/certmonger.py +208 -0
  33. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/dns_lookup.py +221 -0
  34. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/filesystem.py +194 -0
  35. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/journal_dirsrv.py +201 -0
  36. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/journal_krb5kdc.py +168 -0
  37. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/journal_named.py +189 -0
  38. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/journal_pki.py +160 -0
  39. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/kerberos_client.py +307 -0
  40. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/ldap_query.py +304 -0
  41. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/registry.py +63 -0
  42. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/collectors/replication_agreements.py +286 -0
  43. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/healthcheck.py +120 -0
  44. ipa_diagnose-0.1.0/src/ipa_diagnose/evidence/model.py +139 -0
  45. ipa_diagnose-0.1.0/src/ipa_diagnose/privacy/__init__.py +10 -0
  46. ipa_diagnose-0.1.0/src/ipa_diagnose/privacy/minimize.py +162 -0
  47. ipa_diagnose-0.1.0/src/ipa_diagnose/privacy/preview.py +36 -0
  48. ipa_diagnose-0.1.0/src/ipa_diagnose/privacy/redact.py +119 -0
  49. ipa_diagnose-0.1.0/src/ipa_diagnose/render/__init__.py +4 -0
  50. ipa_diagnose-0.1.0/src/ipa_diagnose/render/console.py +233 -0
  51. ipa_diagnose-0.1.0/src/ipa_diagnose/render/json_output.py +69 -0
  52. ipa_diagnose-0.1.0/src/ipa_diagnose/verify.py +165 -0
  53. ipa_diagnose-0.1.0/src/ipa_diagnose.egg-info/PKG-INFO +295 -0
  54. ipa_diagnose-0.1.0/src/ipa_diagnose.egg-info/SOURCES.txt +56 -0
  55. ipa_diagnose-0.1.0/src/ipa_diagnose.egg-info/dependency_links.txt +1 -0
  56. ipa_diagnose-0.1.0/src/ipa_diagnose.egg-info/entry_points.txt +2 -0
  57. ipa_diagnose-0.1.0/src/ipa_diagnose.egg-info/requires.txt +17 -0
  58. ipa_diagnose-0.1.0/src/ipa_diagnose.egg-info/top_level.txt +1 -0
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing
141
+ the origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 ipa-diagnose contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,295 @@
1
+ Metadata-Version: 2.4
2
+ Name: ipa-diagnose
3
+ Version: 0.1.0
4
+ Summary: Evidence-grounded diagnostic and correlation engine for FreeIPA / Red Hat IdM administrators
5
+ Author: ipa-diagnose contributors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/InfraGuard-Labs/ipa-diagnose
8
+ Project-URL: Issues, https://github.com/InfraGuard-Labs/ipa-diagnose/issues
9
+ Keywords: freeipa,ipa,identity-management,kerberos,ldap,diagnostics,sysadmin
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: System Administrators
13
+ Classifier: Operating System :: POSIX :: Linux
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: System :: Systems Administration
20
+ Classifier: Topic :: System :: Networking :: Monitoring
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: rich<15,>=13.7
25
+ Provides-Extra: openai
26
+ Requires-Dist: openai<2,>=1.40; extra == "openai"
27
+ Provides-Extra: anthropic
28
+ Requires-Dist: anthropic<1,>=0.34; extra == "anthropic"
29
+ Provides-Extra: bedrock
30
+ Requires-Dist: boto3<2,>=1.34; extra == "bedrock"
31
+ Provides-Extra: ai
32
+ Requires-Dist: ipa-diagnose[anthropic,bedrock,openai]; extra == "ai"
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest<9,>=8; extra == "dev"
35
+ Requires-Dist: pytest-cov<6,>=5; extra == "dev"
36
+ Dynamic: license-file
37
+
38
+ # ipa-diagnose
39
+
40
+ **`ipa-healthcheck` tells you a check failed. `ipa-diagnose` tells you which
41
+ failures are related, what's actually wrong, why you should believe that,
42
+ what it affects, what to do first, whether that's safe, and how to confirm
43
+ it's fixed.**
44
+
45
+ It is a deterministic, evidence-grounded correlation engine that sits on top
46
+ of `ipa-healthcheck` plus a handful of targeted, read-only collectors
47
+ (`journalctl`, `getcert list`, `ipa-replica-manage`, `dig`, `klist`/`kvno`,
48
+ read-only `ldapsearch`). AI (OpenAI, Anthropic, or AWS Bedrock) is entirely
49
+ optional and only ever explains a diagnosis the deterministic engine already
50
+ computed - it never decides the root cause, invents evidence, or invents a
51
+ command to run.
52
+
53
+ ![Primary root-cause diagnosis](artifacts/screenshots/03_primary_root_cause.png)
54
+
55
+ ## Why this exists
56
+
57
+ `ipa-healthcheck` is FreeIPA's own excellent diagnostic tool, and
58
+ `ipa-diagnose` does not reimplement or replace it - it reads its JSON output.
59
+ But by design, `ipa-healthcheck` only checks one host in isolation: it does
60
+ not correlate two related failures into one story, does not read logs, does
61
+ not explain impact, and does not recommend a next step (this is confirmed by
62
+ reading its own source and documentation, not assumed - see
63
+ [docs/research.md](docs/research.md)). An administrator staring at ten
64
+ failing checks after a bad night still has to work out, by hand, which one
65
+ is the actual problem and which nine are just symptoms.
66
+
67
+ `ipa-diagnose` is the layer that does that correlation, deterministically,
68
+ with every claim traceable back to real evidence:
69
+
70
+ ```text
71
+ DETECT → COLLECT EVIDENCE → CORRELATE → DIAGNOSE → EXPLAIN → RECOMMEND → VERIFY
72
+ ```
73
+
74
+ ## Example
75
+
76
+ Three independent-looking `ipa-healthcheck` failures - a DNS record check, a
77
+ `named` service check, and a Kerberos KDC-discovery failure on a client -
78
+ turn out to be one problem:
79
+
80
+ ![Correlated findings](artifacts/screenshots/04_correlated_findings.png)
81
+
82
+ And when the evidence genuinely isn't enough to tell two causes apart,
83
+ `ipa-diagnose` says so instead of guessing:
84
+
85
+ ![Unknown result](artifacts/screenshots/06_unknown_insufficient_evidence.png)
86
+
87
+ See [artifacts/screenshots/index.md](artifacts/screenshots/index.md) for all
88
+ 19 captured scenarios (healthy, degraded, multiple independent problems,
89
+ `--details`, CAUTION/HIGH-RISK actions, `verify`, all three AI providers,
90
+ AI-failure fallback, the `ai-preview` redaction view, malformed input, and
91
+ the real RPM install) - every one of them is real recorded output from the
92
+ actual application, not a mockup.
93
+
94
+ ## Installation
95
+
96
+ **Target experience** (once published to a COPR repository - see
97
+ [packaging/rpm/README.md](packaging/rpm/README.md) for the one remaining
98
+ manual publish step):
99
+
100
+ ```bash
101
+ sudo dnf copr enable <maintainer>/ipa-diagnose
102
+ sudo dnf install ipa-diagnose
103
+ sudo ipa-diagnose
104
+ ```
105
+
106
+ **Available today** (PyPI/pipx - works on any RHEL/CentOS/Fedora host with
107
+ Python 3.9+, and is also the right path for development, testing, and early
108
+ adoption):
109
+
110
+ ```bash
111
+ pipx install ipa-diagnose
112
+ sudo ipa-diagnose
113
+ ```
114
+
115
+ **Building and testing the RPM yourself**, entirely in Docker, with zero
116
+ host installs, is documented in
117
+ [packaging/rpm/README.md](packaging/rpm/README.md) - it walks through
118
+ building the RPM, running it through a full install/upgrade/uninstall
119
+ lifecycle in a clean Fedora container, and building the `.src.rpm` COPR
120
+ would build from.
121
+
122
+ `ipa-diagnose` needs to run where `ipa-healthcheck` and the FreeIPA/389-DS
123
+ tooling it shells out to already exist - i.e., on an actual IPA server or
124
+ client, as root (or with `sudo`).
125
+
126
+ ## Quick start
127
+
128
+ ```bash
129
+ sudo ipa-diagnose # diagnose (default)
130
+ sudo ipa-diagnose --details # full evidence, confidence, every action
131
+ sudo ipa-diagnose --json # machine-readable, for automation
132
+ sudo ipa-diagnose verify # did the problem actually clear?
133
+ sudo ipa-diagnose ai-preview # see exactly what would be sent to an AI provider
134
+ sudo ipa-diagnose --no-ai # never contact any AI provider (also the default)
135
+ ```
136
+
137
+ Try it without a live FreeIPA host, against the same fixtures used in
138
+ testing and screenshots:
139
+
140
+ ```bash
141
+ docker compose run --rm dev ipa-diagnose --replay tests/fixtures/replication/peer-unreachable diagnose
142
+ ```
143
+
144
+ ## Architecture
145
+
146
+ ```text
147
+ ipa-healthcheck JSON + targeted read-only evidence
148
+ │ (journalctl, getcert, ipa-replica-manage, dig, klist/kvno, ldapsearch)
149
+
150
+ Evidence Normalizer (every fact keeps its provenance: which command produced it)
151
+
152
+ Privacy / Redaction (secret detection + minimum-evidence-selection, before anything
153
+ │ could reach an AI provider - see docs/security-privacy.md)
154
+
155
+ Diagnostic Engine (5 versioned packs: replication, certificates, kerberos, dns,
156
+ │ directory-server - see docs/diagnostic-packs.md)
157
+
158
+ Correlation + Prioritization (deterministic - PRIMARY / RELATED SYMPTOM /
159
+ │ SECONDARY INDEPENDENT / WARNING; UNKNOWN is a first-class outcome)
160
+
161
+ Structured Diagnosis
162
+ ┌────────┴────────┐
163
+ ▼ ▼
164
+ Local Explanation Optional AI (OpenAI | Anthropic | Bedrock) - explains only,
165
+ └────────┬────────┘ never decides (see docs/ai-configuration.md)
166
+
167
+ CLI
168
+
169
+ Verification (`ipa-diagnose verify` re-collects evidence and re-diagnoses -
170
+ never trusts a remediation command's exit code alone)
171
+ ```
172
+
173
+ Full writeup, including the design rationale for each stage, is in
174
+ [docs/architecture.md](docs/architecture.md).
175
+
176
+ ## Supported diagnoses (v1)
177
+
178
+ Five diagnostic packs, chosen because they're where `ipa-healthcheck`'s own
179
+ single-host, no-correlation, no-log-analysis design leaves the most value on
180
+ the table (see [docs/research.md](docs/research.md) for the full gap
181
+ analysis against `ipa-healthcheck`):
182
+
183
+ | Pack | Covers | Ambiguity it explicitly refuses to guess through |
184
+ |---|---|---|
185
+ | **Replication** | Peer connectivity breaks, replication conflicts, stale RUVs, topology disconnection | Conflict entries mean replication *is* transmitting writes, not that it's broken - a documented trap this pack does not fall into |
186
+ | **Certificates / CA** | Stuck certmonger renewals, expired certs, RA-agent/Dogtag desync, unreachable renewal master | `CA_UNREACHABLE` has 3+ unrelated root causes sharing one state name; only DIAGNOSES when the actual error text is specific enough |
187
+ | **Kerberos** | Clock skew, keytab/KVNO mismatch, DNS-caused KDC discovery failure | "Preauthentication failed" is a generic bucket produced by all three causes - only a direct KVNO comparison counts as proof of a keytab problem |
188
+ | **DNS** | `named`/bind-dyndb-ldap down, forward-zone/empty-zone collisions, broken SRV/autodiscovery records | A documented `ipa-healthcheck` false-positive (issue #270) means WARNING-only SRV findings are treated with extra skepticism, not trusted blindly |
189
+ | **Directory Server / LDAP** | Disk exhaustion, ownership/SELinux mismatches, NSS/TLS DB format issues, missing indexes | An NSS DB format mismatch looks exactly like an expired certificate - this pack explicitly says so rather than misattributing it |
190
+
191
+ Each pack's rules, sourcing, and confidence levels are documented in
192
+ [docs/diagnostic-packs.md](docs/diagnostic-packs.md).
193
+
194
+ ## The evidence model
195
+
196
+ Every `Finding` and `EvidenceItem` the engine reasons about carries a
197
+ `Provenance` - the exact command that produced it. `--details` shows this;
198
+ nothing is ever "the tool just knows this." Full model in
199
+ [docs/architecture.md](docs/architecture.md#evidence-model).
200
+
201
+ ## Diagnostic packs, in one sentence each
202
+
203
+ See [docs/diagnostic-packs.md](docs/diagnostic-packs.md) for the full
204
+ evidence/confidence/action/verification breakdown per rule, with citations.
205
+
206
+ ## Security and privacy
207
+
208
+ FreeIPA is identity infrastructure; `ipa-diagnose` treats all evidence as
209
+ potentially sensitive. Before anything can reach an external AI provider, it
210
+ passes through: normalization → minimum-evidence-selection (only what a
211
+ diagnosis actually cites) → secret detection (field-name **and**
212
+ pattern-based) → redaction → truncation. Run `ipa-diagnose ai-preview` to see
213
+ the *exact* payload that would be sent, every time, with a redaction summary
214
+ - the preview and the real call share the same code path, so it cannot lie
215
+ to you. Full detail, including the adversarial tests (prompt injection,
216
+ secret leakage, command injection, malformed input) in
217
+ [docs/security-privacy.md](docs/security-privacy.md).
218
+
219
+ ## AI configuration (entirely optional)
220
+
221
+ ```bash
222
+ export OPENAI_API_KEY=... && sudo ipa-diagnose --ai-provider openai
223
+ export ANTHROPIC_API_KEY=... && sudo ipa-diagnose --ai-provider anthropic
224
+ # Bedrock uses boto3's normal credential chain (IAM role, env vars, ~/.aws/)
225
+ sudo ipa-diagnose --ai-provider bedrock
226
+ ```
227
+
228
+ AI provider SDKs are optional extras - `pip install ipa-diagnose[openai]`,
229
+ `[anthropic]`, `[bedrock]`, or `[ai]` for all three - so the base install has
230
+ no AI-related dependencies at all, and `--no-ai` (the default) requires
231
+ none of them. If a provider fails, times out, or returns something that
232
+ looks like a fabricated command, `ipa-diagnose` silently falls back to the
233
+ local, deterministic explanation - it never blocks or degrades the core
234
+ diagnosis. Full detail in [docs/ai-configuration.md](docs/ai-configuration.md).
235
+
236
+ ## Verification
237
+
238
+ ```bash
239
+ sudo ipa-diagnose verify
240
+ ```
241
+
242
+ Re-collects evidence and re-runs the full diagnostic engine, then diffs the
243
+ result against the last run - `RESOLVED`, `STILL_PRESENT`,
244
+ `PARTIALLY_RESOLVED`, or `UNABLE_TO_VERIFY`. It never claims success just
245
+ because a remediation command happened to exit `0` (a real, documented
246
+ FreeIPA case - `ipa group-del` reporting "Insufficient access" while still
247
+ deleting the group - is exactly the kind of false signal this avoids). Full
248
+ detail in [docs/verification.md](docs/verification.md).
249
+
250
+ Something not behaving as expected? See
251
+ [docs/troubleshooting.md](docs/troubleshooting.md) first.
252
+
253
+ ## Development (Docker only)
254
+
255
+ Nothing is installed on the host - everything runs inside the `ipa-diagnose`
256
+ Docker Compose project:
257
+
258
+ ```bash
259
+ docker compose build dev
260
+ docker compose run --rm test # full test suite
261
+ docker compose run --rm dev bash # interactive shell
262
+ ```
263
+
264
+ 99 tests: unit tests for the engine/correlation/redaction core, per-pack
265
+ fixture tests (one directory per scenario under `tests/fixtures/`, each with
266
+ an expected outcome in `meta.json`), and an adversarial suite covering false
267
+ correlation, prompt injection, secret leakage, command injection, and
268
+ malformed/oversized input. See [docs/limitations.md](docs/limitations.md)
269
+ for what's fixture-validated vs. container-integration-tested vs. genuinely
270
+ real-FreeIPA-validated - this project does not overclaim which is which.
271
+
272
+ ## Limitations
273
+
274
+ - **Single-host by design**, same as `ipa-healthcheck` itself - some
275
+ questions (is every DNS server in the topology serving correct records?
276
+ has RUV fully converged across all masters?) genuinely need a multi-host
277
+ view this tool doesn't have. Where a rule's confidence is capped for this
278
+ reason, it says so in `--details`.
279
+ - **v1 covers 5 diagnostic packs**, not every FreeIPA subsystem. See
280
+ [docs/limitations.md](docs/limitations.md) for the full list of what's
281
+ deliberately out of scope for now.
282
+ - **Diagnosis-first, not auto-remediation.** `ipa-diagnose` never executes a
283
+ CAUTION or HIGH-RISK action automatically, and v1 has no "fix it for me"
284
+ mode. That is a deliberate scope decision, not a missing feature.
285
+
286
+ ## Contributing
287
+
288
+ See [docs/contributing.md](docs/contributing.md) - in short: everything
289
+ builds and tests in Docker, every new diagnostic rule needs a fixture with
290
+ an expected outcome, and "I'm not sure" (`UNKNOWN_*`) is always an
291
+ acceptable, often correct, answer for a rule to give.
292
+
293
+ ## License
294
+
295
+ Apache-2.0. See [LICENSE](LICENSE).